External risk intelligence

PyJWT PEM Parsing Vulnerability Allows Token Forgery

CVE advisorySeverity: CRITICAL (CVSS 9.1)

CVE-2026-102268

PyJWT is a widely used library for handling JSON Web Tokens, which are standard in modern web applications, APIs, and authentication services. Because this library is commonly integrated into internet-facing web endpoints to manage authentication and authorization, the vulnerable functionality is frequently exposed to public network traffic.

Halo Surface Signal: 4 out of 5 — likely to be public-facing.

External exposure likelihood

Horizon Alert

Summary of the vulnerability and why it matters

A vulnerability in the PyJWT library could allow an attacker to forge authenticated tokens by treating a public key as a secret key, impacting applications that mix HMAC and asymmetric algorithms. This is particularly concerning as the library is widely used in internet-facing authentication services.

  • Forged tokens can bypass authentication.
  • Widely used library means broad potential impact.
  • Confirm relevance for secure token handling.

Attack Path

How an attacker could exploit the issue

An attacker can forge authenticated HMAC tokens by knowing a public key and then supplying a mutated public-key PEM as raw key bytes. This occurs when an application mixes HMAC and asymmetric algorithms, causing the `is_pem_format` function to misinterpret the asymmetric public key as an HMAC secret. The vulnerability can lead to a critical risk of data integrity compromise and unauthorized access due to token forgery.

  • No authentication required to initiate attack.
  • Misinterpretation of public key format.
  • Forged tokens leading to unauthorized access.

Live Threat

Current exploitation, exposure, and threat context

When an application incorrectly handles public key material, an attacker could forge authenticated tokens. This may occur when using a mix of HMAC and asymmetric algorithms if a mutated public-key PEM is supplied as raw key bytes.

  • Authenticated tokens could be forged.
  • Malicious tokens may be accepted.
  • Unauthorized access is a risk.

Operational Fix

Recommended remediation, mitigation, and detection steps

Application owners and platform teams managing services that use PyJWT for JSON Web Token (JWT) processing are likely responsible for addressing this vulnerability. The first practical step is to inventory all instances of PyJWT, determine which are exposed to the network and handle both HMAC and asymmetric algorithms, and then assess their business criticality to prioritize remediation efforts.

  • Identify application owners and affected instances.
  • Verify JWT usage with mixed algorithm types.
  • Plan remediation during maintenance windows.

Supplementary metadata

Validate whether this threat affects your internet-facing exposure.

Halo Threat Intelligence helps prioritize remediation with Halo Surface Signal and H/A/L/O context. Start exposure validation with a free external attack surface trial.

Frequently asked questions

What is PyJWT and why is it used?

PyJWT is a Python library that allows developers to create, encode, and decode JSON Web Tokens (JWTs). It is a fundamental component in many modern web applications and APIs, acting as the engine that manages secure authentication and information exchange between users and servers.

How does the CVE-2026-102268 vulnerability work?

This issue falls under CWE-347, which relates to the improper verification of cryptographic signatures. In affected versions, the library's utility for identifying specific file formats fails to recognize certain public keys. Consequently, the system mistakenly treats an asymmetric public key as a secret HMAC key, enabling an attacker to create valid, forged tokens that the application will trust.

Do I need to mix algorithm types to be affected?

Yes. The vulnerability specifically triggers when an application uses both HMAC and asymmetric algorithms. If your code only uses one type of algorithm for all token operations, this specific parsing error does not occur. The flaw is rooted in how the software transitions between these different key handling logic paths.

Is my application at risk?

According to Halo Surface Signal, this library is commonly integrated into internet-facing web endpoints to manage authentication. Because PyJWT is frequently used for public-facing services, applications that handle mixed cryptographic keys and are accessible over the internet are at a higher risk of being targeted by this authentication bypass.

How should I respond to this PyJWT vulnerability?

Begin by auditing your applications to identify where PyJWT is deployed and whether those services utilize both HMAC and asymmetric algorithms. Once you have an inventory of these specific implementations, prioritize updating the PyJWT library to version 2.14.0 or later to resolve the parsing issue.

References