]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: reject broken ACK packets
authorVictor Julien <victor@inliniac.net>
Thu, 21 Nov 2019 15:10:21 +0000 (16:10 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 13 Dec 2019 12:13:28 +0000 (13:13 +0100)
Fix evasion posibility by rejecting packets with a broken ACK field.
These packets have a non-0 ACK field, but do not have a ACK flag set.

Bug #3324.

Reported-by: Nicolas Adba
src/stream-tcp.c

index b38f40cd540360865e1451ecfb112637075ac53c..df392376ba752522ad4e2d467be62f5795da4977 100644 (file)
@@ -4803,6 +4803,7 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt,
     /* broken TCP http://ask.wireshark.org/questions/3183/acknowledgment-number-broken-tcp-the-acknowledge-field-is-nonzero-while-the-ack-flag-is-not-set */
     if (!(p->tcph->th_flags & TH_ACK) && TCP_GET_ACK(p) != 0) {
         StreamTcpSetEvent(p, STREAM_PKT_BROKEN_ACK);
+        goto error;
     }
 
     /* If we are on IPS mode, and got a drop action triggered from
@@ -6929,7 +6930,7 @@ static int StreamTcpTest10 (void)
 
     tcph.th_win = htons(5480);
     tcph.th_seq = htonl(10);
-    tcph.th_ack = htonl(11);
+    tcph.th_ack = 0;
     tcph.th_flags = TH_SYN;
     p->tcph = &tcph;