Where
-Infinity
0
Severity
6.5
AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N

joserfc is a Python library that provides an implementation of several JSON Object Signing and Encryption (JOSE) standards. Prior to version 1.7.3, JWTClaimsRegistry applies membership matching to list-valued iss and sub claims, allowing an array-valued iss that contains the expected issuer to pass an intended equality check and enabling issuer-validation bypass. This issue is fixed in version 1.7.3.

First published (updated )
Severity
5.3
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

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.

1 / 2
Source: GitHub
First published (updated )
Severity
2.3
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

joserfc is a Python library that provides an implementation of several JSON Object Signing and Encryption (JOSE) standards. in versions 1.7.1 and prior, joserfc accepts JWTs with trailing padding (==) which are not conforming to the JOSE specifications. This leads to malleability of the JWTs when consumed by joserfc. Depending on this application this might or not be an issue. This could lead to bypass of token revocation or anti-replay protection when implemented as a deny list of tokens or a deny list of token hashes. Note that ECDSA JWS are always malleable because of the malleability of ECDSA signatures (first test case in the code bellow). This makes a scheme which assumes that JWTs are not malleable brittle. However for other signatures (or MAC) schemes it might make sense to assume non malleability of the token. This issue has been fixed in version 1.7.2.

First published (updated )
Severity
4

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.

First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203