alert tcp any any → any any (msg:“test ack”; flags:A; window:512; threshold:type both,track by_dst,count 90,seconds 1; sid:80000453;)
stream:
midstream: yes
memcap: 64mb
checksum-validation: yes
inline: auto # auto will use inline mode in IPS mode, yes or no set it statically
reassembly:
memcap: 256mb
depth: 1mb # reassemble 1mb into a stream
toserver-chunk-size: 1024 #2560
toclient-chunk-size: 1024
randomize-chunk-size: yes
Hi, it’s quite hard to understand your question.
Seems like you are asking why the rule is triggering.
The very first ACK packet in the pcap (packet number 7) has a TCP window size of 512 so it will trigger the alert.
This seems to be the case for the other ACK packets i looked at as well. That will probably get you over the threshold of 90 packets and trigger the alert.
" threshold:type both,track by_dst,count 90,seconds 1; " Doesn’t it mean the alert only happens when " flags:A; window:512;" occurs 90 times in 1 second?
I think your understanding of the rule keyword is correct, leezp. When I check that pcap you shared and filter in Wireshark for “tcp.flags.ack==1 and tcp.window_size_value>=512”, in one second, there are more than 400 packets matching showing, even after the filter. So maybe the rule is alerting correctly?
I thought the “window” keyword is a fixed value and not a stage。 like this:
“window:512; ” means the tcp.window_size_value=512 and not tcp.window_size_value>=512
I understand that the documentation makes it ambiguous, somewhat. But it seems to me that the interpretation is that the window size will be 512 or more.
alert http2 any any -> any any (http2.window:34634; sid:4; rev:1;)
The test.yaml file checks for 2 matches for said rule, meaning that we expect two packets that will trigger that condition. If we inspect the pcap, we don’t see packets with the exact window_size of 34634, but we see two that are bigger than that - 43690 (see screenshot). From that example, my understanding is that the window keyword is used for window sizes that are equal or bigger than the specified value…