CVE-2026-102270: PyJWT ReDoS Vulnerability in is_pem_format Function

pyjwt Updated 30 Sep 2026

Summary

30/09/2026
Yes i
Moderate
4.4

CVE-2026-102270: PyJWT: ReDoS vulnerability when calling the is_pem_format function. Affects pyjwt versions < 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

PyJWT is a Python library that allows for the encoding and decoding of JSON Web Tokens (JWT). It is widely used for secure token-based authentication in web applications. The library provides various features, including support for different signing algorithms and the ability to handle token expiration. However, a vulnerability has been identified in the is_pem_format function, which can lead to excessive CPU usage under certain conditions, making it susceptible to denial-of-service attacks.

Vulnerability Detail

The vulnerability arises from a ReDoS (Regular Expression Denial of Service) issue in the is_pem_format function. This function uses a regex pattern that employs a lazy quantifier, which can lead to quadratic time complexity when processing specially crafted input. An attacker can exploit this by providing a custom certificate that consists solely of '-----BEGIN CERTIFICATE-----' lines without a corresponding '-----END CERTIFICATE-----' line. This results in the regex engine performing multiple rescans of the input, causing significant CPU resource consumption and potentially leading to service unavailability.

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, avoid passing untrusted or attacker-controlled key or certificate bytes to the PyJWT's key preparation functions until you can update to the patched version. Additionally, you can implement input validation to ensure that only properly formatted certificates are processed.

Conclusion

The CVE-2026-102270 vulnerability in the PyJWT library poses a significant risk due to its potential for causing denial-of-service attacks through excessive CPU usage. It is crucial for users of the library to update to version 2.14.0 or later to mitigate this risk. Additionally, employing input validation can help protect against exploitation until the update is applied.

See every vulnerability recorded for pyjwt →

Share this vulnerability

FAQ

ReDoS stands for Regular Expression Denial of Service. It occurs when an attacker exploits a poorly designed regex pattern, causing excessive resource consumption and potentially leading to service downtime.

You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to test your application without needing to sign up.

The primary impact is resource exhaustion, which can make the affected service unavailable to legitimate users, leading to denial-of-service conditions.

Yes, a patch is available in PyJWT version 2.14.0 and later. It is recommended to upgrade to this version to mitigate the vulnerability.

If you cannot update immediately, ensure that you do not pass untrusted input to the affected functions and implement input validation as a temporary measure.

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