The start of the state machine is prompted by a SYN; state 1 is reached if a packet of length greater than 0 but less than 20 is detected; state 2 is reached if a packet of length 1 is received right after a SYN or a second packet of length greater than 0 but less than 20 is detected; the final state is reached if a packet of a length between 0 and 100 is seen. This state diagram was derived from observing common fragmentation evasion patterns; it seems to catch most of them. More complex state diagrams can also be devised at your discretion.
Table 22 TCP Packets with Anomalous Segmentation
alert on c0 tcp any any
alert on c0 tcp any any
alert on c0 tcp any any
dsize: 0 <> 20; S:8; R:1; C:16;)
alert on c0 tcp any any
Support for Snort's within Keyword
Many
If the within statement is for a large number of bytes, the check needs to be performed across TCP segments. In this case, several packets must be captured to find the
The within statements are translated by the
Table 23 shows two rules which trigger the capturing of TCP and UDP flows.
Table 23 Capturing TCP and UDP Flows
alert on c0 tcp any any
alert on c0 udp any any
72 | Writing Rules |