Skip to content

PyJWT vulnerable to key confusion attacks

High severity GitHub Reviewed Published May 13, 2022 to the GitHub Advisory Database • Updated Jan 30, 2023

Package

pip pyjwt (pip)

Affected versions

< 1.5.1

Patched versions

1.5.1

Description

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.

References

Published by the National Vulnerability Database Aug 24, 2017
Published to the GitHub Advisory Database May 13, 2022
Reviewed Sep 12, 2022
Last updated Jan 30, 2023

Severity

High
7.5
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Weaknesses

No CWEs

CVE ID

CVE-2017-11424

GHSA ID

GHSA-r9jw-mwhq-wp62

Source code

Credits

Checking history
See something to contribute? Suggest improvements for this vulnerability.