Sample captures, Email and file transfer

SMTP email with a script attachment

An email with a base64-encoded JavaScript attachment, invoice_4471.js.

Packets
32
Duration
0.372 s
Size
3.2 KB
Protocols
TCP, SMTP
License
CC0

What it shows

A complete SMTP session: EHLO, MAIL FROM, RCPT TO, and a MIME message with a text part and an attachment, invoice_4471.js, encoded in base64. The script only prints a line.

The attachment's text is only readable after MIME decoding. Suricata matches it with file.data and the file name with file.name. Snort 3 decodes it into file_data.

Rules for this capture

Suricata 8 and 7

Try these rules
alert smtp any any -> any any (msg:"JavaScript attachment"; flow:established,to_server; file.name; content:".js"; endswith; sid:1000001; rev:1;)
alert smtp any any -> any any (msg:"WScript.Shell in a decoded attachment"; flow:established,to_server; file.data; content:"WScript.Shell"; sid:1000002; rev:1;)
alert tcp any any -> any 25 (msg:"JavaScript attachment"; flow:established,to_server; content:"Content-Disposition: attachment"; content:".js|22|", distance 0; sid:1000001; rev:1;)
alert tcp any any -> any 25 (msg:"WScript.Shell in a decoded attachment"; flow:established,to_server; file_data; content:"WScript.Shell"; sid:1000002; rev:1;)

Packets

No.TimeSourceDestinationProtocolInfo
10.000192.0.2.10:51025198.51.100.20:25TCPSYN
20.012198.51.100.20:25192.0.2.10:51025TCPSYN ACK
30.024192.0.2.10:51025198.51.100.20:25TCPACK
40.036198.51.100.20:25192.0.2.10:51025TCPPSH ACK, 220 mail.example.com ESMTP Postfix
50.048192.0.2.10:51025198.51.100.20:25TCPACK
60.060192.0.2.10:51025198.51.100.20:25TCPPSH ACK, EHLO billing-pc
70.072198.51.100.20:25192.0.2.10:51025TCPACK
80.084198.51.100.20:25192.0.2.10:51025TCPPSH ACK, 250-mail.example.com
90.096192.0.2.10:51025198.51.100.20:25TCPACK
100.108192.0.2.10:51025198.51.100.20:25TCPPSH ACK, MAIL FROM:<billing@badexample.net>
110.120198.51.100.20:25192.0.2.10:51025TCPACK
120.132198.51.100.20:25192.0.2.10:51025TCPPSH ACK, 250 2.1.0 Ok
130.144192.0.2.10:51025198.51.100.20:25TCPACK
140.156192.0.2.10:51025198.51.100.20:25TCPPSH ACK, RCPT TO:<ap@example.com>
150.168198.51.100.20:25192.0.2.10:51025TCPACK
160.180198.51.100.20:25192.0.2.10:51025TCPPSH ACK, 250 2.1.5 Ok
170.192192.0.2.10:51025198.51.100.20:25TCPACK
180.204192.0.2.10:51025198.51.100.20:25TCPPSH ACK, DATA
190.216198.51.100.20:25192.0.2.10:51025TCPACK
200.228198.51.100.20:25192.0.2.10:51025TCPPSH ACK, 354 End data with <CR><LF>.<CR><LF>
210.240192.0.2.10:51025198.51.100.20:25TCPACK
220.252192.0.2.10:51025198.51.100.20:25TCPPSH ACK, From: "Billing" <billing@badexample.net>
230.264198.51.100.20:25192.0.2.10:51025TCPACK
240.276198.51.100.20:25192.0.2.10:51025TCPPSH ACK, 250 2.0.0 Ok: queued as 4F2A81C0B3
250.288192.0.2.10:51025198.51.100.20:25TCPACK
260.300192.0.2.10:51025198.51.100.20:25TCPPSH ACK, QUIT
270.312198.51.100.20:25192.0.2.10:51025TCPACK
280.324198.51.100.20:25192.0.2.10:51025TCPPSH ACK, 221 2.0.0 Bye
290.336192.0.2.10:51025198.51.100.20:25TCPACK
300.348192.0.2.10:51025198.51.100.20:25TCPFIN ACK
310.360198.51.100.20:25192.0.2.10:51025TCPFIN ACK
320.372192.0.2.10:51025198.51.100.20:25TCPACK

More Email and file transfer samples