]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/alert: Drop packet if rule is pkt only 10963/head
authorJeff Lucovsky <jlucovsky@oisf.net>
Thu, 7 Sep 2023 14:49:23 +0000 (10:49 -0400)
committerVictor Julien <victor@inliniac.net>
Fri, 26 Apr 2024 08:33:40 +0000 (10:33 +0200)
This commit modifies the logic used to determine the disposition of a
flow/packet.

If the rule doesn't require a stream and only contains properties for
packet matching, then the alert is not marked as applying to the
flow and hence, the flow won't be dropped.

Issue: 5578

src/detect-engine-alert.c

index a40f992ced1de748842a6849d08d3f70b7543a7e..54b2e3e38dbbf7ccbce3584b1e30d7d6cb18b060 100644 (file)
@@ -326,6 +326,13 @@ static inline void FlowApplySignatureActions(
         if ((pa->flags & (PACKET_ALERT_FLAG_STATE_MATCH | PACKET_ALERT_FLAG_STREAM_MATCH)) ||
                 (s->flags & (SIG_FLAG_IPONLY | SIG_FLAG_LIKE_IPONLY | SIG_FLAG_PDONLY |
                                     SIG_FLAG_APPLAYER))) {
+
+            /* No action when the signature doesn't require a stream */
+            if ((s->flags &
+                        (SIG_FLAG_APPLAYER | SIG_FLAG_REQUIRE_PACKET | SIG_FLAG_REQUIRE_STREAM)) ==
+                    (SIG_FLAG_APPLAYER | SIG_FLAG_REQUIRE_PACKET))
+                return;
+
             pa->flags |= PACKET_ALERT_FLAG_APPLY_ACTION_TO_FLOW;
             SCLogDebug("packet %" PRIu64 " sid %u action %02x alert_flags %02x (set "
                        "PACKET_ALERT_FLAG_APPLY_ACTION_TO_FLOW)",