From 4054f614410c6cd2e08a570b0cda56753b08e77f Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Wed, 14 Feb 2024 22:16:28 +0100 Subject: [PATCH] http: adds another test for http.request_header keyword Ticket: 6483 --- tests/http-request-header-multi/README.md | 12 ++++++++++++ tests/http-request-header-multi/input.pcap | Bin 0 -> 673 bytes tests/http-request-header-multi/test.rules | 6 ++++++ tests/http-request-header-multi/test.yaml | 17 +++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 tests/http-request-header-multi/README.md create mode 100644 tests/http-request-header-multi/input.pcap create mode 100644 tests/http-request-header-multi/test.rules create mode 100644 tests/http-request-header-multi/test.yaml 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 0000000000000000000000000000000000000000..50283dde5a824caa75345ac3f97310cf886f8b23 GIT binary patch literal 673 zc-no^Pixdb6aetqvZ!PUlqymRVlF~K)1Aqm$sZ_g?bfb{8ra=dMX@uJm$h`=lq7U5 zDu`bE0#ZRQf)uG>*8Ya 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 -- 2.47.2