]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
test: dns name truncation
authorJason Ish <jason.ish@oisf.net>
Fri, 1 Nov 2024 18:02:04 +0000 (12:02 -0600)
committerVictor Julien <victor@inliniac.net>
Wed, 11 Dec 2024 22:09:53 +0000 (23:09 +0100)
Add test for DNS name truncation and associated alert.

Ticket: #7280

tests/dns/dns-truncated-rname/README.md [new file with mode: 0644]
tests/dns/dns-truncated-rname/poc2.pcap [new file with mode: 0644]
tests/dns/dns-truncated-rname/test.rules [new file with mode: 0644]
tests/dns/dns-truncated-rname/test.yaml [new file with mode: 0644]

diff --git a/tests/dns/dns-truncated-rname/README.md b/tests/dns/dns-truncated-rname/README.md
new file mode 100644 (file)
index 0000000..97dd101
--- /dev/null
@@ -0,0 +1,3 @@
+Ticket: https://redmine.openinfosecfoundation.org/issues/7280
+
+PCAP: From ticket.
diff --git a/tests/dns/dns-truncated-rname/poc2.pcap b/tests/dns/dns-truncated-rname/poc2.pcap
new file mode 100644 (file)
index 0000000..66f2e6a
Binary files /dev/null and b/tests/dns/dns-truncated-rname/poc2.pcap differ
diff --git a/tests/dns/dns-truncated-rname/test.rules b/tests/dns/dns-truncated-rname/test.rules
new file mode 100644 (file)
index 0000000..2648dca
--- /dev/null
@@ -0,0 +1,8 @@
+# A resource name was too long (over 1025 chars)
+alert dns any any -> any any (msg:"SURICATA DNS Name too long"; app-layer-event:dns.name_too_long; classtype:protocol-command-decode; sid:224008; rev:1;)
+
+# An infinite loop was found while decoding a DNS resource name.
+alert dns any any -> any any (msg:"SURICATA DNS Infinite loop"; app-layer-event:dns.infinite_loop; classtype:protocol-command-decode; sid:224009; rev:1;)
+
+# Suricata's maximum number of DNS name labels was reached while parsing a resource name.
+alert dns any any -> any any (msg:"SURICATA DNS Too many labels"; app-layer-event:dns.too_many_labels; classtype:protocol-command-decode; sid:224010; rev:1;)
diff --git a/tests/dns/dns-truncated-rname/test.yaml b/tests/dns/dns-truncated-rname/test.yaml
new file mode 100644 (file)
index 0000000..7b94f77
--- /dev/null
@@ -0,0 +1,22 @@
+requires:
+  min-version: 8
+
+args:
+  - --set app-layer.protocols.dns.tcp.detection-ports.dp=1053
+  - -k none
+
+checks:
+  - filter:
+      count: 1
+      match:
+        pcap_cnt: 8
+        event_type: dns
+        dns.queries[0].rrname.__len: 1025
+        dns.queries[0].rrname_truncated: true
+  - filter:
+      count: 1
+      match:
+        pcap_cnt: 9
+        event_type: alert
+        alert.signature_id: 224008
+        dns.queries[0].rrname_truncated: true