SQL Injection, SQLi, CWE-89, ads2.adbrite.com, Null Byte

Null Byte SQL Injection in ads2.adbrite.com | Vulnerability Crawler Report

Report generated by CloudScan Vulnerability Crawler at Sat Jan 29 08:21:59 CST 2011.



DORK CWE-79 XSS Report

Loading

1. SQL injection

2. Cookie without HttpOnly flag set



1. SQL injection  next

Summary

Severity:   High
Confidence:   Tentative
Host:   http://ads2.adbrite.com
Path:   /v0/ad

Issue detail

The zs parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the zs 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.

The application attempts to block SQL injection attacks but this can be circumvented by submitting a URL-encoded NULL byte (%00) before the characters that are being blocked.

Remediation detail

NULL byte bypasses typically arise when the application is being defended by a web application firewall (WAF) that is written in native code, where strings are terminated by a NULL byte. You should fix the actual vulnerability within the application code, and if appropriate ask your WAF vendor to provide a fix for the NULL byte bypass.

Issue background

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:

Request 1

GET /v0/ad?sid=1198099&zs=3732385f3930%00'&ifr=2&ref=http%3A%2F%2Fwww.bostonherald.com%2Fincludes%2FprocessAds.bg%3Fposition%3DBottom%26companion%3DTop%2CMiddle%2CMiddle1%2CBottom%26page%3Dbh.heraldinteractive.com%252Ftrack%252Fhome&zx=0&zy=0&ww=0&wh=0&fl=1 HTTP/1.1
Host: ads2.adbrite.com
Proxy-Connection: keep-alive
Referer: http://d3.zedo.com/jsc/d3/ff2.html?n=951;c=2;s=2;d=14;w=728;h=90;$=burst728x90
Accept: */*
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 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: Apache=168362173x0.688+1294536261x899753879; cv=1%3Aq1ZyLi0uyc91zUtWslIySyktr0nPLLDMMi8zrjGwMswuNjMusjK0MlCqBQA%3D; ut=1%3Aq1YqM1KyqlbKTq0szy9KKVayUsotTzQprDHMLja3sKwxrTE0z9dJzsiwSC%2BoysmrMczJSS%2BqqjGsMYAJZuUgCSrpKCUl5uWlFmWCjVKqrQUA; vsd="0@1@4d430048@searchportal.information.com"; rb="0:712156:20822400:6ch47d7o8wtv:0:742697:20828160:3011330574290390485:0:753292:20858400:CA-00000000456885722:0:762701:20861280:D8DB51BF08484217F5D14AB47F4002AD:0:806205:20861280:21d8e954-2b06-11e0-8e8a-0025900870d2:0"; srh=1%3Aq64FAA%3D%3D

Response 1

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Cache-Control: no-cache, no-store, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
P3P: policyref="http://files.adbrite.com/w3c/p3p.xml",CP="NOI PSA PSD OUR IND UNI NAV DEM STA OTC"
Content-Type: text/html;charset=utf-8
Content-Length: 1000
Date: Sat, 29 Jan 2011 01:56:24 GMT
Connection: close

<html><head><title>Apache Tomcat/6.0.18 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans
...[SNIP]...

Request 2

GET /v0/ad?sid=1198099&zs=3732385f3930%00''&ifr=2&ref=http%3A%2F%2Fwww.bostonherald.com%2Fincludes%2FprocessAds.bg%3Fposition%3DBottom%26companion%3DTop%2CMiddle%2CMiddle1%2CBottom%26page%3Dbh.heraldinteractive.com%252Ftrack%252Fhome&zx=0&zy=0&ww=0&wh=0&fl=1 HTTP/1.1
Host: ads2.adbrite.com
Proxy-Connection: keep-alive
Referer: http://d3.zedo.com/jsc/d3/ff2.html?n=951;c=2;s=2;d=14;w=728;h=90;$=burst728x90
Accept: */*
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 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: Apache=168362173x0.688+1294536261x899753879; cv=1%3Aq1ZyLi0uyc91zUtWslIySyktr0nPLLDMMi8zrjGwMswuNjMusjK0MlCqBQA%3D; ut=1%3Aq1YqM1KyqlbKTq0szy9KKVayUsotTzQprDHMLja3sKwxrTE0z9dJzsiwSC%2BoysmrMczJSS%2BqqjGsMYAJZuUgCSrpKCUl5uWlFmWCjVKqrQUA; vsd="0@1@4d430048@searchportal.information.com"; rb="0:712156:20822400:6ch47d7o8wtv:0:742697:20828160:3011330574290390485:0:753292:20858400:CA-00000000456885722:0:762701:20861280:D8DB51BF08484217F5D14AB47F4002AD:0:806205:20861280:21d8e954-2b06-11e0-8e8a-0025900870d2:0"; srh=1%3Aq64FAA%3D%3D

Response 2

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: no-cache, no-store, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
P3P: policyref="http://files.adbrite.com/w3c/p3p.xml",CP="NOI PSA PSD OUR IND UNI NAV DEM STA OTC"
Set-Cookie: b=%3A%3Apogj; Domain=.adbrite.com; Expires=Sun, 29-Jan-2012 01:56:25 GMT; Path=/
Set-Cookie: geo=1%3ADchLDoMwDEXRvXhcJMcKVGEKrCDtAhK7IAYFxKcDEHvvm1wd3Yt%2BjuqLznGhmoSZXYEK04P2E6uLL9C%2BCS6dg3U%2B4HcE12EC2wbcxgHs2UJ%2BZp9LCxJUVFPyqTLr9VOJ93Tffw%3D%3D; Domain=.adbrite.com; Expires=Sat, 05-Feb-2011 01:56:25 GMT; Path=/
Set-Cookie: vsd="0@1@4d4373c9@d3.zedo.com"; Version=1; Domain=.adbrite.com; Max-Age=172800; Path=/
Content-Type: application/x-javascript
Date: Sat, 29 Jan 2011 01:56:25 GMT
Connection: close
Content-Length: 376

document.writeln("<script language=\"JavaScript\">");
document.writeln("var zflag_nid=\"951\"; var zflag_cid=\"2\"; var zflag_sid=\"2\"; var zflag_width=\"728\"; var zflag_height=\"90\"; var zflag_sz=
...[SNIP]...

2. Cookie without HttpOnly flag set  previous

Summary

Severity:   Low
Confidence:   Firm
Host:   http://ads2.adbrite.com
Path:   /favicon.ico

Issue detail

The following cookie was issued by the application and does not have the HttpOnly flag set:The cookie appears to contain a session token, which may increase the risk associated with this issue. You should review the contents of the cookie to determine its function.

Issue background

If the HttpOnly attribute is set on a cookie, then the cookie's value cannot be read or set by client-side JavaScript. This measure can prevent certain client-side attacks, such as cross-site scripting, from trivially capturing the cookie's value via an injected script.

Issue remediation

There is usually no good reason not to set the HttpOnly flag on all cookies. Unless you specifically require legitimate client-side scripts within your application to read or set a cookie's value, you should set the HttpOnly flag by including this attribute within the relevant Set-cookie directive.

You should be aware that the restrictions imposed by the HttpOnly flag can potentially be circumvented in some circumstances, and that numerous other serious attacks can be delivered by client-side script injection, aside from simple cookie stealing.

Request

GET /favicon.ico HTTP/1.1
Host: ads2.adbrite.com
Proxy-Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 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: Apache=168362173x0.688+1294536261x899753879; cv=1%3Aq1ZyLi0uyc91zUtWslIySyktr0nPLLDMMi8zrjGwMswuNjMusjK0MlCqBQA%3D; ut=1%3Aq1YqM1KyqlbKTq0szy9KKVayUsotTzQprDHMLja3sKwxrTE0z9dJzsiwSC%2BoysmrMczJSS%2BqqjGsMYAJZuUgCSrpKCUl5uWlFmWCjVKqrQUA; vsd="0@1@4d430048@searchportal.information.com"; rb="0:712156:20822400:6ch47d7o8wtv:0:742697:20828160:3011330574290390485:0:753292:20858400:CA-00000000456885722:0:762701:20861280:D8DB51BF08484217F5D14AB47F4002AD:0:806205:20861280:21d8e954-2b06-11e0-8e8a-0025900870d2:0"; srh=1%3Aq64FAA%3D%3D

Response

HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=61FCC3DEA075A87386A0EA6878423D23; Path=/
Location: http://bounce.adbrite.com/
Content-Type: text/html
Date: Sat, 29 Jan 2011 14:20:55 GMT
Connection: close


Report generated by CloudScan Vulnerability Crawler at Sat Jan 29 08:21:59 CST 2011.