/

CVE-2026-34520

Severity:

CRITICAL RISK

(9.1)

HTTP Response Splitting / Header Injection in AIOHTTP C

CVE-2026-34520

Analyzed

Vulnerability type

Category:

HTTP Response Splitting / Header Injection

CWE:

CWE-113

Impact:

HTTP Response Splitting and Header Injection

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

AIOHTTP's C-based HTTP parser previously accepted null bytes and control characters within response headers, failing to enforce strict header syntax rules.

When responses pass through intermediaries or are consumed by applications that misinterpret these characters, this can enable HTTP response splitting, cache poisoning, or header injection in downstream components.

Affected context

This vulnerability affects applications built on AIOHTTP where the C parser is used to handle HTTP responses, which is the default in most installations.

It is relevant in contexts where:

  • AIOHTTP acts as an HTTP client or server and forwards or reuses received headers
  • Response headers may traverse proxies, caches, or intermediate gateways
  • Downstream components assume headers are free of embedded control characters or null bytes

The issue manifests when malformed headers containing control characters or null bytes are accepted as valid and propagated without normalization or rejection.

Exploit preconditions

  • Attack surface: HTTP response handling in AIOHTTP-based services (client, server, or proxy-style components).
  • Required access: Ability to cause AIOHTTP to process HTTP responses with attacker-controlled headers (e.g., as an upstream server, malicious peer, or MITM modifying traffic).
  • Trigger point: Parsing of response header fields that include null bytes (\x00) or control characters (such as CR, LF, or other non-printable ASCII controls) by the C HTTP parser.
  • Why exploitation is possible: The parser did not strictly validate and reject illegal control characters in header fields, allowing them to pass into application logic or be forwarded to other systems which may interpret these characters as header delimiters or message boundaries.

Why this happens

The root cause lies in insufficient input validation within the C implementation of the HTTP response parser.

Under CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers, HTTP header fields must conform to strict syntax rules that exclude embedded control characters and null bytes to prevent header and message boundary confusion.

In this case, the parser treated such characters as part of normal header content instead of rejecting the headers or normalizing them, breaking the expected invariants for downstream consumers.

This insecure pattern arises when protocol parsers prioritize performance or leniency over strict RFC-compliant validation of header bytes.

Potential impact

  • HTTP response splitting in downstream components that interpret injected control characters as line breaks.
  • Header injection into subsequent responses, potentially altering security-related headers (e.g., caching, cookies, redirects).
  • HTTP cache poisoning when intermediaries store and serve attacker-influenced responses to other clients.
  • Cross-site scripting (XSS) or open redirect scenarios when injected headers manipulate locations, content types, or other browser-relevant metadata.
  • Degradation or bypass of logging, monitoring, or WAF rules if logs or filters misparse malformed headers.

General mitigation guidance

Effective mitigation focuses on enforcing strict, RFC-compliant header parsing and minimizing trust in upstream header data:

  • Validate all HTTP header fields against allowed character sets, rejecting or normalizing headers containing control characters or embedded null bytes.
  • Centralize header parsing and canonicalization so application code never deals with raw, unvalidated header lines.
  • Apply a "reject-by-default" policy for malformed protocol input, failing the request or connection rather than attempting to be lenient.
  • Sanitize and constrain which headers are forwarded to downstream services or clients, especially in proxy, gateway, or service-mesh roles.
  • Use defense-in-depth with layered checks: web server, reverse proxy, and application framework all enforcing header integrity and size limits.

Aligning parser behavior with protocol specifications and strictly treating any control-character violations as errors substantially reduces exposure.

How teams detect issues like this

Security teams can detect and monitor for this class of issue using a combination of code-centric and operational approaches:

  • Static analysis & code review:
  • Review HTTP parsing and header-handling code for custom validation logic or direct manipulation of raw header bytes.
  • Flag parsers that do not explicitly check for and reject control characters (< 0x20 and 0x7F) or embedded null bytes.
  • Verify adherence to RFC 7230/9110 constraints in parser implementations and wrapper utilities.
  • Dynamic testing & fuzzing:
  • Use protocol fuzzers to send responses with embedded CR, LF, null bytes, and other control characters in header names and values to AIOHTTP-based components.
  • Observe whether such responses are accepted, forwarded, or cause inconsistent behavior in downstream systems.
  • Runtime monitoring:
  • Instrument logging to capture unusual or non-printable characters in response headers and alert on anomalies.
  • Configure reverse proxies or gateways to log and optionally block malformed headers at the edge.
  • Automated tooling:
  • Integrate HTTP security testing tools in CI/CD to continuously probe header-handling logic.
  • Employ SCA (Software Composition Analysis) to surface known parser-related vulnerabilities and ensure strict parsing defaults.

Sources

SourceLink
github.comgithub.com/aio-libs/aiohttp/commit/9370b9714a7a56003cacd31a9b4ae16eab109ba4
github.comgithub.com/aio-libs/aiohttp/releases/tag/v3.13.4
github.comgithub.com/aio-libs/aiohttp/security/advisories/GHSA-63hf-3vf5-4wqf

Frequently asked

questions

Yes, in typical networked deployments where an attacker can influence HTTP responses handled by AIOHTTP, it can be remotely exploitable. The exact impact depends on how the application forwards or interprets malformed headers and whether intermediaries are involved.

An attacker generally needs the ability to act as or affect an upstream HTTP endpoint or to tamper with traffic in transit (for example, as a malicious server, compromised upstream, or network-position adversary). Direct local access to the AIOHTTP process is not required if they can control the response stream.

Enforce strict header validation in all HTTP parsing paths: reject or sanitize any header containing control characters or null bytes, and rely on well-maintained, protocol-compliant parsing primitives rather than hand-rolled logic. Ensure that malformed input leads to a clear error and not to partial or ambiguous parsing.

Adopt a "strict by default" stance for protocol parsers, regularly test them with fuzzing, and include header and protocol normalization checks in code review standards. Combine this with automated security testing in CI/CD and defense-in-depth at the edge (reverse proxies, gateways) to block malformed headers before they reach application logic.

Find out what's already
exploitable in your codebase.