Skip to content

GHSA-f2fp-rgf2-35cp CVE-2026-84378 PYSEC-2026-3847

HTTPX2: Quadratic SSE line buffering can cause CPU denial of service

Medium PyPI
Severity
5.9 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.32%
Chance of exploitation in the next 30 days. Higher than 24.50% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-407 Inefficient Algorithmic Complexity
Fix
2.10.0
Upgrade httpx2 to this version or later

Description

Summary

HTTPX2's Server-Sent Events (SSE) parser repeatedly copied and rescanned buffered text when a server split one unterminated line across many response chunks. The total work grows quadratically with the length of the line. An attacker-controlled or compromised SSE endpoint can exploit this behavior to consume excessive client CPU.

Details

Before version 2.10.0, HTTPX2 combined the complete pending SSE line with each newly received chunk and then scanned the combined text for line separators. If an SSE server sends a long line as many small chunks without a line separator, every chunk causes all previously received text to be copied and scanned again. For n fixed-size chunks, this results in O(n²) processing.

The behavior affects both httpx2.Client.sse() and httpx2.AsyncClient.sse(). Other response APIs do not use the SSE parsing path.

Impact

Applications that consume SSE from an attacker-controlled or compromised endpoint can experience excessive CPU usage. A crafted stream can block a synchronous worker or the asynchronous event loop that is consuming it, degrading availability for other work in that process. Confidentiality and integrity are not affected.

Mitigation

Upgrade to HTTPX2 2.10.0 or later. SSE parsing now accumulates incomplete line fragments and combines them only when necessary, making processing linear in the amount of received data. HTTPX2 2.10.0 also limits buffered SSE events to 1 MiB by default through max_event_size.

If upgrading is not immediately possible, only consume SSE from trusted endpoints and enforce an external size or time budget on the stream.

Affected versions

PyPI

PackageVulnerableFixed in
httpx2
>= 2.5.0, < 2.10.0
2.10.0
httpx2
>= 2.5.0, < 2.10.0
2.10.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

httpx2 PyPI → 2.10.0

pip
pip install --upgrade "httpx2>=2.10.0"
poetry
poetry add "httpx2>=2.10.0"
uv
uv add "httpx2>=2.10.0"

Severity breakdown

CVSS 3.1 5.9

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Weakness

CWE-407: Inefficient Algorithmic Complexity

An algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-8xx6-hgc6-gc2m
HTTPX2: Streaming response decompression does not bound peak memory (decompression amplification)
High Also affects httpx2
GHSA-7mj9-2mp8-4m2p
HTTPX2: Secure WebSocket traffic sent without TLS through SOCKS proxies
High Also affects httpx2
GHSA-pf96-p4fj-6566
HTTPX2: Conflicting Content-Length and Transfer-Encoding headers can be auto-generated
Medium Also affects httpx2
GHSA-h4x7-gw46-3wm6
HTTPX2: Multipart part header injection via unvalidated file Content-Type and custom headers
Medium Also affects httpx2
GHSA-2qm8-x737-gmw5
pyasn1 has quadratic CPU consumption in constructed BIT STRING decoding
High Same weakness, CWE-407
GHSA-mm57-4v3p-rchx
pyasn1 has quadratic-complexity denial of service in binary REAL decoding
High Same weakness, CWE-407
GHSA-9m75-vc3g-4x39
pyasn1 has quadratic-time denial of service in constructed string and indefinite-length ANY decoding
High Same weakness, CWE-407
GHSA-fm9c-5rcf-2q5p
pyasn1 has quadratic CPU use in schemaless BER/CER/DER container decoding
High Same weakness, CWE-407

Credits: GalaxySnail

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor