Payload keywords inspect the content of the payload of a packet or
stream.
Content
-------
The content keyword is very important in signatures. Between the
quotation marks you can write on what you would like the signature to
match. The most simple format of content is::
content: ”............”;
It is possible to use several contents in a signature.
Contents match on bytes. There are 256 different values of a byte
(0-255). You can match on all characters; from a till z, upper case
and lower case and also on all special signs. But not all of the bytes
are printable characters. For these bytes heximal notations are
used. Many programming languages use 0x00 as a notation, where 0x
means it concerns a binary value, however the rule language uses
``|00|`` as a notation. This kind of notation can also be used for
printable characters.
Example::
|61| is a
|61 61| is aa
|41| is A
|21| is !
|0D| is carriage return
|0A| is line feed
There are characters you can not use in the content because they are
already important in the signature. For matching on these characters
you should use the heximal notation. These are::
“ |22|
; |3B|
: |3A|
| |7C|
It is a convention to write the heximal notation in upper case characters.
To write for instance ``http://`` in the content of a signature, you
should write it like this: ``content: “http|3A|//”;`` If you use a
heximal notation in a signature, make sure you always place it between
pipes. Otherwise the notation will be taken literally as part of the
content.
A few examples::
content:“a|0D|bc”;
content:”|61 0D 62 63|";
content:”a|0D|b|63|”;
It is possible to let a signature check the whole payload for a match with the content or to let it check specific parts of the payload. We come to that later.
If you add nothing special to the signature, it will try to find a match in all the bytes of the payload.
Example:
..image:: payload-keywords/content.png
In this example, the red, bold-faced part is the content.
By default the pattern-matching is case sensitive. The content has to
be accurate, otherwise there will not be a match.
..image:: payload-keywords/content2.png
Legend:
..image:: payload-keywords/Legenda_rules.png
It is possible to use the ! for exceptions in contents as well.
For example::
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"Outdated Firefox on