PyJWT vulnerable to key confusion attacks
High severity
GitHub Reviewed
Published
May 13, 2022
to the GitHub Advisory Database
•
Updated Oct 15, 2024
Description
Published by the National Vulnerability Database
Aug 24, 2017
Published to the GitHub Advisory Database
May 13, 2022
Reviewed
Sep 12, 2022
Last updated
Oct 15, 2024
In PyJWT 1.5.0 and below the
invalid_strings
check inHMACAlgorithm.prepare_key
does not account for all PEM encoded public keys. Specifically, the PKCS1 PEM encoded format would be allowed because it is prefaced with the string-----BEGIN RSA PUBLIC KEY-----
which is not accounted for. This enables symmetric/asymmetric key confusion attacks against users using the PKCS1 PEM encoded public keys, which would allow an attacker to craft JWTs from scratch.References