From: Philippe Antoine Date: Wed, 14 Feb 2024 21:16:28 +0000 (+0100) Subject: http: adds another test for http.request_header keyword X-Git-Tag: suricata-6.0.17~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1652%2Fhead;p=thirdparty%2Fsuricata-verify.git http: adds another test for http.request_header keyword Ticket: 6483 --- diff --git a/tests/http-request-header-multi/README.md b/tests/http-request-header-multi/README.md new file mode 100644 index 000000000..96f720d0d --- /dev/null +++ b/tests/http-request-header-multi/README.md @@ -0,0 +1,12 @@ +# Test Description + +Test `http.request_header` keywords with multiple rules + +## PCAP + +From https://redmine.openinfosecfoundation.org/issues/6483 + + +## Related issues + +https://redmine.openinfosecfoundation.org/issues/6483 diff --git a/tests/http-request-header-multi/input.pcap b/tests/http-request-header-multi/input.pcap new file mode 100644 index 000000000..50283dde5 Binary files /dev/null and b/tests/http-request-header-multi/input.pcap differ diff --git a/tests/http-request-header-multi/test.rules b/tests/http-request-header-multi/test.rules new file mode 100644 index 000000000..6e4d2a0db --- /dev/null +++ b/tests/http-request-header-multi/test.rules @@ -0,0 +1,6 @@ +## contains trailing |0d 0a| in pcre and does not fire, and should not fire, but when this rule is enabled, causes sid:3 to not fire +alert http any any -> any any (flow:established,to_server; http.method; content:"GET"; http.uri; content:"/ws"; endswith; http.user_agent; content:"Go|2d|http|2d|client|2f|1|2e|1"; http.connection; content:"Upgrade"; bsize:7; http.request_header; content:"Key|3a 20|"; startswith; pcre:"/^(?:[a-z0-9]{64})\x0d\x0a/R"; sid:2;) + +## doesn't contain |0d 0a|, should fire and fires by itself, but not when above rule is enabled. +alert http any any -> any any (flow:established,to_server; http.method; content:"GET"; http.uri; content:"/ws"; endswith; http.user_agent; content:"Go|2d|http|2d|client|2f|1|2e|1"; http.connection; content:"Upgrade"; bsize:7; http.request_header; bsize:69; content:"Key|3a 20|"; startswith; pcre:"/^(?:[a-z0-9]{64})$/R"; sid:3;) + diff --git a/tests/http-request-header-multi/test.yaml b/tests/http-request-header-multi/test.yaml new file mode 100644 index 000000000..69e580059 --- /dev/null +++ b/tests/http-request-header-multi/test.yaml @@ -0,0 +1,17 @@ +requires: + min-version: 7 + +args: + - -k none + +checks: + - filter: + count: 0 + match: + event_type: alert + alert.signature_id: 2 + - filter: + count: 1 + match: + event_type: alert + alert.signature_id: 3