]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
doc: update http.request_header keyword
authorjason taylor <jtfas90@gmail.com>
Mon, 5 Feb 2024 21:46:59 +0000 (21:46 +0000)
committerVictor Julien <victor@inliniac.net>
Wed, 10 Apr 2024 05:03:07 +0000 (07:03 +0200)
Ticket: 3025

Signed-off-by: jason taylor <jtfas90@gmail.com>
doc/userguide/rules/http-keywords.rst
doc/userguide/rules/http2-keywords.rst

index 4ed792d56422314be9d4e24bdba0ca0a9d564714..c3c7ee0fd8cb26358ee1890b52c01b5651505137 100644 (file)
@@ -1099,20 +1099,32 @@ Example Duplicate Host Header Request::
 http.request_header
 -------------------
 
-Match on the name and value of a HTTP request header (HTTP1 or HTTP2).
+The ``http.request_header`` keyword is used to match on the name and value
+of a HTTP/1 or HTTP/2 request.
 
-For HTTP2, name and value get concatenated by ": ", colon and space.
-To detect if a http2 header name contains ':',
-the keyword ``http2.header_name`` can be used.
+It is possible to use any of the :doc:`payload-keywords` with the
+``http.request_header`` keyword.
 
-Examples::
+For HTTP/2, the header name and value get concatenated by ": " (colon and space).
+The colon and space are commonly noted with the hexadecimal format `|3a 20|`
+within signatures.
+
+To detect if an HTTP/2 header name contains a ":" (colon), the keyword
+:ref:`http2.header_name` can be used.
 
-  http.request_header; content:"agent: nghttp2";
-  http.request_header; content:"custom-header: I love::colons";
+Example HTTP/1 Request::
 
-``http.request_header`` is a 'sticky buffer'.
+  GET /index.html HTTP/1.1
+  User-Agent: Mozilla/5.0
+  Host: suricata.io
+
+.. container:: example-rule
+
+  alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"HTTP Request Example"; \
+  flow:established,to_server; :example-rule-options:`http.request_header; \
+  content:"Host|3a 20|suricata.io";` classtype:bad-unknown; sid:126; rev:1;)
 
-``http.request_header`` can be used as ``fast_pattern``.
+.. note:: ``http.request_header`` does not include the trailing \\r\\n
 
 .. _http.response_header:
 
index c4761151bcb8ec60e6aa441628ea31ae7dba61db..6d4618df2124c211637fb0983e034ea640a6e57a 100644 (file)
@@ -102,6 +102,8 @@ Examples::
   http2.settings:SETTINGS_ENABLE_PUSH=0;
   http2.settings:SETTINGS_HEADER_TABLE_SIZE>4096;
 
+.. _http2.header_name:
+
 http2.header_name
 -----------------