]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
Adds test about ftp port when memcap is reached
authorPhilippe Antoine <contact@catenacyber.fr>
Wed, 28 Dec 2022 14:53:35 +0000 (15:53 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 17 Apr 2023 08:44:24 +0000 (10:44 +0200)
Ticket: #5701

tests/ftp-port-memcap/README.md [new file with mode: 0644]
tests/ftp-port-memcap/input.pcap [new file with mode: 0644]
tests/ftp-port-memcap/test.yaml [new file with mode: 0644]

diff --git a/tests/ftp-port-memcap/README.md b/tests/ftp-port-memcap/README.md
new file mode 100644 (file)
index 0000000..74e3fd2
--- /dev/null
@@ -0,0 +1,11 @@
+# Description
+
+Test FTP PORT parsing when memcap is reached
+Cf https://redmine.openinfosecfoundation.org/issues/5701
+
+# PCAP
+
+The pcap is manually crafted with fuzzpcap to have
+- First FTP_COMMAND_PORT request allocates state->port_line and sets state->port_line_len : everything is fine so far
+- Another request tries to realloc but fails due to memcap : it resets state->port_line but not state->port_line_len
+- A response calls rs_ftp_active_port(NULL, 25);
diff --git a/tests/ftp-port-memcap/input.pcap b/tests/ftp-port-memcap/input.pcap
new file mode 100644 (file)
index 0000000..811c225
Binary files /dev/null and b/tests/ftp-port-memcap/input.pcap differ
diff --git a/tests/ftp-port-memcap/test.yaml b/tests/ftp-port-memcap/test.yaml
new file mode 100644 (file)
index 0000000..c371a9d
--- /dev/null
@@ -0,0 +1,9 @@
+args:
+- -k none --set app-layer.protocols.ftp.memcap=512
+
+checks:
+  - filter:
+      count: 2
+      match:
+        event_type: ftp
+        ftp.command: "PORT"