Skip to content

Limit the effect of state cookie tampering - #147

Merged
boivie merged 1 commit into
webrtc:mainfrom
boivie:feature-robust-state-cookie
Jul 10, 2026
Merged

boivie merged 1 commit into
webrtc:mainfrom
boivie:feature-robust-state-cookie

Conversation

@boivie

@boivie boivie commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

This commit enhances the security and robustness of the state cookie by limiting what an attacker can achieve even if they manage to forge or tamper with the cookie. Note that we don't add any signature or digest right now, as that would be done by adding library dependencies that the downstream projects don't use right now (sha2 and hmac). This might be rivisited in the future.

By storing the raw peer capabilities in the state cookie, we prevent an attacker from enabling extensions that the local socket didn't signal support for, limit the stream limits (incoming and outgoing) from what was originally announced, and also elimintate some duplication in capability parsing in the different methods to do connection handshakes.

This defense-in-depth measure ensures that the state instantiated from a COOKIE ECHO strictly matches the parameters of the original INIT, and if an attacker tampers with it, the effects are very limited.

@boivie
boivie requested a review from DanilChapovalov July 10, 2026 08:20
Comment thread src/socket/capabilities.rs Outdated
Comment thread src/socket/capabilities.rs Outdated
Comment thread src/socket/capabilities.rs Outdated
Comment thread src/socket/connect.rs
This commit enhances the security and robustness of the state cookie by
limiting what an attacker can achieve even if they manage to forge or 
tamper with the cookie. Note that we don't add any signature or digest 
right now, as that would be done by adding library dependencies that the
downstream projects don't use right now (sha2 and hmac). This might be
rivisited in the future.

By storing the raw peer capabilities in the state cookie, we prevent an 
attacker from enabling extensions that the local socket didn't signal
support for, limit the stream limits (incoming and outgoing) from what
was originally announced, and also elimintate some duplication in 
capability parsing in the different methods to do connection handshakes.

This defense-in-depth measure ensures that the state instantiated from
a COOKIE ECHO strictly matches the parameters of the original INIT, and
if an attacker tampers with it, the effects are very limited.
@boivie
boivie merged commit 805cf73 into webrtc:main Jul 10, 2026
16 checks passed
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

Successfully merging this pull request may close these issues.

2 participants