CVE-2026-84379: CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') in pydantic httpx2
Description
### Summary HTTPX2 serializes the per-file `Content-Type` and custom headers supplied through the `files=` tuple API directly into the `multipart/form-data` body without validating custom header names or values. An attacker who can influence upload metadata passed to HTTPX2 can use CR or LF characters to terminate a multipart part header and inject additional part headers or end the part header block early. ### Details The three-element file tuple accepts `(filename, content, content_type)`, and the four-element form accepts `(filename, content, content_type, headers)`. `FileField.render_headers()` interpolates the supplied header names and values between CRLF delimiters without validating them. For example: ```python import httpx2 request = httpx2.Request( "POST", "https://example.com/upload", headers={"Content-Type": "multipart/form-data; boundary=BOUNDARY"}, files={ "file": ( "safe.txt", b"payload", "text/plain\r\nX-Injected: true", ) }, ) print(request.read().decode()) ``` The generated body contains an attacker-injected part header: ```text --BOUNDARY Content-Disposition: form-data; name="file"; filename="safe.txt" Content-Type: text/plain X-Injected: true payload --BOUNDARY-- ``` The same issue affects names and values in the custom header mapping from the four-element tuple. Field names and filenames are serialized through a separate escaping path and do not permit CRLF header injection. ### Impact Applications are affected when they pass attacker-controlled upload metadata into the per-file `content_type` or custom `headers` arguments. The receiving server interprets injected lines as genuine multipart part headers. Depending on how that server validates and processes uploads, this can alter part semantics or bypass checks based on part headers. This does not split the outer HTTP request: the injected headers are contained within the multipart body. The concrete security impact therefore depends on the downstream multipart parser and application behavior. ### Mitigation Upgrade to HTTPX2 `2.11.0` or later. Patched versions reject forbidden control characters in multipart part header names and values and raise `ValueError` before serializing the request. If upgrading is not immediately possible, applications should validate custom multipart header names as HTTP field-name tokens. They should reject NUL, CR, LF, other C0 controls except horizontal tab, and DEL in per-file content types and custom header values before passing them to HTTPX2.
CVSS v3.1
Score 5.3medium
Affected software
pydantic
httpx2
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
HTTPX2's multipart/form-data serialization for file uploads accepts per-file content_type and custom headers that are directly interpolated into multipart part headers without validation for CRLF characters. This allows an attacker who can influence these inputs to inject additional headers or prematurely terminate the header block within a multipart part, a CRLF injection vulnerability (CWE-93). The vulnerability affects HTTPX2 versions before 2.11.0. The impact depends on the receiving server's multipart parser and application logic. The issue is fixed in HTTPX2 2.11.0, which raises errors when forbidden control characters are detected.
Potential Impact
The vulnerability allows injection of additional multipart part headers within the multipart/form-data body, which can alter the semantics of file upload parts or bypass server-side validation that relies on part headers. There is no impact on the outer HTTP request headers. The concrete security impact depends on how the downstream server processes multipart data and whether it trusts or validates injected headers. This could lead to bypassing security controls or unexpected behavior in file upload handling.
Mitigation Recommendations
Upgrade HTTPX2 to version 2.11.0 or later, where the vulnerability is fixed by rejecting forbidden control characters in multipart part header names and values, raising a ValueError before serialization. If upgrading is not immediately possible, applications should validate and sanitize per-file content_type and custom header values to reject NUL, CR, LF, other C0 controls except horizontal tab, and DEL characters before passing them to HTTPX2.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-09-01T16:27:58.130Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6a986636acd9273b498ff4e1
Added to database: 09/02/2026, 18:08:54 UTC
Last enriched: 09/29/2026, 05:03:54 UTC
Last updated: 10/17/2026, 18:48:23 UTC
Views: 133
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.