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

Quic ietf 4967 v8 #7130

Closed
wants to merge 15 commits into from
Closed

Conversation

catenacyber
Copy link
Contributor

Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4967
https://redmine.openinfosecfoundation.org/issues/5143
https://redmine.openinfosecfoundation.org/issues/5166

Describe changes:

  • Parses standardized QUIC IETF v1
  • bump up rust carte tls_parser already used by rep, so that it can be used by quic
  • Rustfmt previous code

suricata-verify-pr: 780
OISF/suricata-verify#780

Replaces #7122 with naming the keyword ja3s with an s if it is from the server

Still to do more generally about quic : see https://redmine.openinfosecfoundation.org/issues/4966 (frame support)

Ticket: 4967

The format of initial packet for quic ietf, ie quic v1,
is described in rfc 9000, section 17.2.2
so that we can use new functions in quic parser
and logs interesting extensions from crypto frame
As it can be 4, but it can also be 1, based on the first
decrypted byte
The way to determine if the payload is encrypted is by storing
in the state if we have seen a crypto frame in both directions...
So as to keep parse not too big
This was referenced Mar 10, 2022
As the ja3 standard names it so, with an s, when it comes
from the server to the client.
@codecov
Copy link

codecov bot commented Mar 10, 2022

Codecov Report

Merging #7130 (71bc1fd) into master (3a490fb) will increase coverage by 0.01%.
The diff coverage is 92.15%.

@@            Coverage Diff             @@
##           master    #7130      +/-   ##
==========================================
+ Coverage   78.06%   78.08%   +0.01%     
==========================================
  Files         628      629       +1     
  Lines      185266   185319      +53     
==========================================
+ Hits       144635   144702      +67     
+ Misses      40631    40617      -14     
Flag Coverage Δ
fuzzcorpus 60.08% <52.94%> (+0.09%) ⬆️
suricata-verify 54.58% <88.88%> (-0.02%) ⬇️
unittests 63.12% <74.00%> (+<0.01%) ⬆️

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

@victorjulien
Copy link
Member

ja3s is still logged as ja3. For a comparison, see our tls-ja3s SV test:

{
  "timestamp": "2019-05-15T08:11:18.955582+0000",
  "flow_id": 143691514005172,
  "pcap_cnt": 11,
  "event_type": "tls",
  "src_ip": "2a03:b0c0:0002:00d0:0000:0000:0bd3:4001",
  "src_port": 48106,
  "dest_ip": "2606:2800:0220:0001:0248:1893:25c8:1946",
  "dest_port": 443,
  "proto": "TCP",
  "tls": {
    "subject": "C=US, ST=California, L=Los Angeles, O=Internet Corporation for Assigned Names and Numbers, OU=Technology, CN=www.example.org",
    "issuerdn": "C=US, O=DigiCert Inc, CN=DigiCert SHA2 Secure Server CA",
    "serial": "0F:D0:78:DD:48:F1:A2:BD:4D:0F:2B:A9:6B:60:38:FE",
    "fingerprint": "7b:b6:98:38:69:70:36:3d:29:19:cc:57:72:84:69:84:ff:d4:a8:89",
    "sni": "example.com",
    "version": "TLS 1.2",
    "notbefore": "2018-11-28T00:00:00",
    "notafter": "2020-12-02T12:00:00",
    "ja3": {
      "hash": "1fe4c7a3544eb27afec2adfb3a3dbf60",
      "string": "771,49196-49200-159-52393-52392-52394-49195-49199-158-49188-49192-107-49187-49191-103-49162-49172-57-49161-49171-51-157-156-61-60-53-47-255,0-11-10-13172-16-22-23-13,29-23-25-24,0-1-2"
    },
    "ja3s": {
      "hash": "5d79edf64e03689ff559a54e9d9487bc",
      "string": "771,49199,65281-0-11-16-23"
    }
  }
}

As this is a bidir tx it has both ja3 (client) and ja3s (server). In the quic case we just need to make sure the fields are named properly, so a tx will have either ja3 or ja3s.

Can we also log both the hash and the string link in tls?

@victorjulien
Copy link
Member

Can you add quic-events.rules? I wanted to see why I have so many errors:

app_layer.flow.quic                           | Total                     | 102201
app_layer.tx.quic                             | Total                     | 145479
app_layer.error.quic.parser                   | Total                     | 5277807

@victorjulien
Copy link
Member

Btw eve has no anomaly records for these errors either. So we may not be setting events?

@suricata-qa
Copy link

WARNING:

field test baseline %
tlpr1_stats_chk
.app_layer.flow.quic 33523 39556 84.75%
.app_layer.tx.quic 106109 4198 2527.61%
.app_layer.error.quic.parser 54065 43951 123.01%

Pipeline 6538

@victorjulien
Copy link
Member

WARNING:

field test baseline %
tlpr1_stats_chk
.app_layer.flow.quic 33523 39556 84.75%
.app_layer.tx.quic 106109 4198 2527.61%
.app_layer.error.quic.parser 54065 43951 123.01%
Pipeline 6538

Fewer quic flows... is that expected?

fn quic_get_tls_extensions(
input: Option<&[u8]>, ja3: &mut String, client: bool,
) -> Vec<QuicTlsExtension> {
let mut extv = Vec::new();
Copy link
Member

Choose a reason for hiding this comment

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

How often, if ever would we endup not adding anything to this vector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when parse_tls_extensions fails, that is on malformed messages...
What are you thinking of ?

@catenacyber
Copy link
Contributor Author

Can we also log both the hash and the string link in tls?

Done in next version

I did not do the detection part, as it is only applying a to_md5 transform...

@catenacyber
Copy link
Contributor Author

Can you add quic-events.rules?

Done

So we may not be setting events?

There were no events so far, added with the rules

@victorjulien
Copy link
Member

Can we also log both the hash and the string link in tls?

Done in next version

I did not do the detection part, as it is only applying a to_md5 transform...

I'd like to reconsider the quic.ja3 keyword completely, and consider adding support for the existing ja3* keywords. These are not limited to tls by their name, so doing something like alert quic ... ja3.string; content:"abc"; seems to make most sense to me.

@catenacyber
Copy link
Contributor Author

Fewer quic flows... is that expected?

I think not, I made a fix against some .app_layer.error.quic.parser let's see if we get more flows then

@catenacyber
Copy link
Contributor Author

I'd like to reconsider the quic.ja3 keyword completely, and consider adding support for the existing ja3* keywords. These are not limited to tls by their name, so doing something like alert quic ... ja3.string; content:"abc"; seems to make most sense to me.

Done in next version

@catenacyber catenacyber mentioned this pull request Mar 16, 2022
@catenacyber
Copy link
Contributor Author

Replaced by #7144

jasonish added a commit to jasonish/suricata that referenced this pull request Jul 2, 2024
We currently pin "time" to 0.3.20, but this version no longer compiles
on nightly Rust, and will likely not compile on the next stable
version of Rust.

During configure, set the version of "time" based on the version of
rustc found, 0.3.20 for Rust < 1.67, and the current version for Rust
1.67 and newer, which also builds on Rust nightly.

Issue: OISF#7130
jasonish added a commit to jasonish/suricata that referenced this pull request Jul 2, 2024
jasonish added a commit to jasonish/suricata that referenced this pull request Jul 2, 2024
jasonish added a commit to jasonish/suricata that referenced this pull request Jul 2, 2024
victorjulien added a commit to victorjulien/suricata that referenced this pull request Jul 27, 2024
Fixes build on rustc 1.80.

Bumps the MSRV to 1.67.1.

Bug: OISF#7130.
victorjulien added a commit to victorjulien/suricata that referenced this pull request Jul 28, 2024
Fixes build on rustc 1.80.

Bumps the MSRV to 1.67.1.

Bug: OISF#7130.
victorjulien added a commit to victorjulien/suricata that referenced this pull request Jul 28, 2024
Fixes build on rustc 1.80.

Bumps the MSRV to 1.67.1.

Bug: OISF#7130.
victorjulien added a commit to victorjulien/suricata that referenced this pull request Jul 29, 2024
Fixes build on rustc 1.80.

Bumps the MSRV to 1.67.1.

Bug: OISF#7130.
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.

4 participants