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 Alerts not skipped #6

Open
ecki opened this issue Oct 26, 2014 · 3 comments
Open

TLS Alerts not skipped #6

ecki opened this issue Oct 26, 2014 · 3 comments

Comments

@ecki
Copy link
Contributor

ecki commented Oct 26, 2014

I had some ServerHello messages missing. Upon closer inspection it was due to Alert records (SNI host_unknown warning) before the actual ServerHello record. Since they are all in the same segment/package I think it would be a usefull addition to be able to skip alerts. This would also mean to change the default packet filter a bit.

@ge0rg
Copy link
Owner

ge0rg commented Oct 29, 2014

The problem with the filter is, it is getting complex already. Could you provide a pcap of such an Alert record packet please? I'd like to look into it to determine what could be done.

However, I don't particularly like the idea of implementing a TLS record parser in BPF ;-) We might revert to passing all TLS packets to userland instead and do some more parsing/processing there.

@ecki
Copy link
Contributor Author

ecki commented Oct 30, 2014

You can test yourself, with the alias https://neskaya.eckenfels.com apache will generate an warning, with https://eckenfels.com you will get a sucessful handshake.

A sample trace is here http://bernd.eckenfels.net/view/alert.pcap .

The alert record is 15(alert) 0303(tls12) 0002(2bytes) 01(warn) 70(unrecognized name)

I am afraid the trace is somewhat before fragmentation (from the server), so the certificate record is corrupt, but the ServerHello is complete.

@ge0rg
Copy link
Owner

ge0rg commented Nov 4, 2014

Okay, so this looks like we need a rule of the kind payload[0] == HANDSHAKE or payload[5+payload[3]*256+payload[4]] == HANDSHAKE or payload[<calculate third record position>] == HANDSHAKE or ....

As we need one level of indirection already to access the payload (tcp[tcp[12]/16*4]), we arrive at two levels for the BPF filter for the second TLS record, or we need to relax the filter to "port 443" (I see no sensible way to limit it to TLS traffic). Then we have to do a significant amount of application layer processing, and to restructure the reader code to silently discard packets that passed the BPF filter but are not Hellos (or not TLS at all, for STARTTLS protocols).

I am not saying this is impossible, just that it is not pretty. I could probably live with a BPF+parser extension to allow for the Hello to be the second TLS record, which should account for your alert use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants