Skip to content

detect: don't run pkt sigs on ffr pkts#12258

Closed
victorjulien wants to merge 1 commit intoOISF:masterfrom
victorjulien:tls-extra-alert/v3
Closed

detect: don't run pkt sigs on ffr pkts#12258
victorjulien wants to merge 1 commit intoOISF:masterfrom
victorjulien:tls-extra-alert/v3

Conversation

@victorjulien
Copy link
Member

Last packet from the TLS TCP session moves TCP state to CLOSED.

This flags the app-layer with APP_LAYER_PARSER_EOF_TS or APP_LAYER_PARSER_EOF_TC depending on the direction of the final packet. This flag will just have been set in a single direction.

This leads to the last packet updating the inspect id in that packets direction.

At the end of the TLS session a pseudo packet is created, because:

  • flow has ended
  • inspected tx id == 0, for at least one direction
  • total txs is 1

Then a packet rule matches:

alert tcp any any -> any 443 (flow: to_server;                  \
        flowbits:isset,tls_error;                               \
        sid:09901033; rev:1;                                    \
        msg:"Allow TLS error handling (outgoing packet)"; )

The SIG_MASK_REQUIRE_REAL_PKT is not preventing the match, as the flowbits keyword doesn't set it.

To avoid this match. This patch skips signatures of the SIG_TYPE_PKT for flow end packets.

Ticket: #7318.

SV_BRANCH=OISF/suricata-verify#2174

Last packet from the TLS TCP session moves TCP state to CLOSED.

This flags the app-layer with APP_LAYER_PARSER_EOF_TS or
APP_LAYER_PARSER_EOF_TC depending on the direction of the final packet.
This flag will just have been set in a single direction.

This leads to the last packet updating the inspect id in that packets
direction.

At the end of the TLS session a pseudo packet is created, because:
 - flow has ended
 - inspected tx id == 0, for at least one direction
 - total txs is 1

Then a packet rule matches:

```
alert tcp any any -> any 443 (flow: to_server;                  \
        flowbits:isset,tls_error;                               \
        sid:09901033; rev:1;                                    \
        msg:"Allow TLS error handling (outgoing packet)"; )
```

The `SIG_MASK_REQUIRE_REAL_PKT` is not preventing the match, as the
`flowbits` keyword doesn't set it.

To avoid this match. This patch skips signatures of the `SIG_TYPE_PKT`
for flow end packets.

Ticket: OISF#7318.
@codecov
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.22%. Comparing base (38d7900) to head (0cc441e).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12258   +/-   ##
=======================================
  Coverage   83.21%   83.22%           
=======================================
  Files         912      912           
  Lines      257183   257185    +2     
=======================================
+ Hits       214025   214037   +12     
+ Misses      43158    43148   -10     
Flag Coverage Δ
fuzzcorpus 61.06% <100.00%> (+<0.01%) ⬆️
livemode 19.41% <50.00%> (-0.01%) ⬇️
pcap 44.35% <50.00%> (-0.06%) ⬇️
suricata-verify 62.81% <100.00%> (+0.01%) ⬆️
unittests 59.19% <50.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@inashivb inashivb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as #12257 ok for me

@suricata-qa
Copy link

WARNING:

field baseline test %
SURI_TLPW2_autofp_stats_chk
.flow.end.tcp_state.last_ack 0 1 -

Pipeline 23772

@victorjulien
Copy link
Member Author

Merged in #12259

This was referenced Dec 11, 2024
@victorjulien victorjulien deleted the tls-extra-alert/v3 branch April 7, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants