jose acceptance of non-canonical ECDSA signatures in JWS verification
potatosalad jose
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| potatosalad jose |
| No fix yet |
| potatosalad jose |
| No fix yet |
Original description
The jose library accepts ECDSA (ES256, ES256K, ES384, and ES512) JWS signatures of a non-canonical length. When verifying an ECDSA signature, jose_jwk_kty_ec:verify/4 in src/jwk/jose_jwk_kty_ec.erl splits the raw signature in half by its actual byte length (split_binary(Signature, byte_size(Signature) div 2)) instead of enforcing the fixed length required by RFC 7518 §3.4, and then decodes each half with crypto:bytes_to_integer/1, which ignores leading zero bytes.