]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
add tests for bug 5220 1821/head
authorShivani Bhardwaj <shivanib134@gmail.com>
Thu, 14 Dec 2023 13:16:25 +0000 (18:46 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Tue, 7 May 2024 03:39:02 +0000 (09:09 +0530)
21 files changed:
tests/bug-5220/bug-5220-1/README.md [new file with mode: 0644]
tests/bug-5220/bug-5220-1/test.rules [new file with mode: 0644]
tests/bug-5220/bug-5220-1/test.yaml [new file with mode: 0644]
tests/bug-5220/bug-5220-2/README.md [new file with mode: 0644]
tests/bug-5220/bug-5220-2/test.rules [new file with mode: 0644]
tests/bug-5220/bug-5220-2/test.yaml [new file with mode: 0644]
tests/bug-5220/bug-5220-3/README.md [new file with mode: 0644]
tests/bug-5220/bug-5220-3/test.rules [new file with mode: 0644]
tests/bug-5220/bug-5220-3/test.yaml [new file with mode: 0644]
tests/bug-5220/bug-5220-4/README.md [new file with mode: 0644]
tests/bug-5220/bug-5220-4/test.rules [new file with mode: 0644]
tests/bug-5220/bug-5220-4/test.yaml [new file with mode: 0644]
tests/bug-5220/bug-5220-5/README.md [new file with mode: 0644]
tests/bug-5220/bug-5220-5/test.rules [new file with mode: 0644]
tests/bug-5220/bug-5220-5/test.yaml [new file with mode: 0644]
tests/bug-5220/bug-5220-6/README.md [new file with mode: 0644]
tests/bug-5220/bug-5220-6/test.rules [new file with mode: 0644]
tests/bug-5220/bug-5220-6/test.yaml [new file with mode: 0644]
tests/bug-5220/bug-5220-7/README.md [new file with mode: 0644]
tests/bug-5220/bug-5220-7/test.rules [new file with mode: 0644]
tests/bug-5220/bug-5220-7/test.yaml [new file with mode: 0644]

diff --git a/tests/bug-5220/bug-5220-1/README.md b/tests/bug-5220/bug-5220-1/README.md
new file mode 100644 (file)
index 0000000..a4d746e
--- /dev/null
@@ -0,0 +1,9 @@
+# Test Description
+This test demonstrates that fast_pattern along with base64_data
+should fail with Suricata instead of silently passing through.
+
+## PCAP
+None
+
+## Related issues
+https://redmine.openinfosecfoundation.org/issues/5220
diff --git a/tests/bug-5220/bug-5220-1/test.rules b/tests/bug-5220/bug-5220-1/test.rules
new file mode 100644 (file)
index 0000000..4b72db7
--- /dev/null
@@ -0,0 +1 @@
+alert http $HOME_NET any -> $EXTERNAL_NET any (flow:established,to_server; http.method; content:"POST"; http.request_body; base64_decode:bytes 28; base64_data; content:"something"; fast_pattern; classtype:bad-unknown; sid:123; rev:1;)
diff --git a/tests/bug-5220/bug-5220-1/test.yaml b/tests/bug-5220/bug-5220-1/test.yaml
new file mode 100644 (file)
index 0000000..16203e2
--- /dev/null
@@ -0,0 +1,13 @@
+requires:
+  pcap: false
+  min-version: 8
+
+args:
+  - --engine-analysis
+
+exit-code: 1
+
+checks:
+    - shell:
+        args: grep "fast_pattern cannot be used with base64_data" suricata.log | wc -l | xargs
+        expect: 1
diff --git a/tests/bug-5220/bug-5220-2/README.md b/tests/bug-5220/bug-5220-2/README.md
new file mode 100644 (file)
index 0000000..895b3fb
--- /dev/null
@@ -0,0 +1,10 @@
+# Test Description
+This test demonstrates an invalid combination of base64_data with fast_pattern even
+in case when there are multiple base64_data in a rule. The rule processing shall
+stop the moment the first fast_pattern with base64_data is encountered.
+
+## PCAP
+None
+
+## Related issues
+https://redmine.openinfosecfoundation.org/issues/5220
diff --git a/tests/bug-5220/bug-5220-2/test.rules b/tests/bug-5220/bug-5220-2/test.rules
new file mode 100644 (file)
index 0000000..5939962
--- /dev/null
@@ -0,0 +1 @@
+alert http $HOME_NET any -> $EXTERNAL_NET any (flow:established,to_server; http.method; content:"POST"; http.request_body; base64_decode:bytes 28; base64_data; content:"something"; content:"blah"; fast_pattern; base64_decode: bytes 10; base64_data; content: "test"; classtype:bad-unknown; sid:123; rev:1;)
diff --git a/tests/bug-5220/bug-5220-2/test.yaml b/tests/bug-5220/bug-5220-2/test.yaml
new file mode 100644 (file)
index 0000000..16203e2
--- /dev/null
@@ -0,0 +1,13 @@
+requires:
+  pcap: false
+  min-version: 8
+
+args:
+  - --engine-analysis
+
+exit-code: 1
+
+checks:
+    - shell:
+        args: grep "fast_pattern cannot be used with base64_data" suricata.log | wc -l | xargs
+        expect: 1
diff --git a/tests/bug-5220/bug-5220-3/README.md b/tests/bug-5220/bug-5220-3/README.md
new file mode 100644 (file)
index 0000000..b4e9de1
--- /dev/null
@@ -0,0 +1,10 @@
+# Test Description
+This test demonstrates that fast_pattern along with base64_data
+should fail with Suricata instead of silently passing through even
+if it is followed by several valid base64_data buffers.
+
+## PCAP
+None
+
+## Related issues
+https://redmine.openinfosecfoundation.org/issues/5220
diff --git a/tests/bug-5220/bug-5220-3/test.rules b/tests/bug-5220/bug-5220-3/test.rules
new file mode 100644 (file)
index 0000000..51911c1
--- /dev/null
@@ -0,0 +1 @@
+alert http $HOME_NET any -> $EXTERNAL_NET any (flow:established,to_server; http.method; content:"POST"; http.request_body; base64_decode:bytes 28; base64_data; content:"something"; fast_pattern; base64_decode: bytes 10; base64_data; content:"first"; base64_decode: bytes 10; base64_data; content: "second"; classtype:bad-unknown; sid:123; rev:1;)
diff --git a/tests/bug-5220/bug-5220-3/test.yaml b/tests/bug-5220/bug-5220-3/test.yaml
new file mode 100644 (file)
index 0000000..16203e2
--- /dev/null
@@ -0,0 +1,13 @@
+requires:
+  pcap: false
+  min-version: 8
+
+args:
+  - --engine-analysis
+
+exit-code: 1
+
+checks:
+    - shell:
+        args: grep "fast_pattern cannot be used with base64_data" suricata.log | wc -l | xargs
+        expect: 1
diff --git a/tests/bug-5220/bug-5220-4/README.md b/tests/bug-5220/bug-5220-4/README.md
new file mode 100644 (file)
index 0000000..9e236b6
--- /dev/null
@@ -0,0 +1,10 @@
+# Test Description
+This test demonstrates a invalid use of fast_pattern along with base64_data
+where base64_data is succeeded by a payload keyword and the content right
+after that is fast_pattern.
+
+## PCAP
+None
+
+## Related issues
+https://redmine.openinfosecfoundation.org/issues/5220
diff --git a/tests/bug-5220/bug-5220-4/test.rules b/tests/bug-5220/bug-5220-4/test.rules
new file mode 100644 (file)
index 0000000..7fa2759
--- /dev/null
@@ -0,0 +1 @@
+alert http $HOME_NET any -> $EXTERNAL_NET any (flow:established,to_server; http.method; content:"POST"; http.request_body; base64_decode:bytes 28; base64_data; bsize:=21; content:"something"; fast_pattern; classtype:bad-unknown; sid:123; rev:1;)
diff --git a/tests/bug-5220/bug-5220-4/test.yaml b/tests/bug-5220/bug-5220-4/test.yaml
new file mode 100644 (file)
index 0000000..16203e2
--- /dev/null
@@ -0,0 +1,13 @@
+requires:
+  pcap: false
+  min-version: 8
+
+args:
+  - --engine-analysis
+
+exit-code: 1
+
+checks:
+    - shell:
+        args: grep "fast_pattern cannot be used with base64_data" suricata.log | wc -l | xargs
+        expect: 1
diff --git a/tests/bug-5220/bug-5220-5/README.md b/tests/bug-5220/bug-5220-5/README.md
new file mode 100644 (file)
index 0000000..860cba4
--- /dev/null
@@ -0,0 +1,8 @@
+# Test Description
+This test demonstrates a valid use of fast_pattern before base64_data.
+
+## PCAP
+None
+
+## Related issues
+https://redmine.openinfosecfoundation.org/issues/5220
diff --git a/tests/bug-5220/bug-5220-5/test.rules b/tests/bug-5220/bug-5220-5/test.rules
new file mode 100644 (file)
index 0000000..371edde
--- /dev/null
@@ -0,0 +1 @@
+alert http $HOME_NET any -> $EXTERNAL_NET any (flow:established,to_server; http.method; content:"POST"; fast_pattern; http.request_body; base64_decode:bytes 28; base64_data; bsize:=21; content:"something"; classtype:bad-unknown; sid:123; rev:1;)
diff --git a/tests/bug-5220/bug-5220-5/test.yaml b/tests/bug-5220/bug-5220-5/test.yaml
new file mode 100644 (file)
index 0000000..ad9d438
--- /dev/null
@@ -0,0 +1,8 @@
+requires:
+  pcap: false
+  min-version: 7
+
+args:
+  - --engine-analysis
+
+exit-code: 0
diff --git a/tests/bug-5220/bug-5220-6/README.md b/tests/bug-5220/bug-5220-6/README.md
new file mode 100644 (file)
index 0000000..0ef000c
--- /dev/null
@@ -0,0 +1,8 @@
+# Test Description
+This test demonstrates base64_data w/o fast_pattern.
+
+## PCAP
+None
+
+## Related issues
+https://redmine.openinfosecfoundation.org/issues/5220
diff --git a/tests/bug-5220/bug-5220-6/test.rules b/tests/bug-5220/bug-5220-6/test.rules
new file mode 100644 (file)
index 0000000..2894ec5
--- /dev/null
@@ -0,0 +1 @@
+alert http $HOME_NET any -> $EXTERNAL_NET any (flow:established,to_server; http.method; content:"POST"; http.request_body; base64_decode:bytes 28; base64_data; bsize:=21; content:"something"; classtype:bad-unknown; sid:123; rev:1;)
diff --git a/tests/bug-5220/bug-5220-6/test.yaml b/tests/bug-5220/bug-5220-6/test.yaml
new file mode 100644 (file)
index 0000000..7a3745c
--- /dev/null
@@ -0,0 +1,15 @@
+requires:
+  pcap: false
+  min-version: 7
+
+args:
+  - --engine-analysis
+
+exit-code: 0
+
+checks:
+  - filter:
+      filename: patterns.json
+      count: 1
+      match:
+        buffers[0].patterns[0].pattern: "POST"
diff --git a/tests/bug-5220/bug-5220-7/README.md b/tests/bug-5220/bug-5220-7/README.md
new file mode 100644 (file)
index 0000000..cbd96b5
--- /dev/null
@@ -0,0 +1,9 @@
+# Test Description
+This test demonstrates a valid use of fast_pattern along with base64_data
+with the use of pkt_data to reset the detection pointer.
+
+## PCAP
+None
+
+## Related issues
+https://redmine.openinfosecfoundation.org/issues/5220
diff --git a/tests/bug-5220/bug-5220-7/test.rules b/tests/bug-5220/bug-5220-7/test.rules
new file mode 100644 (file)
index 0000000..0605be4
--- /dev/null
@@ -0,0 +1 @@
+alert http $HOME_NET any -> $EXTERNAL_NET any (flow:established,to_server; http.method; content:"POST"; http.request_body; base64_decode:bytes 28; base64_data; content:"something"; content: "first"; pkt_data; content: "newcontent"; fast_pattern; classtype:bad-unknown; sid:123; rev:1;)
diff --git a/tests/bug-5220/bug-5220-7/test.yaml b/tests/bug-5220/bug-5220-7/test.yaml
new file mode 100644 (file)
index 0000000..ad9d438
--- /dev/null
@@ -0,0 +1,8 @@
+requires:
+  pcap: false
+  min-version: 7
+
+args:
+  - --engine-analysis
+
+exit-code: 0