Lucene search

K
osvGoogleOSV:GHSA-R9JW-MWHQ-WP62
HistoryMay 13, 2022 - 1:42 a.m.

PyJWT vulnerable to key confusion attacks

2022-05-1301:42:19
Google
osv.dev
13
pyjwt
key confusion
vulnerability
pem
public keys
pkcs1
hmacalgorithm
jwts

EPSS

0.001

Percentile

35.1%

In PyJWT 1.5.0 and below the invalid_strings check in HMACAlgorithm.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.