Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tls extra alert/v2 #12169

Closed
wants to merge 2 commits into from
Closed

Conversation

victorjulien
Copy link
Member

As #12095, but now also includes SIG_TYPE_APPLAYER. Still not sure if this is the correct approach.

SV_BRANCH=OISF/suricata-verify#2148

The above SV PR shows the effects on the existing tests.

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.
SIG_TYPE_APPLAYER are mostly the same as SIG_TYPE_PKT, except that a
rule match will apply a drop/pass to the flow.

Example of a SIG_TYPE_APPLAYER rule.

```
alert http any any -> any any (sid: 1;)
```
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.83%. Comparing base (bd7d38e) to head (e80a559).
Report is 42 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12169      +/-   ##
==========================================
+ Coverage   49.81%   49.83%   +0.02%     
==========================================
  Files         909      909              
  Lines      257904   257906       +2     
==========================================
+ Hits       128467   128539      +72     
+ Misses     129437   129367      -70     
Flag Coverage Δ
fuzzcorpus 60.99% <100.00%> (+0.04%) ⬆️
livemode 19.43% <50.00%> (+<0.01%) ⬆️
pcap 43.60% <100.00%> (-0.82%) ⬇️
suricata-verify 62.75% <100.00%> (+<0.01%) ⬆️
unittests 8.98% <0.00%> (-0.01%) ⬇️

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

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 23613

@catenacyber
Copy link
Contributor

I rather feel #12095

@victorjulien
Copy link
Member Author

I rather feel #12095

Why is that?

@catenacyber
Copy link
Contributor

Because I think app-layer detection may happen at the pseudo packet

@victorjulien
Copy link
Member Author

Because I think app-layer detection may happen at the pseudo packet

Right, ya. It's a bit inconsistent either way, it feels. The whole SIG_TYPE_APPLAYER is a bit of a weird one. I believe it did more in the past, but it seems now the only way to do it is alert http .... (sid:1;). As soon as other matches are added, the type changes.

@catenacyber
Copy link
Contributor

And #12095 is a minimal behavior change responding to initial demand

@catenacyber
Copy link
Contributor

I think this should get closed in favor of the other PR

@victorjulien
Copy link
Member Author

victorjulien commented Dec 10, 2024

replaced by #12258

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.

3 participants