--- /dev/null
+# Test Description
+
+This test shows how we handle SMTP frames.
+
+## Related issues
+
+https://redmine.openinfosecfoundation.org/issues/5981
+https://redmine.openinfosecfoundation.org/issues/4905
--- /dev/null
+%YAML 1.1
+---
+
+outputs:
+ - eve-log:
+ enabled: yes
+ types:
+ - alert
+ - files
+ - smtp
+ - anomaly
+ - file-store:
+ version: 2
+ enabled: yes
+ force-filestore: yes
+app-layer:
+ protocols:
+ smtp:
+ enabled: yes
+ raw-extraction: no
+ mime:
+ decode-mime: yes
+ decode-base64: yes
+ decode-quoted-printable: yes
--- /dev/null
+alert smtp any any -> any any (frame:smtp.command_line; content:"MAIL|20|FROM:"; startswith; content:"xxxxx.co.uk"; distance:0; content:">|0d 0a|"; endswith; sid:1;)
+alert smtp any any -> any any (frame:smtp.data; content:"Reply-To:"; startswith; content:"Subject"; distance:0; content:"This is a multi-part message in MIME format."; distance:0; sid:2;)
+alert smtp any any -> any any (frame:smtp.response_line; content:"220 smtp001.mail.xxx.xxxxx.com ESMTP"; startswith; sid:3;)
+alert smtp any any -> any any (frame:smtp.stream; content:"|0d 0a|.|0d 0a|"; sid:4;)
+alert smtp any any -> any any (frame:smtp.command_line; base64_decode; base64_data; content:"galunt"; sid:5;)
+alert smtp any any -> any any (flow:only_stream; content:"|0d 0a|.|0d 0a|"; sid:6;)
+alert smtp any any -> any any (frame:smtp.response_line; content:"354 go ahead"; startswith; sid:7;)
+alert smtp any any -> any any (frame:smtp.response_line; content:"250 ok"; startswith; sid:8;)
--- /dev/null
+requires:
+ min-version: 8
+
+pcap: ../smtp-long-DATA-line/input.pcap
+
+args:
+- -k none
+
+checks:
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 1
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 2
+ frame.tx_id: 0
+ smtp.helo: Percival
+ files[0].filename: "winmail.dat"
+ frame.type: data
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 3
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 4
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 5
+ frame.type: command_line
+ frame.tx_id: 0
+ smtp.helo: Percival
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 6
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 7
+ frame.type: response_line
+ frame.payload_printable: "354 go ahead\r\n"
+ frame.tx_id: 0
+ smtp.helo: Percival
+- filter:
+ count: 3
+ match:
+ alert.signature_id: 8
+ frame.type: response_line
+ frame.tx_id: 0
--- /dev/null
+# Test Description
+
+This test shows how we handle SMTP frames in IPS mode.
+
+## Related issues
+
+https://redmine.openinfosecfoundation.org/issues/5981
+https://redmine.openinfosecfoundation.org/issues/6718
+https://redmine.openinfosecfoundation.org/issues/4905
--- /dev/null
+%YAML 1.1
+---
+
+outputs:
+ - eve-log:
+ enabled: yes
+ types:
+ - alert
+ - files
+ - smtp
+ - anomaly
+ - file-store:
+ version: 2
+ enabled: yes
+ force-filestore: yes
+app-layer:
+ protocols:
+ smtp:
+ enabled: yes
+ raw-extraction: no
+ mime:
+ decode-mime: yes
+ decode-base64: yes
+ decode-quoted-printable: yes
--- /dev/null
+alert smtp any any -> any any (frame:smtp.command_line; content:"MAIL|20|FROM:"; startswith; content:"xxxxx.co.uk"; distance:0; content:">|0d 0a|"; endswith; sid:1;)
+alert smtp any any -> any any (frame:smtp.data; content:"Reply-To:"; startswith; content:"Subject"; distance:0; content:"This is a multi-part message in MIME format."; distance:0; sid:2;)
+alert smtp any any -> any any (frame:smtp.response_line; content:"220 smtp001.mail.xxx.xxxxx.com ESMTP"; startswith; sid:3;)
+alert smtp any any -> any any (frame:smtp.stream; content:"|0d 0a|.|0d 0a|"; sid:4;)
+alert smtp any any -> any any (flow:only_stream; content:"|0d 0a|.|0d 0a|"; sid:5;)
--- /dev/null
+requires:
+ min-version: 8
+
+pcap: ../smtp-long-DATA-line/input.pcap
+
+args:
+- -k none
+- --simulate-ips
+
+checks:
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 1
+- filter:
+ count: 2 # 2 because of multiple smtp.data updates, and we're doing sliding window
+ match:
+ alert.signature_id: 2
+ frame.type: data
+ frame.tx_id: 0
+ smtp.helo: Percival
+ files[0].filename: winmail.dat
+- filter:
+ count: 1
+ match:
+ alert.signature_id: 3
+- filter:
+ count: 3 # 3 due to: 2 scans for data updates, 1 for end of stream
+ match:
+ alert.signature_id: 4
+- filter:
+ count: 2
+ match:
+ alert.signature_id: 5