dtls: filter pre-ClientHello queue poison#140
Conversation
|
This is adding yet another filter which looks very similar to classify_records but in a new place. I'm also not sure what we are trying to solve here. |
|
The bug I was aiming at is pre-ClientHello queue poisoning: records that can’t start the handshake can fill queue_rx before a valid ClientHello arrives If this seems worth solving to you, I can rework this to reuse/extend the existing classification path instead of adding another similar filter. |
|
Thinking about this more — the framing isn't really pre-ClientHello specific. The same attack works through the whole plaintext handshake window. As soon as the legit client moves on from CH the server sits in This is exactly the same shape as OpenSSL's CVE-2016-2179 (DTLS buffered message DoS, commits 26f2c5774f / 00a4c14214 from 2016). Their fix had two arms:
That bounds the orphan memory per connection to ~1.5MB. I'd suggest we mirror that, in
|
Before a server has accepted a
ClientHello, records that cannot be useful atthat stage could still occupy receive-queue slots. A run of future-epoch or
otherwise non-ClientHello records could fill the queue before a valid
ClientHelloarrives.This filters records in the pre-ClientHello server path before they are queued:
DTLS 1.2 keeps only epoch-0 alerts and current-or-previous ClientHello
handshakes, and DTLS 1.3 keeps only plaintext alerts and current-or-previous
ClientHello handshakes. Filtered records still count against the raw
per-datagram parsed-record cap.
The auto-server fallback path retains only sanitized ClientHello-shaped packets
needed for later fallback, with the retained-packet cap checked before parsing
can mutate the DTLS 1.3 engine.
This keeps the change to the pre-ClientHello queue filter. It does not change
public error taxonomy, queue-full semantics, or broader malformed-tail/replay
policy.
Line delta:
Validation:
git diff --checkcargo fmt --checkcargo test --all-targets --features rcgencargo clippy --all-targets --features rcgen -- -D warnings/home/ronen/.codex/skills/dimpl/scripts/check-snowflake-local.pl upstream/maincargo test --no-default-features --features rust-cryptocargo clippy --no-default-features --features rust-crypto -- -D warningscargo test --doc --features rcgen