]> git.ipfire.org Git - thirdparty/suricata.git/commit
tcp: do not assign TCP flags to pseudopackets 10484/head 10485/head
authorLukas Sismis <lsismis@oisf.net>
Tue, 6 Feb 2024 10:38:19 +0000 (11:38 +0100)
committerLukas Sismis <lukas.sismis@gmail.com>
Wed, 21 Feb 2024 12:40:20 +0000 (13:40 +0100)
commit1b474cd45cbc3e364b3317f3793caf9494111229
tree766447b832dd049d47d7d2a723d8047a11283fb0
parentd93b21c5240c00657c350f47f0bbc02c29778ad5
tcp: do not assign TCP flags to pseudopackets

Previously pseudopackets were assigned with ACK flag which falsely turned
"SYN" flows to "SYN/ACK" flows when Suricata ran with raw content-matching
rules. The problem occured during the flow timeout or Suricata shutdown,
essentially, when the flow was being kicked out (with a pseudopacket).

When Suricata ran without raw content-matching rules (the ruleset did not
contain content matching keywords or it only contained keywords that are
app-layer content-matching) then raw stream reassembly tracking is turned off
(SignatureHasStreamContent()).
This in turn disabled a check in StreamNeedsReassembly() and the right edge
was not checked with the raw stream progress. In turn, it did not generate
a pseudopacket that would go through the detection engine. Suricata with
raw content-matching keywords would therefore on a flow with SYN packet only
return STREAM_HAS_UNPROCESSED_SEGMENTS_NEED_ONLY_DETECTION which would generate
the pseudopacket.

In Suricata versions <= 6.0.x, the flow output was correct because
only the commit 1bb6f44ff01363fa29488f1ae83b9368e33c2770 started to
differentiate the right edge calculation between the raw and application
layer streams. The older Suricata versions used only the application layer
right edge equation and therefore did not generate a pseudopacket.

Ticket: #6734
(cherry picked from commit ebf465a11bffcd2049e17648e6c46c067692b02a)
src/flow-timeout.c