aws / s2n-quic

An implementation of the IETF QUIC protocol
https://crates.io/crates/s2n-quic
Apache License 2.0
1.16k stars 119 forks source link

Mitigate Stream Fragmentation and Reassembly Attacks #1965

Open WesleyRosenblum opened 1 year ago

WesleyRosenblum commented 1 year ago

The stream receive buffer is optimized to reduce CPU costs from frequent allocations: https://github.com/aws/s2n-quic/pull/1497. Additional mitigations may be warranted to protect against excessive memory consumption due to stream fragmentation attacks.

From 21.7. Stream Fragmentation and Reassembly Attacks in rfc9000:

QUIC deployments SHOULD provide mitigations for stream fragmentation attacks.

Mitigations could consist of:

toidiu commented 1 year ago

The application could use the following metric to determine fragmentation. However we should investigate what exactly this metric means and document it.

The mitigation to the attack would be similar to the Slowloris mitigation; using the supervisor to close the connection (https://docs.rs/s2n-quic/latest/s2n_quic/provider/event/supervisor/index.html)