CVE-2026-102273: PyJWT Vulnerability in HMAC Secret Handling

pyjwt Updated 30 Sep 2026

Summary

29/09/2026
Yes i
High
7.4

CVE-2026-102273: PyJWT accepts public JWK containers as HMAC secrets. Affects pyjwt versions >= 2.13.0, < 2.14.0. Fixed in 2.14.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

PyJWT is a Python library that allows developers to encode and decode JSON Web Tokens (JWTs). It supports various algorithms for signing and verifying tokens, including HMAC and asymmetric algorithms like RSA and EC. The library is widely used for authentication and authorization in web applications. However, a vulnerability was discovered in version 2.13.0 that affects how HMAC secrets are handled when mixed with public JWK containers, potentially leading to security risks.

Vulnerability Detail

The vulnerability arises from an incomplete defense against algorithm confusion in PyJWT 2.13.0. When an application allows both symmetric (HMAC) and asymmetric algorithms in the same verification path, a public JWK (JSON Web Key) can be mistakenly accepted as an HMAC secret. This occurs when the JWK is wrapped in a JWKS object or represented in a nested container without exposing a top-level 'kty' member. An attacker with knowledge of the public key material can forge HS256, HS384, or HS512 tokens, leading to unauthorized access or manipulation of JWT claims. This issue does not affect applications that maintain separate verification paths for symmetric and asymmetric algorithms.

How To Fix

Latest published version: 2.15.1 as of 23 Oct 2026

pip install --upgrade "pyjwt==2.15.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.14.0

This is the first release that contains the fix.

pip install --upgrade "pyjwt==2.14.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, ensure that your application does not mix symmetric and asymmetric algorithms in the same verification path. Additionally, avoid passing raw public JWK or JWKS JSON as the key parameter for HMAC verification.

Conclusion

The vulnerability CVE-2026-102273 in PyJWT poses significant security risks by allowing public JWKs to be accepted as HMAC secrets. It is crucial for developers to update to version 2.14.0 or later to mitigate this risk and ensure the integrity of JWT handling in their applications.

See every vulnerability recorded for pyjwt →

Share this vulnerability

FAQ

An attacker can forge JWT tokens if the application improperly handles public JWKs as HMAC secrets, potentially leading to unauthorized access.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The affected version is 2.13.0. The vulnerability is fixed in version 2.14.0 and later.

As a temporary measure, ensure that your application does not mix HMAC and asymmetric algorithms and avoid using public JWKs as HMAC secrets.

The CVSS score for this vulnerability is 7.4, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for pyjwt.

How To Fix

Latest published version: 2.15.1 as of 23 Oct 2026

pip install --upgrade "pyjwt==2.15.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.14.0

This is the first release that contains the fix.

pip install --upgrade "pyjwt==2.14.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback