Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/mqtt-frames-truncated/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Description
===========
Test MQTT frames[Pdu, Header, Data] for truncated messages where msg_len > max_msg_size.

PCAP
====
PCAP comes from the suricata verify test[mqtt-limit-1]

Redmine ticket
==============
https://redmine.openinfosecfoundation.org/issues/5731
11 changes: 11 additions & 0 deletions tests/mqtt-frames-truncated/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
alert mqtt any any -> any any (msg:"mqtt truncated Frame 1"; frame:pdu; content:"|32 a7 8d|"; startswith; sid:1;)
alert mqtt any any -> any any (msg:"mqtt truncated Frame 2"; frame:pdu; content:"|58 58 58|"; endswith; sid:2;)

alert mqtt any any -> any any (msg:"mqtt truncated Frame 3"; frame:header; content:"|32|"; sid:3;)
alert mqtt any any -> any any (msg:"mqtt truncated Frame 4"; frame:header; content:"|30|"; sid:4;)

alert mqtt any any -> any any (msg:"mqtt truncated Frame 5"; frame:pdu; content:"|17 0C E2|"; sid:5;)
alert mqtt any any -> any any (msg:"mqtt truncated Frame 6"; frame:pdu; content:"|00 00 54 46|"; sid:6;)

alert mqtt any any -> any any (msg:"mqtt truncated Frame 7"; frame:data; content:"|00 03|"; startswith; sid:7;)
alert mqtt any any -> any any (msg:"mqtt truncated Frame 8"; frame:data; content:"|58 58 58|"; sid:8;)
55 changes: 55 additions & 0 deletions tests/mqtt-frames-truncated/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
pcap: ../mqtt-limit-1/input.pcap

requires:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the min-version: 7 requirement here, since frame support, so far, is from 7 on, only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright

features:
- HAVE_LIBJANSSON
files:
- rust/src/mqtt/parser.rs
Comment on lines +2 to +7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not needed :)


args:
- -k none
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we usually add a new line between each test.yaml session.

checks:
- filter:
count: 1
match:
alert.signature_id: 1
frame.type: "pdu"
- filter:
count: 2
match:
alert.signature_id: 2
frame.type: "pdu"
frame.complete: true
- filter:
count: 3
match:
alert.signature_id: 3
frame.type: "header"
frame.complete: true
- filter:
count: 1
match:
alert.signature_id: 4
frame.type: "header"
frame.length: 2
frame.complete: true
- filter:
count: 0
match:
alert.signature_id: 5
- filter:
count: 0
match:
alert.signature_id: 6
- filter:
count: 2
match:
alert.signature_id: 7
frame.type: "data"
frame.complete: true
- filter:
count: 2
match:
alert.signature_id: 8
frame.type: "data"
frame.complete: true
11 changes: 11 additions & 0 deletions tests/mqtt-frames/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Description
===========
Test MQTT frames[Pdu, Header, Data].

PCAP
====
PCAP comes from the suricata verify test[mqtt5-pub-userpass]

Redmine ticket
==============
https://redmine.openinfosecfoundation.org/issues/5731
Binary file added tests/mqtt-frames/input.pcap
Binary file not shown.
11 changes: 11 additions & 0 deletions tests/mqtt-frames/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
alert mqtt any any -> any any (msg:"mqtt Frame 1"; frame:pdu; content:"|10 2f 00|"; startswith; sid:1;)
alert mqtt any any -> any any (msg:"mqtt Frame 2"; frame:pdu; content:"|61 73 73|"; endswith; sid:2;)

alert mqtt any any -> any any (msg:"mqtt Frame 3"; flow:to_server; frame:header; content:"|10|"; sid:3;)
alert mqtt any any -> any any (msg:"mqtt Frame 4"; frame:header; content:"|20|"; sid:4;)

alert mqtt any any -> any any (msg:"mqtt Frame 5"; frame:pdu; content:"|17 0C E2|"; sid:5;)
alert mqtt any any -> any any (msg:"mqtt Frame 6"; frame:pdu; content:"|00 00 54 46|"; sid:6;)

alert mqtt any any -> any any (msg:"mqtt Frame 7"; frame:data; content:"|00 00 03 22|"; startswith; sid:7;)
alert mqtt any any -> any any (msg:"mqtt Frame 8"; frame:data; content:"|00 06|"; sid:8;)
51 changes: 51 additions & 0 deletions tests/mqtt-frames/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
requires:
min-version: 7

args:
- -k none
checks:
- filter:
count: 1
match:
alert.signature_id: 1
frame.type: "pdu"
frame.length: 49
- filter:
count: 1
match:
alert.signature_id: 2
frame.type: "pdu"
frame.complete: true
- filter:
count: 1
match:
alert.signature_id: 3
frame.type: "header"
frame.complete: true
- filter:
count: 1
match:
alert.signature_id: 4
frame.type: "header"
frame.length: 2
frame.complete: true
- filter:
count: 0
match:
alert.signature_id: 5
- filter:
count: 0
match:
alert.signature_id: 6
- filter:
count: 1
match:
alert.signature_id: 7
frame.type: "data"
frame.complete: true
- filter:
count: 1
match:
alert.signature_id: 8
frame.type: "data"
frame.complete: true