Home › Vulnerabilities › pydantic
httpx2 batch fixed in 2.18.0: memory growth, slow WebSocket reassembly and proxy credential leak on redirect
NVD published three httpx2 vulnerabilities on 2026-12-04, rated medium or low. They cover unbounded line buffering, quadratic WebSocket message reassembly and a Proxy-Authorization header kept across cross-origin redirects, and all three are fixed in version 2.18.0.
What to look into
- 3 vulnerabilities in pydantic httpx2: 2 medium, 1 low (CVSS up to 5.9).
- None of them is known to be exploited yet.
- Start with CVE-2026-142020 (5.9 medium): 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 payl… An attacker without an account can exploit this over the network, without any user action, but only under specific conditions.
- 3 of 3 can be attacked over the network without logging in, 3 of them without anyone clicking anything.
- Kinds of flaws: Improper Handling of Highly Compressed Data (Data Amplification); Inefficient Algorithmic Complexity; Exposure of Sensitive Information to an Unauthorized Actor.
Key points
- Three httpx2 flaws published together; all fixed in 2.18.0
- Highest rating is CVE-2026-142020 at CVSS 5.9 (MEDIUM)
- CVE-2026-142020 and CVE-2026-132651 cause memory or CPU exhaustion from untrusted responses or WebSocket frames
- CVE-2026-140868 can leak Proxy-Authorization on cross-origin redirects when followredirects is enabled
- The sources report no known exploitation
Overview
NVD published three vulnerabilities in the httpx2 Python HTTP client on 2026-12-04. The highest rating is CVSS 5.9 (MEDIUM), and the sources do not report known exploitation of any of them. All three are fixed in version 2.18.0.
Resource exhaustion in streaming and WebSockets
CVE-2026-142020 (MEDIUM, CVSS 5.9) affects Response.iterlines() and Response.aiterlines(), which buffer decoded text with no limit on line length. A server can send a small compressed body that expands into a large payload without line separators, and the client holds the whole expansion in memory. According to the record, a body of about 65 KiB that decompresses to 64 MiB raises peak memory to about 134 MiB. The risk applies to applications that stream from untrusted origins, such as NDJSON consumers, log tailers and feed fetchers.
CVE-2026-132651 (MEDIUM, CVSS 5.3) is a related resource problem in WebSocket handling. Each continuation frame was appended to a bytes buffer, which copied the accumulated message every time. A malicious server, or an on-path attacker on an unencrypted ws:// connection, can split a message into many tiny frames, making reassembly take quadratic time. The record says this holds the GIL in the synchronous client and blocks the event loop in the asynchronous one. Versions 2.10.0 and later apply a default 64 KiB maxmessagesizebytes limit; versions 2.6.0 to 2.9.1 have no such limit.
Proxy credential kept across redirects
CVE-2026-140868 (LOW, CVSS 3.7) concerns redirects. When a redirect goes to a different origin, httpx2 removes Authorization and Cookie headers but keeps Proxy-Authorization. The record describes this as relevant only when followredirects is enabled, the proxy credential is passed in headers rather than the proxy URL, and the redirect target is not reached through the same forward proxy. Proxy credentials given in the proxy URL are not affected.
Fix and interim measures
Version 2.18.0 addresses all three issues. For the line-buffering flaw it limits a buffered line to 1,048,576 characters by default and raises DecodingError beyond that, and maxlinelength can adjust or disable the limit. The records describe interim measures for each issue, but they do not give a complete list of affected deployments beyond the conditions above.
What to do
- Upgrade httpx2 to version 2.18.0 or later.
- Until upgrading, stream untrusted responses with iterbytes() or aiterbytes() and enforce a size limit, or request Accept-Encoding: identity.
- For WebSockets, keep maxmessagesizebytes small and connect only to trusted wss:// endpoints until upgrading.
- Pass proxy credentials in the proxy URL instead of headers, or leave followredirects off, until upgrading.
The 3 vulnerabilities
- CVE-2026-142020 5.9 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…
- CVE-2026-132651 5.3 httpx2 reassembled fragmented WebSocket messages by appending each continuation frame to a bytes buffer, copying the whole accumulated message on every frame. A WebSocket server, or an on-path attacker on an unencrypted ws:// connection, c…
- CVE-2026-140868 3.7 When following a redirect to a different origin, httpx2 removes the Authorization and Cookie headers but keeps Proxy-Authorization. A client that sets Proxy-Authorization in its client or request headers sends that credential to the redire…
Frequently asked questions
How many pydantic httpx2 vulnerabilities were published on December 4, 2026?
3 vulnerabilities: 2 medium, 1 low, with CVSS scores up to 5.9.
Are any of them being exploited?
None of them is in CISA's Known Exploited Vulnerabilities catalog yet.
Which one should be fixed first?
CVE-2026-142020 (CVSS 5.9): 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 payl…