Skip to content
OpenAdvisories
High · 7.5 CVE-2017-11424 EUVD-2017-0103GHSA-r9jw-mwhq-wp62PYSEC-2017-24

PyJWT vulnerable to key confusion attacks

Published Aug 24, 2017 · Updated Aug 5, 2024 · Assigned by duo

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.

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 pyjwt 1.4.2-1.1 —
Debian 13 pyjwt 1.4.2-1.1 —
Debian 12 pyjwt 1.4.2-1.1 —
Debian 9 pyjwt 1.4.2-1+deb9u1 DSA-3979-1
Debian 8 pyjwt 0.2.1-1+deb8u2 DSA-3979-1
ReleasePackageFixed inAdvisory
Ubuntu 16.04 LTS pyjwt 1.3.0-1ubuntu0.1 USN-3407-1

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI pyjwt < 1.5.1 1.5.1 GHSA-r9jw-mwhq-wp62

Advisories 2

References