HTTP Response Splitting
What is HTTP Response Splitting?
HTTP Response SplittingAn injection vulnerability where untrusted CR/LF characters in user input force the server to emit additional, attacker-controlled HTTP responses.
HTTP response splitting occurs when an application reflects untrusted input into a response header — commonly Location, Set-Cookie, or a custom header — without neutralising carriage-return (CR, %0d) and line-feed (LF, %0a) bytes. By injecting a CRLF pair the attacker terminates the current header block and appends their own headers, a new status line, or an entire second response body. The technique was formally introduced by Amit Klein of Sanctum in the March 2004 whitepaper "Divide and Conquer: HTTP Response Splitting, Web Cache Poisoning Attacks, and Related Topics," and is catalogued as CWE-113 (Improper Neutralization of CRLF Sequences in HTTP Headers).
The highest-impact outcome is web cache poisoning: if a shared proxy or CDN caches the injected second response, every later visitor to the poisoned URL receives attacker-controlled content, turning a single request into a persistent, cross-user defacement or stored cross-site scripting. Other consequences include session fixation via a forged Set-Cookie, open redirects, and credential disclosure to intermediaries. Modern HTTP/2 framing and most mainstream stacks — Java Servlet, ASP.NET, Node.js — now reject newline characters in their header-setting APIs, which has made classic splitting rare, but it resurfaces wherever custom header code or older runtimes bypass that validation. Defences: never place raw user input in headers, rely on framework redirect and cookie helpers that URL-encode values, and strip or reject CR/LF in any header value before it is written.
flowchart TD
IN[User input in<br/>Location / Set-Cookie] --> CHK{CR/LF filtered}
CHK -->|yes| SAFE[Single valid response]
CHK -->|no| INJ[Inject %0d%0a and<br/>second response]
INJ --> CACHE[Proxy / CDN caches<br/>poisoned response]
CACHE --> VIC[Later visitors get<br/>attacker content]● Examples
- 01
Setting a Location header from a user parameter that contains %0d%0a to inject Set-Cookie.
- 02
Splitting a response so the cache stores an attacker-controlled body for /home.
● Frequently asked questions
What is HTTP Response Splitting?
An injection vulnerability where untrusted CR/LF characters in user input force the server to emit additional, attacker-controlled HTTP responses. It belongs to the Vulnerabilities category of cybersecurity.
What does HTTP Response Splitting mean?
An injection vulnerability where untrusted CR/LF characters in user input force the server to emit additional, attacker-controlled HTTP responses.
How do you defend against HTTP Response Splitting?
Defences for HTTP Response Splitting typically combine technical controls and operational practices, as detailed in the full definition above.
What are other names for HTTP Response Splitting?
Common alternative names include: CRLF injection in HTTP, HTTP header injection.