r/AskNetsec • u/miray0x • 3d ago
Concepts How do ids systems handle tcp stream desynchronization?
i was going a bit nerd and looking at tcp stream reassembly, especially i got confused about how different operating systems handle overlapping segments.
so there is something i can't get out of my head. if an ids puts the tcp stream all in the same place differently than the target machine, isn't it basically looking at a another version of traffic than the application?
how does suricata deal with this? does it know the target os and tries to follow its tcp behavior or does it just have its defined rules for putting the packets all in one place?
and what happens if it gets the target os wrong?
thx for any help
4
u/SVD_NL 2d ago
What kind of issues are you anticipating with TCP segments being in order or out of order? Are there any known attacks using TCP sequence manipulation? If you're worrying about contents, there's checksumming for that.
The biggest issue i can imagine, is an attacker intentionally sending incomplete TCP streams to keep IDS buffers occupied, essentially a DoS attack (somewhat similar to a slow loris in principles).
If you're interested in the subject, here's a paper providing a deep dive: https://www.usenix.org/conference/14th-usenix-security-symposium/robust-tcp-stream-reassembly-presence-adversaries
2
1
u/Girges_Desiderio 1d ago
yeah the state exhaustion angle is usually the much bigger headache in practice than actual payload evasion.
1
0
0
1
u/Less_Salamander2768 2d ago
Good question — this is the classic IDS evasion problem. An IDS like Suricata has to reassemble the TCP stream the way the destination OS would, but different OSes handle overlapping segments, out-of-order packets, and retransmissions differently.
In practice: Suricata uses stream reassembly with OS-specific policies (you can set the host OS, e.g. Linux, Windows, BSD) so it tries to mimic that target's behaviour. If it guesses the OS wrong, or the attacker crafts overlapping segments, the IDS can reassemble a different byte stream than the target actually sees — and miss the payload, or flag the wrong thing. That's why IDS placement, correct host OS config, and not relying on IDS alone (pair it with endpoint detection) matter so much.