CVE-2026-102268: PyJWT: Asymmetric-PEM detection bypass: whitespace/line-ending-mutated public keys skip the HS/asymmetric confusion guard

Published Sep 28, 2026
·
Updated

PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, ispemformat in jwt/utils.py is affected because ispemformat does not recognize every PEM representation accepted by the cryptography loader. This occurs when an application mixes HMAC and asymmetric algorithms and supplies a mutated public-key PEM as raw key bytes. As a result, HMACAlgorithm.preparekey treats the unrecognized asymmetric public key as an HMAC secret. Consequently, an attacker who knows the public key can forge authenticated HMAC tokens. This issue is fixed in version 2.14.0.

Affected Software

1 affected component
pypi/pyjwt<2.14.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade PyJWT to a version that resolves this vulnerability.

    Fixed in 2.14.0

Event History

Sep 28, 2026
CVE Published
via MITRE·08:26 PM
Data Sourced
via MITRE·08:26 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed to token forgery?

Deployments using PyJWT before 2.14.0 are exposed when they mix HMAC and asymmetric algorithms and pass a whitespace- or line-ending-mutated asymmetric public-key PEM as raw key bytes. An attacker must know the public key, which is commonly not secret.

2

What is the underlying exploitation condition?

The mutated PEM must be accepted by the cryptography loader while not being recognized by PyJWT's is_pem_format check. PyJWT then treats the asymmetric public key as an HMAC secret, allowing the attacker to forge HMAC-authenticated tokens.

3

What should be done to remediate the issue?

Upgrade PyJWT to version 2.14.0. Until upgrading, avoid configurations that mix HMAC and asymmetric algorithms and avoid supplying mutated public-key PEM material as raw key bytes.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203