CVE-2026-142020: Unbounded iter_lines() and aiter_lines() buffering enables memory exhaustion via decompression amplification

Published Dec 4, 2026
·
Updated

Response.iterlines() and Response.aiterlines() 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 iterlines() or aiterlines(), 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; maxlinelength adjusts or disables the limit. Until then, stream untrusted responses with iterbytes() or aiterbytes() and enforce a size limit, or request Accept-Encoding: identity.

Affected Software

1 affected component
pypi/httpx2<2.18.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade httpx2 to a version that resolves this vulnerability.

    Fixed in 2.18.0
  2. Configuration

    Until upgrading, request Accept-Encoding: identity when fetching untrusted responses.

    httpx2 Accept-Encoding = identity
  3. Compensating control

    Until upgrading, stream untrusted responses with iter_bytes() or aiter_bytes() and enforce a size limit.

Event History

Dec 4, 2026
CVE Published
via MITRE·11:28 AM
Data Sourced
via MITRE·11:28 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which applications are exposed to this issue?

Applications using httpx2 before 2.18.0 are affected when they stream responses from an untrusted origin through iter_lines() or aiter_lines(). Examples include NDJSON consumers, log tailers, and feed fetchers.

2

What does an attacker need to do to trigger the memory exhaustion?

An attacker needs to control or operate a server from which the application streams a response. The server can send a small compressed response that expands into a very large payload without line separators, causing the client to buffer the decompressed line in memory.

3

Are default settings affected?

Yes. Before 2.18.0, iter_lines() and aiter_lines() have no limit on buffered line length. In 2.18.0, the default maximum buffered line length is 1,048,576 characters, after which a DecodingError is raised.

4

What can be done if upgrading is not immediately possible?

Avoid iter_lines() and aiter_lines() for untrusted responses. Stream with iter_bytes() or aiter_bytes() while enforcing a size limit, or request uncompressed responses with Accept-Encoding: identity.

5

Does the earlier per-chunk decompression limit prevent this issue?

No. The per-chunk decompression limit added for CVE-2026-84382 does not limit the line buffer that accumulates decoded text without a line separator.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203