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 97555%0d%0ab0ea879d6b5 was submitted in the REST URL parameter 1. This caused a response containing an injected HTTP header.
<head><title>Document Moved</title></head> <body><h1>Object Moved</h1>This document may be found <a HREF="http://www.barnesandnoble.com/97555 b0ea879d6b5">here</a></body>
The value of REST URL parameter 1 is copied into the Location response header. The payload 6eda5%0d%0ae32a4fcbfc8 was submitted in the REST URL parameter 1. This caused a response containing an injected HTTP header.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>301 Moved Permanently</TITLE> </HEAD><BODY> <H1>Moved Permanently</H1> The document has moved <A HREF="http://www.classmates.com/ ...[SNIP]...
The value of REST URL parameter 1 is copied into the Location response header. The payload 30439%0d%0a124cce508db was submitted in the REST URL parameter 1. This caused a response containing an injected HTTP header.
HTTP/1.1 301 Moved Permanently Date: Thu, 31 Mar 2011 18:57:26 GMT Server: Apache/2.0.58 (Unix) Location: http://www.mtv.com/30439 124cce508db Content-Length: 316 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.mtv.com/3043 ...[SNIP]...
The value of REST URL parameter 1 is copied into the Location response header. The payload dfcf0%0d%0a0602074a1b9 was submitted in the REST URL parameter 1. This caused a response containing an injected HTTP header.
The value of REST URL parameter 1 is copied into the Location response header. The payload eac6e%0d%0aed1f44f943 was submitted in the REST URL parameter 1. This caused a response containing an injected HTTP header.
<!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.people.com/e ...[SNIP]...
Report generated by XSS.CX at Thu Mar 31 14:07:10 CDT 2011.