GHSA-9pg5-8c7x-5hfx

Suggest an improvement
Source
https://github.com/advisories/GHSA-9pg5-8c7x-5hfx
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9pg5-8c7x-5hfx/GHSA-9pg5-8c7x-5hfx.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-9pg5-8c7x-5hfx
Aliases
Published
2026-10-30T14:54:25Z
Modified
2026-10-30T15:15:03Z
Severity
  • 6.9 (Medium) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N CVSS Calculator
Summary
joserfc: Compact JWS size guard allocates attacker-controlled segments before rejection
Details

Summary

joserfc 1.7.4 defines compact-JWS header, payload, and signature limits, but calls value.split(b".") before validating them. Python bytes.split() copies the attacker-controlled segments, so the current guard allocates roughly one complete payload before rejecting it.

Reproduction

.venv-research/bin/python 06-practical-testing/preauth-memory-profile.py

The input is resident before a fork-isolated verifier runs, and every signature is invalid.

Input Peak RSS delta Amplification Result
1 MiB 1.11 MiB 1.11× size rejected
4 MiB 4.04 MiB 1.01× size rejected
8 MiB 8.04 MiB 1.01× size rejected
16 MiB 16.04 MiB 1.00× size rejected
32 MiB 31.74 MiB 0.99× size rejected
64 MiB 63.80 MiB 1.00× size rejected

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 raises MemoryError when that copy cannot fit, but this report does not characterize an absolute RLIMIT_AS value 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 before split(). If per-segment diagnostics are needed, locate delimiters with bounded find() operations or memory views, validate offsets and lengths, and only then materialize acceptable segments.

Database specific
{
    "cwe_ids":  [
        "CWE-400"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-10-30T14:54:25Z",
    "nvd_published_at":  "2026-10-29T22:17:01Z",
    "severity":  "MODERATE"
}
References

Affected packages

PyPI / joserfc

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
1.7.6

Affected versions

0.*
0.1.0
0.2.0
0.3.0
0.4.0
0.5.0
0.6.0
0.7.0
0.8.0
0.9.0
0.10.0
0.11.0
0.11.1
0.12.0
1.*
1.0.0
1.0.1
1.0.2
1.0.3
1.0.4
1.1.0
1.2.0
1.2.1
1.2.2
1.3.0
1.3.1
1.3.2
1.3.3
1.3.4
1.3.5
1.4.0
1.4.1
1.4.2
1.4.3
1.5.0
1.6.0
1.6.1
1.6.2
1.6.3
1.6.4
1.6.5
1.6.7
1.6.8
1.7.0
1.7.1
1.7.2
1.7.3
1.7.4
1.7.5

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9pg5-8c7x-5hfx/GHSA-9pg5-8c7x-5hfx.json"