⚠️

Disclaimer & Liability

The content provided on this website is for educational, research, and security awareness purposes only. Any unauthorized, illegal, or abusive use of the information, tools, and techniques discussed is solely the responsibility of the user. The author and publisher assume no liability for any damages, injuries, or consequences resulting from the misuse of this content.

CVE-2026-142230: Pydantic httpx2 LineDecoder Memory Exhaustion Risk | Alireza Bolbolabadi - Red Team Security
LOADING

CVE-2026-142230: Pydantic httpx2 LineDecoder Memory Exhaustion Risk

Executive summary

CVE-2026-142230 affects the line-oriented streaming interfaces in Pydantic httpx2 versions through 2.17.0. A malicious HTTP server can return a highly compressed gzip, deflate, brotli, or zstd response whose decompressed content contains no newline characters. While a client is reading that response through iter_lines() or aiter_lines(), the internal LineDecoder accumulates the decompressed data without an upper bound.

The result is client-side memory exhaustion. The advisory reports an approximate 1,000-to-1 decompression ratio, allowing a comparatively small response to produce a much larger in-memory allocation. The issue is a denial-of-service vulnerability rather than a data-disclosure or code-execution flaw. The supplied source does not report active exploitation, a public proof of concept, or a fixed release.

Vulnerability details

The affected component is LineDecoder in Pydantic httpx2. This decoder is used by the synchronous iter_lines() and asynchronous aiter_lines() response APIs to identify newline-delimited records. Its accumulation buffer has no effective ceiling when the decompressed response does not contain a line terminator.

The vulnerable behavior requires several conditions to coincide:

  • The client uses iter_lines() or aiter_lines().

  • The response originates from a malicious, compromised, or otherwise attacker-influenced server.

  • The response is compressed with gzip, deflate, brotli, or zstd.

  • After decompression, the body contains a sufficiently large sequence without newlines.

As bytes arrive, the decoder appends them to its internal buffer while waiting for a newline. Because that buffer is not bounded, a response can drive memory consumption upward until the client process is terminated by an out-of-memory condition or raises a memory-related exception.

The approximately 1,000-to-1 inflation ratio described in the advisory makes amplification particularly significant, although the eventual memory impact also depends on the decompressed response size and available client resources.

Affected systems

Pydantic httpx2 versions through 2.17.0 are identified as affected. No corrected version is specified in the supplied source.

Applications are most exposed when they:

  • Fetch user-controlled, third-party, or otherwise untrusted URLs.

  • Read responses with iter_lines() or aiter_lines().

  • Permit compressed response bodies, including gzip, deflate, brotli, or zstd.

  • Run without strict request deadlines, response-size limits, or container memory limits.

Typical exposure scenarios include server-side link previews, webhook delivery clients, URL-fetching services, API clients that consume newline-delimited data, and systems where redirects or server-side request forgery can redirect httpx2 traffic to an attacker-controlled endpoint.

Applications that do not use the affected line-streaming APIs are not vulnerable through the path described by the advisory. The presence of the CVE alone does not establish active exploitation or immediate compromise.

Real-world impact assessment

The attack is technically straightforward: the server returns a compressed body without newlines, and the client continues buffering decompressed data. No authentication, special client permissions, or unusual configuration is required beyond use of the affected response interface.

Impact is principally availability-focused. A successful attack can terminate or destabilize the client process, interrupt dependent services, and cause repeated memory pressure if requests are automatically retried. On shared hosts, a worker crash may also create operational side effects. The advisory does not indicate confidentiality or integrity impact.

The practical severity varies by deployment. A client with a small memory allowance may fail sooner, but that failure is still a denial of service. Conversely, a service with a large memory budget may consume substantial resources before the operating system intervenes. Network controls can reduce exposure, but they do not replace input controls in the client.

The supplied source contains no evidence of exploitation in the wild, active malware campaigns, or a known public proof of concept. Accordingly, the issue should be treated as exploitable on demand rather than as a confirmed active threat.

Mitigation

No fixed version is named in the provided advisory context. Organizations should monitor the upstream release information and the NVD entry for a version later than 2.17.0, then upgrade when an appropriate remediation is available.

Until a fixed release can be adopted:

  • Avoid iter_lines() and aiter_lines() for responses from untrusted sources. Bounded byte- or text-oriented processing can avoid the vulnerable LineDecoder path.

  • Enforce a maximum decompressed response size at the application level, not merely a limit on compressed transfer size.

  • Configure request timeouts and explicit response-size limits for outbound HTTP operations.

  • Apply process or container memory limits so a runaway request is contained rather than affecting the entire host.

  • Restrict outbound destinations with URL allowlists, controlled redirect handling, and appropriate DNS and egress policies.

  • Where an egress proxy or API gateway mediates outbound traffic, consider response-size and decompression-ratio controls.

Detection can focus on process resident-set-size growth during outbound requests, MemoryError exceptions, operating-system OOM events, and crashes involving the affected line-streaming paths. Response metadata showing high-ratio content encoding combined with a large or newline-free body may provide additional investigative context, but it should not be treated as proof of exploitation on its own.

References

·
← News