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

Alpn/v4 #11325

Closed
wants to merge 5 commits into from
Closed

Alpn/v4 #11325

wants to merge 5 commits into from

Conversation

victorjulien
Copy link
Member

SV_BRANCH=OISF/suricata-verify#1924

#11204, rebased, formatting fixed and minimal docs added.

https://redmine.openinfosecfoundation.org/issues/7055

  "tls": {
    "sni": "cloudflare-quic.com",
    "version": "TLS 1.3",
    "client_alpns": [
      "h2",
      "http/1.1"
    ]
  }

Replaces #11198, adding tls.alpn keyword.

Example alert for rule

alert tls any any -> any any \
    (tls.subjectaltname; content:"p142-contacts.icloud.com"; tls.alpn; content:"http/1.1"; \
    sid:2;)

gives

{
  "timestamp": "2024-06-01T05:55:05.347344+0000",
  "flow_id": 373542629722761,
  "pcap_cnt": 15,
  "event_type": "alert",
  "src_ip": "17.248.236.64",
  "src_port": 443,
  "dest_ip": "10.84.1.49",
  "dest_port": 55349,
  "proto": "TCP",
  "pkt_src": "wire/pcap",
  "tx_id": 0,
  "alert": {
    "action": "allowed",
    "gid": 1,
    "signature_id": 2,
    "rev": 0,
    "signature": "",
    "category": "",
    "severity": 3
  },
  "tls": {
    "subject": "C=US, ST=California, O=Apple Inc., CN=p127-contacts.icloud.com",
    "issuerdn": "CN=Apple IST CA 2 - G1, OU=Certification Authority, O=Apple Inc., C=US",
    "subjectaltname": [
      "p127-contacts.icloud.com",
      "p128-contacts.icloud.com",
      "p129-contacts.icloud.com",
      "p130-contacts.icloud.com",
      "p131-contacts.icloud.com",
      "p132-contacts.icloud.com",
      "p133-contacts.icloud.com",
      "p134-contacts.icloud.com",
      "p135-contacts.icloud.com",
      "p136-contacts.icloud.com",
      "p137-contacts.icloud.com",
      "p138-contacts.icloud.com",
      "p139-contacts.icloud.com",
      "p140-contacts.icloud.com",
      "p141-contacts.icloud.com",
      "p142-contacts.icloud.com"
    ],
    "serial": "4A:96:B3:D3:5F:90:E4:49:E4:D7:ED:85:D4:9E:09:43",
    "fingerprint": "30:83:82:c5:9d:c2:3b:b4:a9:a6:1a:f2:29:3d:ea:2d:84:1a:19:2e",
    "sni": "p130-contacts.icloud.com",
    "version": "TLS 1.2",
    "notbefore": "2023-10-23T11:42:34",
    "notafter": "2024-11-21T11:42:33",
    "client_alpns": [
      "h2",
      "http/1.1"
    ],
    "server_alpns": [
      "http/1.1"
    ]
  },
  "app_proto": "tls",
  "direction": "to_client",
  "flow": {
    "pkts_toserver": 8,
    "pkts_toclient": 7,
    "bytes_toserver": 1038,
    "bytes_toclient": 5400,
    "start": "2024-06-01T05:55:05.283580+0000",
    "src_ip": "10.84.1.49",
    "dest_ip": "17.248.236.64",
    "src_port": 55349,
    "dest_port": 443
  }
}

For later logging and detection.
Part of the extended logging.

Logs `client_alpns` and `server_alpns` arrays in the tls object.

Ticket: OISF#7055.
@victorjulien victorjulien requested review from jufajardini and a team as code owners June 18, 2024 20:57
@victorjulien victorjulien mentioned this pull request Jun 18, 2024
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

Attention: Patch coverage is 92.04545% with 7 lines in your changes missing coverage. Please review.

Project coverage is 82.46%. Comparing base (49ecf37) to head (fde64ce).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11325      +/-   ##
==========================================
- Coverage   82.47%   82.46%   -0.01%     
==========================================
  Files         934      935       +1     
  Lines      252270   252311      +41     
==========================================
+ Hits       208055   208080      +25     
- Misses      44215    44231      +16     
Flag Coverage Δ
fuzzcorpus 60.26% <61.36%> (-0.01%) ⬇️
livemode 18.77% <15.90%> (+0.01%) ⬆️
pcap 43.73% <60.22%> (-0.04%) ⬇️
suricata-verify 61.29% <90.90%> (-0.02%) ⬇️
unittests 59.91% <48.86%> (-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 21130

Comment on lines +330 to +331
alert tls any any -> any any (msg:"TLS ALPN test"; \
tls.alpn; content:"http/1.1"; sid:1;)
Copy link
Member

Choose a reason for hiding this comment

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

So this would match on client or server? But could be limited with flow:<direction>?

Copy link
Contributor

Choose a reason for hiding this comment

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

From detect-tls-alpn.c it looks like that indeed

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, this is like other tls keywords

@victorjulien victorjulien added this to the 8.0 milestone Jun 19, 2024
@victorjulien
Copy link
Member Author

Merged in #11331, thanks!

@victorjulien victorjulien deleted the alpn-log/v4 branch June 23, 2024 05:02
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