CVE-2026-114615
Authlib allows prefixed asymmetric keys as HMAC secrets, enabling token forgery.
- CVSS 7.4
- CWE-184
- Authentication, Authorization, and Session Management
- Remote
Authlib is a Python library which builds OAuth and OpenID Connect servers. From 1.3.1 until 1.9.0, OctKey.import_key() checks asymmetric-key markers only at byte zero while Authlib's PEM loaders accept leading whitespace, comments, or a byte-order mark. In deployments that use the documented mixed algorithm registry and already configure verification with PEM or certificate bytes containing such a prefix, an unauthenticated attacker who knows those same public-key bytes can use them as an HMAC secret and forge HS256 tokens with arbitrary identity or authorization claims. This is a bypass of the remediation for CVE-2024-37568. The module-level jwt object reaches OctKey.import_key() in authlib/jose/rfc7518/oct_key.py, where POSSIBLE_UNSAFE_KEYS fails to identify prefixed asymmetric key material. This issue is fixed in version 1.9.0.
- CWE
- CWE-184
- CVSS base score
- 7.4
- Published
- 2026-10-22
- OWASP
- A02 Cryptographic Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Insecure Authentication Mechanisms
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- Authlib
- Fixed by upgrading
- Yes
Solution
Upgrade Authlib to version 1.9.0 (or later).
Vulnerable code sample
import sys
from authlib.jose import jwt, OctKey
def verify_token(token: str, key_data: bytes) -> dict:
# VULNERABLE: accepts PEM with leading whitespace as HMAC secret
signing_key = OctKey.import_key(key_data)
claims = jwt.decode(token, signing_key)
claims.validate()
return claimsPatched code sample
import sys
from authlib.jose import jwt, OctKey, RSAKey
def verify_token(token: str, key_data: bytes) -> dict:
# FIX: reject prefixed PEM, enforce proper asymmetric key handling
stripped = key_data.lstrip()
if stripped.startswith(b'-----BEGIN'):
signing_key = RSAKey.import_key(stripped)
else:
signing_key = OctKey.import_key(stripped)
claims = jwt.decode(token, signing_key)
claims.validate()
return claimsPublished 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.
- fix(oauth): enforce JOSE key, scope, and audience validation (authlib/authlib)
authlib/jose/rfc7518/oct_key.py,authlib/jose/rfc7518/oct_key.py · OctKey.get_op_key,authlib/jose/rfc7518/oct_key.py · OctKey.import_key,authlib/oauth2/rfc7523/jwt_bearer.py · JWTBearerGrant.get_audiences,authlib/oauth2/rfc7523/jwt_bearer.py · JWTBearerGrant.verify_claims,authlib/oidc/core/grants/hybrid.py · OpenIDHybridGrant.create_granted_params,authlib/oidc/core/grants/hybrid.py · OpenIDHybridGrant.save_authorization_code,authlib/oidc/core/grants/hybrid.py · OpenIDHybridGrant.validate_authorization_request,authlib/oidc/core/grants/implicit.py · OpenIDImplicitGrant.create_granted_params,authlib/oidc/core/grants/implicit.py · OpenIDImplicitGrant.validate_authorization_request
Cite this entry
@misc{vaitp:cve2026114615,
title = {{Authlib allows prefixed asymmetric keys as HMAC secrets, enabling token forgery.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-114615},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-114615/}}
}
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 ::
