Repository navigation
chore(deps): update dependency joserfc to v1.7.6 [security] - #165
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
arpad-csepi
force-pushed
the
renovate/pypi-joserfc-vulnerability
branch
from
November 23, 2026 12:38
0f54dfc to
d15c421
Compare
arpad-csepi
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.7.2→1.7.6joserfc: Unbounded JWE General JSON
recipientsArray Leads to CPU Exhaustion (DoS) via Repeated RSA Private-Key DecryptionCVE-2026-119283 / GHSA-jpxq-7h8p-2q76
More information
Details
Summary
joserfc.jwe.decrypt_json(), the library's public parser for JWE General JSON Serialization, accepts an attacker-controlledrecipientsarray of unbounded length and performs one full private-key decryption operation (decrypt_cek) for every recipient present in the input, with no cap on recipient count. An unauthenticated network attacker who can send a JWE General JSON document to any endpoint that decrypts it with an RSA key (e.g. RSA-OAEP) can force the victim to perform an arbitrary, attacker-chosen number of RSA private-key decryption operations from a single, relatively small HTTP request. This gives the attacker a highly asymmetric CPU-exhaustion (Denial of Service) primitive: local reproduction shows request size growing linearly with recipient count (~396 bytes/recipient) while server-side CPU time grows in lock-step (near 1:1 ratio between recipient-count growth and decrypt-time growth), and the library's only documented mitigation knob,verify_all_recipients=False, does not reduce the CPU cost, since the decrypt loop attempts every recipient'sdecrypt_cek()unconditionally before that flag is ever consulted. This is CWE-400 (Uncontrolled Resource Consumption) with CVSS v3.1 Base Score 7.5 (High).Details
joserfcvalidates and caps several structural elements of a JWE (protected header size, encrypted key size, IV size, ciphertext size, and auth-tag size) insidesrc/joserfc/_rfc7516/registry.py, but performs no validation whatsoever on the number of entries in therecipientsarray of a JWE General JSON Serialization object.Data flow (source → sink), verified directly against the repository source at commit
26a10275e88276184f91ae2a6409647bfac7fea5(joserfc 1.7.4):src/joserfc/jwe.py:214— public parser entry pointdecrypt_json(data, private_key, ...). This is a documented, unauthenticated (at the library boundary) API for parsing externally supplied JWE JSON.src/joserfc/jwe.py:238— if"recipients"is present in the input dict,extract_general_json(...)is invoked.src/joserfc/_rfc7516/json.py:84-86— iteratesfor item in data["recipients"]:and appends aRecipientobject for every entry, with no upper bound check onlen(data["recipients"]):src/joserfc/jwe.py:252— the private key is attached to every extracted recipient.src/joserfc/_rfc7516/message.py:103-112—_perform_decrypt()loops over every recipient inobj.recipientsand callsdecrypt_recipient(...)for each one, regardless of how many there are:src/joserfc/_rfc7518/jwe_algs.py:74-83— for RSA-OAEP/RSA1_5 recipients, this dispatches to the sink, a genuine RSA private-key operation:Confirmed by direct inspection of
src/joserfc/_rfc7516/registry.py: size caps exist formax_header_length,max_encrypted_key_length,max_iv_length,max_ciphertext_length, andmax_auth_tag_length(registry.py:52-62, 103-121), but nomax_recipients(or equivalent) field or check exists anywhere inregistry.py,json.py, orjwe.py.Critically, the loop in
message.py:103-112callsdecrypt_recipient()for every recipient unconditionally — this happens beforeregistry.verify_all_recipientsis ever consulted. Settingverify_all_recipients=False(the library's only documented related option) therefore changes whether a decrypt failure raises an exception, but does not reduce the number of RSA private-key operations performed, and thus does not mitigate the CPU cost. This was independently confirmed at runtime (see PoC results below): decrypt time is statistically identical betweenverify_all_recipients=Trueandverify_all_recipients=Falsefor the same recipient count.decrypt_json()is not a demo-only or admin-only code path: it is documented indocs/guide/jwe.rst:156-182as the standard way to parse and decrypt an externally received General JSON JWE, and requires no special/non-default configuration to trigger. This is functionally analogous to two other resource-exhaustion issues already fixed in the same codebase — the PBES2p2citeration cap (src/joserfc/_rfc7518/jwe_algs.py:237-239) and the JWE compression "zip bomb" size cap (src/joserfc/_rfc7518/jwe_zips.py:11,26-28) — indicating the recipient-count case was simply missed from the same class of hardening.PoC
Both static (Phase 1) and dynamic, containerized (Phase 2) reproduction confirmed the vulnerability against unmodified joserfc 1.7.4 source.
Environment setup (Dockerfile):
Build and run (source is used unmodified; container has no network access):
docker build -t joserfc-vuln001 -f vuln-001/Dockerfile . docker run --rm --network none joserfc-vuln001 --recipients 1 500 1500PoC logic (
poc.py): generates a victim RSA-2048 keypair (representing the RSA key an application would use for RSA-OAEP JWE decryption), crafts a General JSON JWE (GeneralJSONEncryption) wrapping a small plaintext with an attacker-chosen numbernof RSA-OAEP recipients (all using the victim's public key, which is inherently public for JWE encryption), then calls the unmodified public APIjoserfc.jwe.decrypt_json()and measures wall-clock decrypt time, once withverify_all_recipients=Trueand once withverify_all_recipients=False.Observed results (Phase 2, inside the Docker container,
--network none, unmodified source):Independent static-phase (Phase 1) reproduction against the same commit, outside the container, produced the same linear-scaling behavior (recipients=500 → 198,140 bytes → 0.627s; recipients=1500 → 594,140 bytes → 1.957s), and the original report's own local run showed recipients=1000 → 396,140 bytes → 1.254s; recipients=3000 → 1,188,140 bytes → 3.762s. In every run,
plaintext=b'hello'was correctly recovered, confirming each crafted request is fully valid input, not malformed data rejected early.In all cases,
verify_all_recipients=Falseproduced decrypt times statistically identical toverify_all_recipients=Truefor the same recipient count (e.g. 500 recipients: 0.631s vs 0.651s; 1500 recipients: 1.874s vs 1.875s), empirically confirming that this documented flag does not mitigate the CPU cost.Impact
This is a remote, unauthenticated CPU-exhaustion Denial-of-Service vulnerability (CWE-400, Uncontrolled Resource Consumption). Any application that:
joserfc.jwe.decrypt_json()with an RSA-based key-management algorithm (e.g. RSA-OAEP, RSA1_5)is impacted. The attacker needs only the victim's RSA public key — which is inherently public, since it is used by legitimate senders to encrypt JWEs to the victim. Because request size scales linearly with recipient count (~396 bytes per recipient) while attacker-inflicted server CPU cost scales in lock-step with recipient count, the attacker gets a highly favorable cost asymmetry: e.g. a ~1.2 MB request forced ~3.8 seconds of RSA-2048 private-key decrypt operations in testing. Repeated or concurrent requests of this shape can exhaust available CPU/worker capacity on the victim service, degrading or denying availability for legitimate users. Confidentiality and integrity are not affected (no key material or plaintext is disclosed or corrupted); the impact is availability only, matching the CVSS vector's
C:N/I:N/A:H.Reproduction artifacts
Dockerfilepoc.pySeverity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
joserfc: Compact JWS size guard allocates attacker-controlled segments before rejection
CVE-2026-119284 / GHSA-9pg5-8c7x-5hfx
More information
Details
Summary
joserfc 1.7.4 defines compact-JWS header, payload, and signature limits, but
calls
value.split(b".")before validating them. Pythonbytes.split()copiesthe attacker-controlled segments, so the current guard allocates roughly one
complete payload before rejecting it.
Reproduction
The input is resident before a fork-isolated verifier runs, and every signature
is invalid.
The unconstrained profile is the primary evidence: joserfc allocates an
additional attacker-sized object before producing its intended
ExceededSizeError. A separate baseline-plus-headroom stress test raisesMemoryErrorwhen that copy cannot fit, but this report does not characterizean absolute
RLIMIT_ASvalue as a realistic worker memory budget.Security Argument
The issue is not that joserfc can prevent the transport layer from receiving a
large header. The issue is narrower: once bytes reach
deserialize_compact(),the library's existing size guard cannot fulfill its allocation-limiting purpose
because attacker-controlled segment copies are created first.
This differs from
GHSA-frfh-8v73-gjg4,
which concerned embedding already-loaded oversized segments in exception and log
messages. Here, the current implementation itself creates an additional
payload-sized allocation before its fixed size exception.
Recommended Fix
Check
len(value)against a maximum compact-serialization size beforesplit(). If per-segment diagnostics are needed, locate delimiters with boundedfind()operations or memory views, validate offsets and lengths, and only thenmaterialize acceptable segments.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Release Notes
authlib/joserfc (joserfc)
v1.7.6Compare Source
🐞 Bug Fixes
View changes on GitHub
v1.7.5Compare Source
🚀 Features
🐞 Bug Fixes
View changes on GitHub
v1.7.4Compare Source
🐞 Bug Fixes
View changes on GitHub
v1.7.3Compare Source
🐞 Bug Fixes
View changes on GitHub