Skip to content

Handle invalid peer keys in ECDH key agreement - #848

Merged
kaczmarczyck merged 1 commit into
developfrom
fix-ecdh-invalid-point
Nov 27, 2026
Merged

kaczmarczyck merged 1 commit into
developfrom
fix-ecdh-invalid-point

Conversation

@kaczmarczyck

Copy link
Copy Markdown
Collaborator

Wasefire's Public::import stores peer coordinates without validating that the point lies on P-256 and defers validation to Shared::new. Because SecretKey::diffie_hellman unwrapped Shared::new, an off-curve ClientPIN or hmac-secret key agreement key panicked the authenticator instead of returning CTAP1_ERR_INVALID_PARAMETER.

Make ecdh::SecretKey::diffie_hellman return OptionSelf::SharedSecret, propagate Shared::new errors as None in the Wasefire environment, and map None to CTAP1_ERR_INVALID_PARAMETER in PinProtocol::decapsulate.

Fix for issue reported by chyanju as an advisory:

https://github.com/google/OpenSK/security/advisories/GHSA-fwjg-q5cg-9pfw

Wasefire's Public::import stores peer coordinates without validating
that the point lies on P-256 and defers validation to Shared::new.
Because SecretKey::diffie_hellman unwrapped Shared::new, an off-curve
ClientPIN or hmac-secret key agreement key panicked the authenticator
instead of returning CTAP1_ERR_INVALID_PARAMETER.

Make ecdh::SecretKey::diffie_hellman return Option<Self::SharedSecret>,
propagate Shared::new errors as None in the Wasefire environment, and
map None to CTAP1_ERR_INVALID_PARAMETER in PinProtocol::decapsulate.
@kaczmarczyck
kaczmarczyck requested a review from ia0 November 27, 2026 01:49
@kaczmarczyck kaczmarczyck self-assigned this Nov 27, 2026
@kaczmarczyck
kaczmarczyck merged commit 94b464f into develop Nov 27, 2026
18 checks passed
@kaczmarczyck
kaczmarczyck deleted the fix-ecdh-invalid-point branch November 27, 2026 07:22
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