Sample captures, HTTP

PowerShell download cradle

PowerShell fetches a script that decodes base64 and runs it with Invoke-Expression.

Packets
10
Duration
0.108 s
Size
1.1 KB
Protocols
TCP, HTTP
License
CC0

What it shows

A Windows PowerShell User-Agent requests /s/a.ps1 from cdn.badexample.net. The script it gets back decodes a base64 string and passes it to Invoke-Expression, the pattern of many download cradles. The decoded command only prints a line.

For rules on the User-Agent and on the response body.

The script in the response

$b = 'V3JpdGUtSG9zdCAiU2FtcGxlIHBheWxvYWQi'
$c = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($b))
Invoke-Expression $c

To read what it runs without running it, paste it into Deobfuscate PowerShell.

Rules for this capture

Suricata 8 and 7

Try these rules
alert http any any -> any any (msg:"Windows PowerShell User-Agent"; flow:established,to_server; http.user_agent; content:"WindowsPowerShell/"; sid:1000001; rev:1;)
alert http any any -> any any (msg:"PowerShell decodes base64 and runs it"; flow:established,to_client; file.data; content:"FromBase64String"; nocase; content:"Invoke-Expression"; nocase; sid:1000002; rev:1;)
alert http any any -> any any (msg:"Windows PowerShell User-Agent"; flow:established,to_server; http_header:field user-agent; content:"WindowsPowerShell/"; sid:1000001; rev:1;)
alert http any any -> any any (msg:"PowerShell decodes base64 and runs it"; flow:established,to_client; file_data; content:"FromBase64String", nocase; content:"Invoke-Expression", nocase; sid:1000002; rev:1;)

Packets

No.TimeSourceDestinationProtocolInfo
10.000192.0.2.10:49802203.0.113.66:80TCPSYN
20.012203.0.113.66:80192.0.2.10:49802TCPSYN ACK
30.024192.0.2.10:49802203.0.113.66:80TCPACK
40.036192.0.2.10:49802203.0.113.66:80TCPPSH ACK, GET /s/a.ps1 HTTP/1.1
50.048203.0.113.66:80192.0.2.10:49802TCPACK
60.060203.0.113.66:80192.0.2.10:49802TCPPSH ACK, HTTP/1.1 200 OK
70.072192.0.2.10:49802203.0.113.66:80TCPACK
80.084192.0.2.10:49802203.0.113.66:80TCPFIN ACK
90.096203.0.113.66:80192.0.2.10:49802TCPFIN ACK
100.108192.0.2.10:49802203.0.113.66:80TCPACK

More HTTP samples