CVE-2026-114616
Empty key allows attacker to forge HS256/HS384/HS512 JWT signatures.
- CVSS 7.4
- CWE-287
- Authentication, Authorization, and Session Management
- Remote
Authlib is a Python library which builds OAuth and OpenID Connect servers. Prior to 1.9.1, Authlib's OctKey.import_key() and HMAC signing and verification path accept zero-length key material. If an application's secret lookup can return an empty string or empty bytes, a remote attacker can compute the deterministic HS256, HS384, or HS512 signature for arbitrary token claims and have Authlib treat the token as authentic. This issue is fixed in version 1.9.1.
- CWE
- CWE-287
- CVSS base score
- 7.4
- Published
- 2026-10-22
- OWASP
- A02 Cryptographic Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Insecure Authentication Mechanisms
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Upgrade Authlib to version 1.9.1 or later.
Vulnerable code sample
from authlib.jose import JsonWebToken, OctKey
def verify_token(token, secret_lookup):
# VULNERABLE: accepts empty secret allowing forged HS* signatures
secret = secret_lookup()
key = OctKey.import_key(secret) # insecure if secret == b''
jwt = JsonWebToken(['HS256'])
try:
claims = jwt.decode(token, key)
claims.validate()
return claims
except Exception:
return NonePatched code sample
from authlib.jose import JsonWebToken, OctKey
def verify_token(token, secret_lookup):
# FIX: reject empty secret to prevent forged HS* signatures
secret = secret_lookup()
if not secret:
raise ValueError("Secret material must not be empty")
key = OctKey.import_key(secret)
jwt = JsonWebToken(['HS256'])
try:
claims = jwt.decode(token, key)
claims.validate()
return claims
except Exception:
return NonePublished 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.
- Merge commit from fork (authlib/authlib)
authlib/jose/rfc7518/oct_key.py · OctKey._check_key
Cite this entry
@misc{vaitp:cve2026114616,
title = {{Empty key allows attacker to forge HS256/HS384/HS512 JWT signatures.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-114616},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-114616/}}
}
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 ::
