---
schema_version: '1.0'
id: security-20260930-f26140
title: 'CVE-2026-102273: PyJWT accepts public JWK containers as HMAC secrets'
url: https://osv.dev/vulnerability/GHSA-w2cx-738m-mc7w
url_hash: f261402ebb1938bd750735990fa78cc322b225af62b868ad8291aa75e3c6b79a
canonical_url: https://osv.dev/vulnerability/GHSA-w2cx-738m-mc7w
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-102273
- GHSA-w2cx-738m-mc7w
- severity:CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
- pyjwt
- PyPI
lang: en
published_at: '2026-09-29T23:16:55Z'
fetched_at: '2026-09-30T03:55:36.296748Z'
updated_at: '2026-09-30T04:20:39Z'
status: published
content_hash: 3c7e6acf44ace8f5039965bcf5309f6c4da6e527d25bfc8914aa562a43383754
content_changed_at: null
license_note: full
summary: PyJWT accepts public JWK containers as HMAC secrets
summary_source: rss
summary_en: PyJWT accepts public JWK containers as HMAC secrets
summary_omitted_reason: null
redistribution: true
keywords_en:
- accepts
- containers
- cve
- CVE-2026-102273
- CVE-2026-59980
- GHSA-w2cx-738m-mc7w
- HMAC
- JWK
- library vulnerability
- public
- Public Basic Information DB
- PyJWT
- PyPI
- secrets
- severity:CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
- software security
entities_en:
- name: CVE-2026-59980
  type: concept
- name: Public Basic Information DB
  type: location
- name: PyJWT
  type: artifact
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE-2026-59980
  type: concept
- name: PyJWT
  type: artifact
- name: Public Basic Information DB
  type: location
key_facts: []
related: []
related_auto: []
computed_at: '2026-09-30T04:20:38Z'
---

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

## TL;DR
PyJWT accepts public JWK containers as HMAC secrets

## Key Points
- cve / CVE-2026-102273 / GHSA-w2cx-738m-mc7w / severity:CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N / pyjwt / PyPI

## Details
**Severity:** CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
**Advisory:** GHSA-w2cx-738m-mc7w (CVE-2026-102273)

**Details:**
### 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.prepare_key` 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.

**References:**
- https://github.com/jpadilla/pyjwt/security/advisories/GHSA-w2cx-738m-mc7w
- https://nvd.nist.gov/vuln/detail/CVE-2026-102273
- https://github.com/jpadilla/pyjwt/commit/801cd128528c62d9b23fcd161d1a2e1c17982f95
- https://github.com/jpadilla/pyjwt
- https://github.com/jpadilla/pyjwt/releases/tag/2.14.0

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-w2cx-738m-mc7w_

## Source
元記事: [CVE-2026-102273: PyJWT accepts public JWK containers as HMAC secrets](https://osv.dev/vulnerability/GHSA-w2cx-738m-mc7w) — published 2026-09-29T23:16:55Z
