Skip to content

Create TLS Analyzer #2

@spitfire55

Description

@spitfire55

In order to implement more sophisticated analyzers like JA3, self-signed cert detection, etc., we first need a basic TLS analyzer.

gopacket has a TLS Layer already defined, but it does not currently decode a lot of the data we care about, such as Handshake messages or ChangeCipherSpec messages. Ultimately, you should ignore it, as the maintainers are not planning to use the layers package for TCP-specific protocols anyways, and it shouldn't have been merged in the first place.

In order to implement:

  1. Look at the DecodeFromBytes source code at https://github.com/google/gopacket/blob/master/layers/tls.go#L130 to get an idea for an idiomatic way in Go to take raw bytes and decode them into structs.
  2. Take the full application payload of a reassembled TCP stream, which will be the payload field into a Connection object, and, if the TCP payload is TLS, decode it into structs that store more information about handshakes, cipher specs, etc.
  3. Make sure we only store unencrypted data in these structs. Encrypted data is not useful.
  4. See the DNS analyzer and how the Analyze function just uses layers.DNS from gopacket because gopacket already has a robust DNS decoder. You will need to write your own TLS decoder since gopacket's layers.TLS doesn't decode enough for us.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions