VAITP Dataset

← Back to the dataset

CVE-2026-102267

PyJWT JWK client follows untrusted redirects, allowing key substitution.

  • CVSS 9.1
  • CWE-200
  • Authentication, Authorization, and Session Management
  • Remote

PyJWT is a Python implementation of JSON Web Token standards. Prior to 2.14.0, PyJWT PyJWKClient is affected because redirect destinations are not revalidated against the JWKS trust boundary. This occurs when a configured trusted JWKS endpoint returns an attacker-influenced redirect. As a result, PyJWKClient follows the redirect and consumes the redirected response as key material. Consequently, forwarded credentials may be disclosed or verification keys may be substituted. This issue is fixed in version 2.14.0.

CVSS base score
9.1
Published
2026-09-28
OWASP
A04 Insecure Design
Orthogonal defect classification
Interface
Code defect classification
Missing Check
Category
Authentication, Authorization, and Session Management
Subcategory
Open Redirects
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
PyJWT 2.14.0
Fixed by upgrading
Yes

Solution

Upgrade PyJWT to version 2.14.0 or later.

Vulnerable code sample

import jwt
import requests
from jwt import PyJWKClient

def verify_jwt(token: str, jwks_url: str) -> dict:
    # VULNERABLE: follows untrusted redirects when fetching JWKS
    jwk_client = PyJWKClient(jwks_url)
    signing_key = jwk_client.get_signing_key_from_jwt(token).key
    return jwt.decode(token, signing_key, algorithms=["RS256"])

Patched code sample

import jwt
import requests
from jwt import PyJWKClient

def verify_jwt(token: str, jwks_url: str) -> dict:
    # FIX: disables redirects when fetching JWKS to enforce trust boundary
    session = requests.Session()
    session.max_redirects = 0
    jwk_client = PyJWKClient(jwks_url, session=session)
    signing_key = jwk_client.get_signing_key_from_jwt(token).key
    return jwt.decode(token, signing_key, algorithms=["RS256"])

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve2026102267,
  title        = {{PyJWT JWK client follows untrusted redirects, allowing key substitution.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-102267},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-102267/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.