]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
Add ACK validation to Reset/RST validation code.
authorVictor Julien <victor@inliniac.net>
Mon, 10 Jan 2011 21:07:36 +0000 (22:07 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 10 Jan 2011 21:07:36 +0000 (22:07 +0100)
src/decode-events.h
src/stream-tcp.c

index 96810e324126b4d5ad871b8636be384f8dacf5e9..69ea27d7d2708af2ba0f2c9d8ca8305ec8c3c249 100644 (file)
@@ -171,6 +171,7 @@ enum {
     STREAM_TIMEWAIT_INVALID_ACK,
     STREAM_PKT_INVALID_TIMESTAMP,
     STREAM_PKT_INVALID_ACK,
+    STREAM_RST_INVALID_ACK,
 
     /* should always be last! */
     DECODE_EVENT_MAX,
index 540746ad5ab78469c76386efcace172fdee142dd..1cd9e6aa48f84250c55ee1758302f510bdbe399b 100644 (file)
@@ -3399,11 +3399,24 @@ static int ValidReset(TcpSession *ssn, Packet *p)
             StreamTcpSetOSPolicy(&ssn->server, p);
 
         os_policy = ssn->server.os_policy;
+
+        if (StreamTcpValidateAck(&ssn->server, p) == -1) {
+            SCLogDebug("ssn %p: rejecting because of invalid ack value", ssn);
+            StreamTcpSetEvent(p, STREAM_RST_INVALID_ACK);
+            SCReturnInt(-1);
+        }
+
     } else {
         if (ssn->client.os_policy == 0)
             StreamTcpSetOSPolicy(&ssn->client, p);
 
         os_policy = ssn->client.os_policy;
+
+        if (StreamTcpValidateAck(&ssn->client, p) == -1) {
+            SCLogDebug("ssn %p: rejecting because of invalid ack value", ssn);
+            StreamTcpSetEvent(p, STREAM_RST_INVALID_ACK);
+            SCReturnInt(-1);
+        }
     }
 
     switch (os_policy) {