Join our Newsletter — 33% off our NHI Course

HTTP Response Splitting

HTTP response splitting is an attack that injects line breaks into an HTTP response so a server or proxy treats attacker-controlled data as a second response. It can enable cache poisoning, header injection, and content spoofing. Defenders should validate response data, normalise headers, and reject untrusted line breaks.

How HTTP Response Splitting Works

HTTP response splitting exploits the boundary between header parsing and body rendering. When attacker-controlled input can introduce raw line breaks into a response, a single server reply may be interpreted as two responses, letting the attacker reshape what the client or proxy believes it received.

This matters because the flaw is not just malformed output, it is a parsing trust failure. The application thinks it is reflecting harmless data, while an upstream cache, browser, or intermediary may treat the injected bytes as new headers or a new response entirely.

Why It Becomes Dangerous

The primary danger is control over response structure. Once an attacker can inject headers or terminate the response early, they may poison caches, spoof content, or influence how downstream systems store and replay the response. That can turn one request into a shared integrity problem across many users.

HTTP response splitting is closely related to other web application injection classes, especially where untrusted input is reflected into protocol syntax. NHIMG’s Web Application Attacks Guide places it alongside request smuggling, cache poisoning, header injection, and other boundary-confusion patterns that abuse parsing differences.

The practical impact varies by deployment. In a simple origin-server scenario, the result may be spoofed pages or broken navigation. In front of shared proxies or caches, the same flaw can create cross-user contamination, making a single malicious response visible to other visitors.

Common Exposure Points and Preconditions

The weakness usually appears where applications copy user input into response headers, redirects, cookies, download names, or other protocol fields without strict validation. Any place that accepts text but later emits it into HTTP syntax is a potential entry point if line breaks are not removed or encoded correctly.

Exposure is often easiest to confirm by tracing input paths, checking whether user-controlled values reach headers, and reviewing whether reverse proxies, CDNs, or application frameworks normalise or reject illegal control characters. Vendor guidance is the authoritative source for product-specific handling, but the core check is always whether untrusted data can affect the response envelope.

Because intermediaries can change how the payload is interpreted, testing should include the full delivery path, not only the application itself. A response that looks safe in one component may still be split or cached incorrectly after it passes through another.

Defensive Controls and Validation Patterns

Prevention starts with strict canonicalisation of response data before it reaches any header-writing code. The safest pattern is to reject or neutralise carriage return and line feed characters in any user-influenced value that could be emitted into HTTP metadata.

Response construction should use framework-safe APIs rather than string concatenation, and header-setting functions should enforce valid syntax by design. Where possible, security teams should also review cache-control behaviour, since poisoning often depends on whether a malicious response can be stored and replayed.

When the issue sits in a library or framework, remediation may require a dependency update or a code-path change rather than a configuration tweak. In the meantime, compensating controls such as input validation, output encoding, and tightened proxy behaviour can reduce exposure but do not eliminate the flaw if the application still emits raw line breaks.

Risk and Threat Considerations

HTTP response splitting is dangerous because it crosses a trust boundary that defenders often assume is fixed: the shape of the HTTP response itself. That can create cache poisoning, header injection, content spoofing, and in some environments session or navigation manipulation.

Failure mechanism: A malicious value reaches a response header or similar protocol field, inserts line breaks, and causes downstream components to parse attacker-controlled bytes as a separate response or as new headers.

Impact: Shared caches can serve poisoned content to other users, browsers may render attacker-chosen responses, and intermediary systems can distribute corruption far beyond the original request.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP ASVS, CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP ASVS V4 — API and Web Service Response splitting is a web response construction flaw in HTTP services.
V13 — Configuration Secure configuration governs how servers and frameworks handle headers and proxies.
Recommendation — Validate response-building code and reject header-breaking characters before output. Harden server and framework settings to prevent unsafe header generation and proxy rewriting.
CIS Controls v8 CIS-16 — Application Software Security The issue is an application-layer weakness that secure coding and testing should catch.
CIS-13 — Network Monitoring and Defense Poisoned responses and abnormal header patterns can be detected in transit and logs.
Recommendation — Test application output handling for response splitting and fix unsafe header handling. Monitor for anomalous response headers and cache-poisoning indicators in delivery paths.
NIST SP 800-53 Rev 5 SI-10 — Information Input Validation Untrusted input must be validated before it can affect protocol syntax.
Recommendation — Validate and sanitise response-bound data before it reaches header-writing logic.

Practitioner Guidance

What to watch for: Focus review on any code that reflects request parameters into redirects, filenames, cookies, or custom headers. Those are the places where a harmless-looking string becomes a protocol-level security issue if control characters are not blocked.

Common misunderstanding: It is not enough to “escape output” in the HTML sense. Response splitting is an HTTP parsing problem, so the control must be applied before the value reaches the response boundary, not only after it reaches the page body.

Practitioner takeaway: Treat every user-influenced response header as untrusted until the application has proven it cannot contain raw line breaks or other syntax-breaking characters.