CVE-2025-61920: Authlib is vulnerable to Denial of Service via Oversized JOSE Segments
7.5
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| authlib | pip | < 1.6.5 | 1.6.5 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability lies in Authlib's JOSE implementation, which failed to limit the size of JWS/JWT header and signature segments. An attacker could send a token with multi-megabyte segments, causing the server to exhaust CPU and memory while decoding and parsing them. This leads to a Denial of Service.
The analysis of the patch commit 867e3f87b072347a1ae9cf6983cc8bbf88447e5e pinpoints the vulnerable functions. The core of the issue is in authlib.jose.util.extract_segment, which performs the base64 decoding. Before the patch, it did so without any size validation. This function is called by authlib.jose.util.extract_header to process the header. The highest-level function in the call stack is authlib.jose.rfc7515.jws.JsonWebSignature.deserialize_compact, which takes the full serialized token as input.
The patch mitigates the vulnerability by adding size checks in all three functions. JsonWebSignature.deserialize_compact now checks the total length of the token, while extract_header and extract_segment check the length of the individual segments before attempting to decode them. During an exploit, these functions would be the primary consumers of system resources, making them key indicators in a runtime profile.
Vulnerable functions
JsonWebSignature.deserialize_compactauthlib/jose/rfc7515/jws.py
extract_headerauthlib/jose/util.py
extract_segmentauthlib/jose/util.py