CVE-2026-102273

PyJWT accepts public JWK containers as HMAC secrets

Published Sep 28, 2026 CVSS 3.1 · 7.4 High EPSS < 1% KEV · Not listed
Description
PyJWT is a Python implementation of JSON Web Token standards. From 2.13.0 until 2.14.0, PyJWT HMACAlgorithm.prepare_key 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.

Analysis

AI-generated

Technical impact

PyJWT’s HMACAlgorithm.prepare_key erroneously accepts a public JWK container as the secret key when the library is used with both HMAC and asymmetric algorithms. The HMAC key guard fails to recognize container representations, allowing public key material to be treated as symmetric secret data. An attacker who can obtain the public key can forge a JWT that carries arbitrary claims and present it to a system that trusts the token. This flaw corresponds to CWE‑347 because the implementation incorrectly validates the key format, enabling an attacker to hijack the token’s authentication logic.

Affected Systems

The vulnerability is present in PyJWT 2.13.x, including 2.13.0 through all 2.13.x releases, and is fixed starting with version 2.14.0. The affected vendor is jpadilla:pyjwt; any Python application that incorporates this library and allows both HMAC and asymmetric algorithms without proper key handling is susceptible.

Risk and Exploitability

The CVSS score of 7.4 indicates a high impact. EPSS is not available, and the vulnerability has not been listed in the CISA KEV catalog, suggesting no reported exploits yet. The attack vector is inferred to be application‑level; an attacker only needs to supply a JWT signed with the compromised public key or manipulate token creation logic. Once a forged token is accepted, the attacker gains the privileges encoded in the token, potentially allowing full system compromise if the token is used for authentication.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade PyJWT to version 2.14.0 or later
  • Restrict token creation to HMAC algorithms when using symmetric keys and disallow public JWK containers as secrets; verify key data before passing to the library
  • Disable support for asymmetric algorithms if not required, or enforce explicit algorithm selection to prevent accidental use of HMAC with a public key container

Generated by OpenCVE AI on September 28, 2026 at 22:55 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-w2cx-738m-mc7w PyJWT accepts public JWK containers as HMAC secrets
History
Type Values Removed Values Added
First Time appeared Pyjwt Project
Pyjwt Project pyjwt
CPEs cpe:2.3:a:pyjwt_project:pyjwt:2.13.0:*:*:*:*:*:*:*
Vendors & Products Pyjwt Project
Pyjwt Project pyjwt
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Jpadilla
Jpadilla pyjwt
Vendors & Products Jpadilla
Jpadilla pyjwt
Type Values Removed Values Added
Description PyJWT is a Python implementation of JSON Web Token standards. From 2.13.0 until 2.14.0, PyJWT HMACAlgorithm.prepare_key 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.
Title PyJWT accepts public JWK containers as HMAC secrets
Weaknesses CWE-347
References
Metrics cvssV3_1

{'score': 7.4, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N'}

Weaknesses
  • CWE-347

    Improper Verification of Cryptographic Signature

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Sep 29, 2026, 1:44 PM
Reserved
Sep 28, 2026, 8:11 PM
Status
Analyzed
Published
Sep 28, 2026, 9:17 PM
Modified
Oct 6, 2026, 6:29 PM
Severity
Important
Public date
Sep 28, 2026, 8:38 PM