authlib
Affected
- introduced
0, fixed1.6.4(ecosystem)
Fixed versions
1.6.4
Fix
- Fixed version
1.6.4pip install --upgrade authlib==1.6.4
Advisory
Also known as: CVE-2025-59420, GHSA-9ggr-2464-2j32
Authlib: JWS/JWT accepts unknown crit headers (RFC violation → possible authz bypass)
Summary
Authlib’s JWS verification accepts tokens that declare unknown critical header parameters (crit), violating RFC 7515 “must‑understand” semantics. An attacker can craft a signed token with a critical header (for example, bork or cnf) that strict verifiers reject but Authlib accepts. In mixed‑language fleets, this enables split‑brain verification and can lead to policy bypass, replay, or privilege escalation.
Affected Component and Versions
authlib.jose.JsonWebSignature.deserialize_compact(...)critDetails
RFC 7515 (JWS) §4.1.11 defines crit as a “must‑understand” list: recipients MUST understand and enforce every header parameter listed in crit, otherwise they MUST reject the token. Security‑sensitive semantics such as token binding (e.g., cnf from RFC 7800) are often conveyed via crit.
Observed behavior with Authlib 1.6.3:
crit: ["cnf"] and a cnf object, or crit: ["bork"] with an unknown parameter, Authlib verifies the signature and returns the payload without rejecting the token or enforcing semantics of the critical parameter.jose v5 both reject such tokens by default when crit lists unknown names.Impact in heterogeneous fleets:
crit carries binding or policy information.Proof of Concept (PoC)
This repository provides a multi‑runtime PoC demonstrating the issue across Python (Authlib), Node (jose v5), and Java (Nimbus).
Prerequisites
Setup
Enter the directory authlib-crit-bypass-poc & run following commands.
make setup
make tokens
Tokens minted
tokens/unknown_crit.jwt with protected header: { "alg": "HS256", "crit": ["bork"], "bork": "x" }tokens/cnf_header.jwt with protected header: { "alg": "HS256", "crit": ["cnf"], "cnf": {"jkt": "thumb-42"} }Reproduction
Run the cross‑runtime demo:
make demo
Expected output for each token (strict verifiers reject; Authlib accepts):
For tokens/unknown_crit.jwt:
Strict(Nimbus): REJECTED (unknown critical header: bork)
Strict(Node jose): REJECTED (unrecognized crit)
Lenient(Authlib): ACCEPTED -> payload={'sub': '123', 'role': 'user'}
For tokens/cnf_header.jwt:
Strict(Nimbus): REJECTED (unknown critical header: cnf)
Strict(Node jose): REJECTED (unrecognized crit)
Lenient(Authlib): ACCEPTED -> payload={'sub': '123', 'role': 'user'}
Environment notes:
1.6.3 (from PyPI)jose version: ^59.37.x0123456789abcdef0123456789abcdefImpact
crit “must‑understand” semantics; specification non‑compliance leading to authentication/authorization policy bypass.crit to carry mandatory security semantics (e.g., token binding via cnf) or operates in a heterogeneous fleet with strict verifiers elsewhere.References
critcnf)High Basis: CVSS v3 score 7.5, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
0, fixed 1.6.4 (ecosystem)1.6.4
1.6.4pip install --upgrade authlib==1.6.4Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: PyPA Advisory Database · CC BY 4.0