Decode base64 with PowerShell

Hello

If you look at PowerShell’s help, you’ll see that you can use base64 as a parameter :

PowerShell /?

PowerShellHelp

Like this :

$encodedCommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes("'Hello World !'"))
PowerShell.exe -EncodedCommand $encodedCommand

EncodedCommand

Problem : The base64 is quite obfuscated :

EncodedCommand-2

Solution :

[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($EncodedCommand))

EncodedCommand-3

 

Leave a Reply