]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
Adds test about decoder against too many layers
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 23 Feb 2021 13:50:44 +0000 (14:50 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 5 Mar 2021 09:30:33 +0000 (10:30 +0100)
tests/decode-too-many-layers/README.md [new file with mode: 0644]
tests/decode-too-many-layers/ethmpls.py [new file with mode: 0644]
tests/decode-too-many-layers/input.pcap [new file with mode: 0644]
tests/decode-too-many-layers/test.yaml [new file with mode: 0644]

diff --git a/tests/decode-too-many-layers/README.md b/tests/decode-too-many-layers/README.md
new file mode 100644 (file)
index 0000000..957c845
--- /dev/null
@@ -0,0 +1,7 @@
+# Description
+
+Test decode against too many recursive layers
+
+# PCAP
+
+The pcap comes from funning fuzzpcap against the file produced by ethmpls.py
diff --git a/tests/decode-too-many-layers/ethmpls.py b/tests/decode-too-many-layers/ethmpls.py
new file mode 100644 (file)
index 0000000..8a21d8f
--- /dev/null
@@ -0,0 +1,11 @@
+import sys
+
+# write header
+sys.stdout.buffer.write(b"FPC\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
+for i in range(32):
+    # ethernet layer with mpls following
+    sys.stdout.buffer.write(b"\x01\x02\x03\x04\x05\x06\x01\x02\x03\x04\x05\x07\x88\x47")
+    # mpls layer with ethernet following
+    sys.stdout.buffer.write(b"\x00\x01\x01\x00\x00\x00\x00\x00")
+# write footer
+sys.stdout.buffer.write(b"FPC0")
diff --git a/tests/decode-too-many-layers/input.pcap b/tests/decode-too-many-layers/input.pcap
new file mode 100644 (file)
index 0000000..1e40a80
Binary files /dev/null and b/tests/decode-too-many-layers/input.pcap differ
diff --git a/tests/decode-too-many-layers/test.yaml b/tests/decode-too-many-layers/test.yaml
new file mode 100644 (file)
index 0000000..0d625ee
--- /dev/null
@@ -0,0 +1,12 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+  min-version: 5
+
+# disables checksum verification
+args:
+- -k none
+
+checks:
+    - stats:
+        decoder.too_many_layers: 1