TCP Header Values and Stream Size
The system supports keywords that are designed to identify attacks attempted using TCP headers of packets and TCP stream size.
ack
You can use the
ack
keyword to compare a value against a packet’s TCP
acknowledgment number. The rule triggers if a packet’s TCP acknowledgment
number matches the value specified for the
ack
keyword.
Argument values for
ack
must be numeric.
flags
You can use the
flags
keyword to specify any combination of TCP flags
that, when set in an inspected packet, cause the rule to trigger.
Note | In situations where you would traditionally use
|
You can either check for or ignore the values described in the
following table for the
flag
keyword.
Argument |
TCP Flag |
---|---|
Ack |
Acknowledges data. |
Psh |
Data should be sent in this packet. |
Syn |
A new connection. |
Urg |
Packet contains urgent data. |
Fin |
A closed connection. |
Rst |
An aborted connection. |
CWR |
An ECN congestion window has been reduced. This was formerly the R1 argument, which is still supported for backward compatibility. |
ECE |
ECN echo. This was formerly the R2 argument, which is still supported for backward compatibility. |
When using the
flags
keyword, you can use an operator to indicate how
the system performs matches against multiple flags. The following table
describes these operators.
Operator |
Description |
Example |
---|---|---|
all |
The packet must contain all specified flags. |
Select
|
any |
The packet can contain any of the specified flags. |
Select
|
not |
The packet must not contain the specified flag set. |
Select
|
flow
You can use the
flow
keyword to select packets for inspection by a rule
based on session characteristics. The
flow
keyword allows you to specify the direction of the
traffic flow to which a rule applies, applying rules to either the client flow
or server flow. To specify how the
flow
keyword inspects your packets, you can set the
direction of traffic you want analyzed, the state of packets inspected, and
whether the packets are part of a rebuilt stream.
Stateful inspection of packets occurs when rules are processed.
If you want a TCP rule to ignore stateless traffic (traffic without an
established session context), you must add the
flow
keyword to the rule and select the
Established argument for the keyword. If you want a
UDP rule to ignore stateless traffic, you must add the
flow
keyword to the rule and select either the
Established argument or a directional argument, or
both. This causes the TCP or UDP rule to perform stateful inspection of a
packet.
When you add a directional argument, the rules engine inspects
only those packets that have an established state with a flow that matches the
direction specified. For example, if you add the
flow
keyword with the
established
argument and the
From Client
argument to a rule that triggers when a TCP
or UDP connection is detected, the rules engine only inspects packets that are
sent from the client.
Tip | For maximum performance, always include a
|
The following table describes the stream-related arguments you
can specify for the
flow
keyword:
Argument |
Description |
---|---|
Established |
Triggers on established connections. |
Stateless |
Triggers regardless of the state of the stream processor. |
The following table describes the directional options you can
specify for the
flow
keyword:
Argument |
Description |
---|---|
To Client |
Triggers on server responses. |
To Server |
Triggers on client responses. |
From Client |
Triggers on client responses. |
From Server |
Triggers on server responses. |
Notice that
From Server
and
To Client
perform the same function, as do
To Server
and
From Client
. These options exist to add context and
readability to the rule. For example, if you create a rule designed to detect
an attack from a server to a client, use
From Server
. But, if you create a rule designed to
detect an attack from the client to the server, use
From Client
.
The following table describes the stream-related arguments you
can specify for the
flow
keyword:
Argument |
Description |
---|---|
Ignore Stream Traffic |
Does not trigger on rebuilt stream packets. |
Only Stream Traffic |
Triggers only on rebuilt stream packets. |
For example, you can use
To Server, Established, Only Stream Traffic
as the value for the
flow
keyword to detect traffic, traveling from a client
to the server in an established session, that has been reassembled by the
stream preprocessor.
seq
The
seq
keyword allows you to specify a static sequence
number value. Packets whose sequence number matches the specified argument
trigger the rule containing the keyword. While this keyword is used rarely, it
is helpful in identifying attacks and network scans that use generated packets
with static sequence numbers.
window
You can use the
window
keyword to specify the TCP window size you are
interested in. A rule containing this keyword triggers whenever it encounters a
packet with the specified TCP window size. While this keyword is used rarely,
it is helpful in identifying attacks and network scans that use generated
packets with static TCP window sizes.
stream_size
You can use the
stream_size
keyword in conjunction with the stream preprocessor to
determine the size in bytes of a TCP stream, using the format:
direction,operator,bytes
where bytes is number of bytes. You must separate each option in the argument with a comma (,).
The following table describes the case-insensitive directional
options you can specify for the
stream_size
keyword:
Argument |
Description |
---|---|
client |
triggers on a stream from the client matching the specified stream size. |
server |
triggers on a stream from the server matching the specified stream size. |
both |
triggers on traffic from the client and traffic from the server both matching the specified stream size. For example, the argument
|
either |
triggers on traffic from either the client or the server matching the specified stream size, whichever occurs first. For example, the argument
|
The following table describes the operators you can use with the
stream_size
keyword:
Operator |
Description |
---|---|
= |
equal to |
!= |
not equal to |
> |
greater than |
< |
less than |
>= |
greater than or equal to |
<= |
less than or equal to |
For example, you could use
client, >=, 5001216
as the argument for the
stream_size
keyword to detect a TCP stream traveling
from a client to a server and greater than or equal to 5001216 bytes.