Read the docs

Unbounded line buffering in httpx2 iter_lines() exhausts memory

Priority MEDIUM 42CWE-409Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
High
Impact type
—
Confidentiality · integrity · availability
None · None · High
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA.

Summary

The pydantic httpx2 package before 2.18.0 buffers decoded text in Response.iter_lines() and Response.aiter_lines() without any limit on line length. This is caused by improper handling of highly compressed data (CWE-409), so a server can return a small compressed body that decompresses to a large payload with no line separators. A malicious remote server can make a client that streams its responses hold the whole decompressed payload in memory, and memory use grows linearly with the decompressed size.

Written with Claude Haiku 5.5 from the sources below · 2026-12-04

Description from the CNA

Response.iter_lines() and Response.aiter_lines() in httpx2 buffered decoded text without any limit on the length of a line. A server can return a small compressed body that decompresses to a large payload with no line separators, making the client hold the whole decompressed payload in memory before yielding a line. A body of about 65 KiB that decompresses to 64 MiB raises peak memory to about 134 MiB, and memory grows linearly with the decompressed size. The per-chunk decompression limit added for CVE-2026-84382 does not bound this buffer. Applications are affected when they stream responses from an untrusted origin with iter_lines() or aiter_lines(), such as NDJSON consumers, log tailers or feed fetchers, using httpx2 before 2.18.0. The issue is fixed in 2.18.0, which limits a buffered line to 1,048,576 characters by default and raises DecodingError beyond it; max_line_length adjusts or disables the limit. Until then, stream untrusted responses with iter_bytes() or aiter_bytes() and enforce a size limit, or request Accept-Encoding: identity.

Why it matters now

Fix Fixed httpx2 (pydantic): 2.18.0

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
pydantichttpx2before 2.18.02.18.0Patch availableCNA
  • httpx2 Vendorpydantic Affected before 2.18.0 Fixed in 2.18.0 Patch available CNA

Remediation

Upgrade pydantic httpx2 to 2.18.0, which limits a buffered line to 1,048,576 characters by default and raises DecodingError beyond it. Until then, stream untrusted responses with iter_bytes() or aiter_bytes() and enforce a size limit, or request Accept-Encoding: identity.

Written with Claude Haiku 5.5 from the sources below · 2026-12-04

  • Fix · CNA httpx2 (pydantic) Fixed in 2.18.0

Fixed in the same release

Records fixed by the same vendor advisory or release, as the CNA lists them.

  • Release ·

    pydantic httpx2 2.18.0

    3 records Highest priority Priority MEDIUM 1 MEDIUM, 2 LOW

    Other records, highest priority first

    • TI-2026-104102 Quadratic WebSocket reassembly in httpx2 causes CPU denial of servicePriority LOW 39
    • TI-2026-104103 Proxy-Authorization header leaks proxy credentials on cross-origin redirectsPriority LOW 33

Timeline

  1. 2026-12-04 Threatist record created from CVE-2026-142020
  2. 2026-12-04 Alias added: GHSA-jhq8-qj2q-xvfm

References

  • TI-2024-03518 Regular expression denial of service in Pydantic < 2.4.0 CVSS 3.1HIGH 7.5
  • TI-2026-57990 HTTPX2: Multipart part header injection via unvalidated file Content-Type and custom headers CVSS 3.1MEDIUM 5.3
  • TI-2026-41916 Path traversal in pydantic-settings CVSS 3.1MEDIUM 5.3
  • TI-2026-20687 Pydantic AI Affected by Server-Side Request Forgery (SSRF) in URL Download Handling CVSS 3.1HIGH 8.6
  • TI-2026-94639 Harness `ToolOutputLimits` ANSI stripping can take quadratic time, blocking the event loop CVSS 3.1HIGH 7.5
  • TI-2026-69551 Pydantic AI keeps concurrency slots after streams end early CVSS 3.1HIGH 7.5
See all 39 →

Sources