Feature #9526
openTLS: no in-flight signal for a flow classified TLS that never completes a ClientHello
Description
Summary
Once a TCP flow is classified as `tls`, Suricata keeps that classification even if the client never completes (or never sends) a ClientHello. There is no in-flight detection signal — no app-layer event and no rule-keyword — that a ruleset can use, while packets are still flowing, to act on a TLS-classified flow that has not produced a ClientHello.
This matters for strict-order rulesets that gate "allow vs. drop" onc`ssl_state:client_hello` (a common pattern: alert/allow once a ClientHello is seen, otherwise fall through to a default drop). A client that opens a TLS record but never completes a ClientHello can keep such a flow in the "not yet decided" state indefinitely, and no rule can conclude "this flow is TLS but will never present a ClientHello" in time to drop it on the wire.
Why existing primitives do not cover it
- `ssl_state:client_hello` can only be matched positively. There is no negative/absence form that is race-free. A rule such as `... flowbits:isnotset,ch_seen ...` on the to_client (or to_server) direction fires on the early zero-payload control packets (SYN-ACK, bare ACK) before the parser commits the ClientHello state on a legitimate fragmented or large (e.g. post-quantum hybrid) ClientHello, producing false positives on legitimate traffic.
- The TLS decoder events that do exist are error events (`INVALID_SSL_RECORD`, `INVALID_HANDSHAKE_MESSAGE`, etc.). A client that sends a well-formed but incomplete record (valid 5-byte header announcing a large body, then stops), or only the 5-byte record header, raises no event: the parser simply waits for more data via the `SSL_DECODER_INCOMPLETE` path.
- The only end-of-flow signal arrives on a flow-timeout / shutdown pseudo-packet, and only after the TCP session reaches `TCP_CLOSED` (`stream-tcp-reassemble.c`: an incomplete record is re-delivered to the parser only when the flush packet is `PKT_PSEUDO_STREAM_END` and `ssn->state >= TCP_CLOSED`). A flow that never closes never reaches the parser again, and a drop on a post-close pseudo-packet cannot block traffic that already crossed the wire.
Net: there is no primitive that is both (a) evaluated while the flow is live and (b) able to express "TLS-classified, ClientHello never completed" without racing the parser on legitimate fragmented/large ClientHellos.
Reproduction (default config)
Default `suricata.yaml` (default `stream.reassembly.depth`, TLS app-layer enabled, IDS or IPS). Two TCP flows to a TLS port:
1. Incomplete record, no close. Client completes the TCP handshake, sends a TLS record header declaring a large body (e.g. `16 03 01 40 00` = handshake, length 16384) followed by fewer bytes than declared, then sends nothing more and does not close. The flow is classified `tls` (`app_proto: tls` on the flow record), `ssl_state` never reaches `client_hello`, no decoder event is raised, and no app-layer event fires at any point while the flow is open.
2. Header-only. As above but the client sends only the 5-byte record header and then closes cleanly (reaches `TCP_CLOSED`). The flow is classified `tls`, the header is fully consumed so the parser takes the empty-input EOF path, and again no "no ClientHello" signal is available to a rule.
Expected (feature request): a way for a rule to match a TLS flow that the parser can conclude will not yield a ClientHello — ideally in-flight.
Requested feature
One (or more) of:
1. An app-layer event, e.g. `tls.client_hello_absent`, raised when the TLS parser determines in-flight that a flow classified as TLS has not produced a ClientHello and (by direction/stream state) will not — for example on the first to-client payload record seen before any ClientHello, or when a configurable to_server byte budget is exceeded with no ClientHello parsed.
2. A matchable negative/absence form of `ssl_state` (or a dedicated keyword) that is committed in step with the to_client detection so a "ClientHello-not-seen" rule does not race the parser on legitimate fragmented or large ClientHellos.
Either lets a ruleset drop a never-completing TLS handshake on the wire without false-positiving legitimate slow/fragmented/large (e.g. post-quantum) ClientHellos.
Environment
- Suricata 8.0.6 (default build), default configuration.
- Reproduced with crafted pcaps; no non-default tuning required to observe the absence of a usable signal.
AP Updated by Aneesh Patel about 18 hours ago
- Tracker changed from Security to Feature
- Severity deleted (
HIGH) - Disclosure Date deleted (
12/04/2026) - Affected Versions deleted (
8.0.6)