Bug #1936
closedCan't set fast_pattern on tls_sni content
Description
The tls_sni sticky buffer was introduced in Suricata 3.1. Looking at the code, content matches in this buffer can be used for fast_pattern. However, when 'fast_pattern' is explicitly set on content in the tls_sni, buffer, an error is generated:
<Error> - [ERRCODE: SC_ERR_INVALID_SIGNATURE(39)] - fast_pattern found inside the rule, without a content context. Please use a content based keyword before using fast_pattern
Here is an example rule that generates the error:
alert tls any any -> any any (msg:"ton.twimg.com SNI"; flow:established; tls_sni; content:"ton.twimg.com"; fast_pattern; sid:213321;)
If you remove the explicit 'fast_pattern;' piece and run fast pattern analysis on the rule you can see that the engine does in fact use it as the fast pattern match:
== Sid: 213321 == alert tls any any -> any any (msg:"ton.twimg.com SNI"; flow:established; tls_sni; content:"ton.twimg.com"; sid:213321;) Fast Pattern analysis: Fast pattern matcher: Flags: None Fast pattern set: no Fast pattern only set: no Fast pattern chop set: no Original content: ton.twimg.com Final content: ton.twimg.com ============ Summary: ============ tls sni extension, smallest pattern 13 byte(s), longest pattern 13 byte(s), number of patterns 1, avg pattern len 13.00 byte(s)
If you need a pcap, see http://home.regit.org/~regit/flocon-tls.pcap
I tested this on Suricata 3.1.1 and 3.2beta1 with the same results.
Updated by Andreas Herz about 8 years ago
- Assignee set to OISF Dev
- Target version set to TBD
This looks like a parsing bug, since putting tls_sni behind content or fast_pattern doesn't complain and also works, I see the alerts with:
alert tls any any -> any any (msg:"ton.twimg.com SNI"; flow:established; content:"ton.twimg.com"; tls_sni; fast_pattern; sid:213321;)
and
alert tls any any -> any any (msg:"ton.twimg.com SNI"; flow:established; content:"ton.twimg.com"; fast_pattern; tls_sni; sid:213321;)
Thanks for reporting this!
Updated by Jason Ish about 8 years ago
- Status changed from New to Assigned
- Assignee changed from OISF Dev to Jason Ish
Updated by Victor Julien about 8 years ago
- Status changed from Assigned to Closed
- Target version changed from TBD to 3.2rc1