CVE-2026-102271: PyJWT: Public keys in DER form are accepted as HMAC secrets, bypassing the CVE-2022-29217 guard

Published Sep 28, 2026
·
Updated

PyJWT is a Python implementation of JSON Web Token standards. From 2.4.0 until 2.14.0, PyJWT HMACAlgorithm.preparekey is affected because asymmetric-key guard relies on textual markers that are absent from DER encoding. This occurs when an application mixes HMAC and asymmetric algorithms and supplies a DER public key as the shared verification key. As a result, PyJWT uses public DER bytes 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.4.0<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:31 PM
Data Sourced
via MITRE·08:31 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed to token forgery?

Deployments using PyJWT from 2.4.0 through versions before 2.14.0 are exposed only when they mix HMAC and asymmetric algorithms and provide an asymmetric public key in DER encoding as the shared verification key. An attacker must know that public key, which is commonly obtainable, to forge HMAC-authenticated tokens.

2

Are applications that use only one algorithm family affected?

The described condition requires mixing HMAC and asymmetric algorithms. The provided information does not indicate exposure for applications that do not permit both algorithm types in the relevant verification flow.

3

What is the remediation?

Upgrade PyJWT to version 2.14.0, which fixes the issue. Until upgrading, avoid configurations that mix HMAC and asymmetric algorithms while using a DER-encoded public key as the verification key.

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