CVE-2026-102273: PyJWT accepts public JWK containers as HMAC secrets

Published Sep 28, 2026
·
Updated

Summary

PyJWT 2.13.0 contains an incomplete defense against algorithm confusion when an application mixes symmetric and asymmetric algorithms in one verification path. A public RSA, EC, or OKP JWK can be accepted as an HMAC secret when it is wrapped in a JWKS object, nested in an array, or represented in another container form that does not expose a top-level kty member.

Impact

An attacker who knows the public key material can forge HS256/HS384/HS512 tokens if the application simultaneously:

allows both HS and asymmetric algorithms; passes raw public JWK/JWKS JSON as key=; and uses that same value as the HMAC secret.

This can allow forged JWT claims in affected application configurations. The issue does not affect applications that keep symmetric and asymmetric verification paths separate and follow PyJWT's algorithm-selection guidance.

Fix status

The fix is on master in commit 801cd12 (fix: reject public JWK container HMAC keys). HMACAlgorithm.preparekey now rejects public JWK members found in objects, arrays, nested containers, BOM/UTF variants, and recursion-limit inputs. It also recognizes escaped JSON member names without treating ordinary string values as JWKs. Ordinary JSON secrets remain accepted byte-for-byte.

The change was tested with focused regression tests and the full local tox matrix. Available Python 3.9, 3.12, and 3.13 crypto/no-crypto suites, mypy, package metadata, and coverage passed; unavailable interpreters were skipped by the project configuration. A fresh independent Astra/max security review accepted the final diff with no blocking findings.

The affected range is = 2.13.0. The fix is on the unreleased development branch; the patched version will be recorded when a released 2.x version containing the fix is available. This advisory is being moved to draft pending that release.

Reporter credit

Credit: Charles Vosburgh / Trilobyte.

Original report

The original report and reproduction package are retained in the private advisory record.

Maintainer update — 2026-09-11

The verified fix for this advisory is included in PyJWT 2.14.0, released on 2026-09-11 and available on PyPI. PyJWT 2.14.0 is the first release containing the fix. This advisory is now published with 2.14.0 recorded as the patched version.

Other sources

PyJWT accepts public JWK containers as HMAC secrets

— Microsoft

PyJWT is a Python implementation of JSON Web Token standards. From 2.13.0 until 2.14.0, PyJWT HMACAlgorithm.preparekey is affected because HMAC key guard only recognizes top-level public JWK forms and misses container representations. This occurs when an application allows HMAC and asymmetric algorithms and passes a public JWK container as the raw key. As a result, public asymmetric key material is accepted as the HMAC secret. Consequently, an attacker who knows the public key can forge a token with arbitrary authenticated claims. This issue is fixed in version 2.14.0.

— MITRE

Affected Software

5 affected componentsFixes available
pypi/pyjwt>=2.13.0<2.14.0
pip/PyJWT=2.13.0
2.14.0
Microsoft azl3 python-jwt 2.13.0-1<2.15.1-1
2.15.1-1
Pyjwt Project Pyjwt=2.13.0
debian/pyjwt<=2.10.1-2+deb13u1
2.6.0-1+deb12u12.15.1-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/PyJWT to a version that resolves this vulnerability.

    Fixed in 2.14.0
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.15.1-1
  3. Upgrade

    Upgrade debian/pyjwt to a version that resolves this vulnerability.

    Fixed in 2.6.0-1+deb12u1Fixed in 2.15.1-1
  4. Upgrade

    Upgrade PyJWT to a version that resolves this vulnerability.

    Fixed in 2.14.0
  5. Compensating control

    Keep symmetric and asymmetric algorithms in separate verification paths and follow PyJWT's algorithm-selection guidance.

Event History

Sep 28, 2026
CVE Published
via MITRE·08:38 PM
Data Sourced
via MITRE·08:38 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Sep 29, 2026
Advisory Published
via GitHub·11:16 PM
Data Sourced
via GitHub·11:16 PM
DescriptionSeverityWeaknessAffected Software
Oct 1, 2026
Data Sourced
via Microsoft·08:16 AM
DescriptionSeverityWeaknessAffected Software
Oct 14, 2026
Data Sourced
via Ubuntu·07:52 AM
RemedyDescriptionSeverityAffected Software
Data Sourced
via Debian·07:53 AM
DescriptionAffected Software
Data Sourced
via Launchpad·07:53 AM
Description

Frequently Asked Questions

1

Which deployments are exposed to token forgery?

Deployments are exposed when they use affected PyJWT versions, allow both HMAC and asymmetric algorithms, and pass a public JWK container as the raw key. In that configuration, anyone who knows the public key can forge tokens with arbitrary authenticated claims.

2

Does exploiting this require an existing account or user interaction?

No. The supplied vector indicates network access with no privileges and no user interaction required, although exploitation has high attack complexity because the vulnerable key and algorithm-handling configuration must be present.

3

What version resolves the issue?

Upgrade PyJWT to version 2.14.0. The affected range is from 2.13.0 until 2.14.0.

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