jose denial of service in shared_secret() with mismatched key types
potatosalad jose
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| potatosalad jose |
| No fix yet |
| potatosalad jose |
| No fix yet |
Original description
jose_jwk:shared_secret/2 (exposed in Elixir as JOSE.JWK.shared_secret/2) derives an ECDH shared secret from two JWKs. Its first function clause only matches when both JWKs carry the same key type (kty) module, and its fallback clause re-invokes itself as shared_secret(from(YourJWK), from(MyJWK)). Because from/1 returns an already-parsed jose_jwk record unchanged, passing two JWKs whose key types differ (for example an EC key and an RSA key) makes the fallback clause re-enter with identical arguments, producing an unbounded tail-recursive loop that never returns and never crashes.