Pcap Capture - Include 3WHS and remaining flow data before TCP/HTTP alert

Hello, I’m using Suricata 7.0.6 and pcap capture along with the conditional option set to alerts.

Is there any way to log the full flow that eventually lead to an alert (additionally to the alerting packets and remaining data) ?

It is my understanding that Suricata, with conditional set to alerts, only log packets including and after the alert takes place. Would it be possible (with a combination of suricata rules, for example) to capture the full TCP/HTTP session of an alert?

I’ve tried the following, which won’t work because “flowbits:noalert;” (or “noalert;”) is set, but was hopping the pcap capture module won’t honor it :slight_smile: (maybe a new or different combination of flowbits flags could be used for this).

alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"Incoming TCP Connection (SYN)"; tcp.flags:S; flowbits:set,incoming_tcp; flowbits:noalert; sid:1;)

# Same result as above
# alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"Incoming TCP Connection (SYN)"; tcp.flags:S; flowbits:set,incoming_tcp; noalert; sid:1;)

alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"HTTP Request"; flowbits:isset,incoming_tcp; content:"/"; http_uri; flowbits:unset,incoming_tcp; sid:2;)

It’s not that easy, you can learn more details about the advantages but also limitations of the conditional pcap at the talk from Suricon 2021 SuriCon 2021 | Boston – SURICON from Eric Leblond.