SQL Injection, DORK, CWE-89, CAPEC-66, 2-1-2011

SQL Injection Report for 2-1-2011 | Vulnerability Crawler Details

Report generated by CloudScan Vulnerability Crawler at Fri Feb 04 13:42:37 CST 2011.

Public Domain Vulnerability Information, Security Articles, Vulnerability Reports, GHDB, DORK Search

XSS Home | XSS Crawler | SQLi Crawler | HTTPi Crawler | FI Crawler |

Loading

1. SQL injection

1.1. http://www.learningsolutions.com.hk/index.php [User-Agent HTTP header]

1.2. http://www.thestandard.com.hk/news_detail.asp [art_id parameter]

1.3. http://www.youtube.com/ [Referer HTTP header]



1. SQL injection
There are 3 instances of this issue:

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:



1.1. http://www.learningsolutions.com.hk/index.php [User-Agent HTTP header]  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://www.learningsolutions.com.hk
Path:   /index.php

Issue detail

The User-Agent HTTP header appears to be vulnerable to SQL injection attacks. A single quote was submitted in the User-Agent HTTP header, 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 /index.php HTTP/1.1
Host: www.learningsolutions.com.hk
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'
Connection: close

Response 1

HTTP/1.1 200 OK
Date: Thu, 03 Feb 2011 01:56:42 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.13
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: f6f411d73f2e572e53afd5afb059105f=-; path=/
Set-Cookie: lang=deleted; expires=Wed, 03-Feb-2010 01:56:43 GMT; path=/
Set-Cookie: mbfcookie=deleted; expires=Wed, 03-Feb-2010 01:56:43 GMT; path=/
Set-Cookie: mbfcookie[lang]=en; expires=Fri, 04-Feb-2011 01:56:44 GMT; path=/
Last-Modified: Thu, 03 Feb 2011 01:56:44 GMT
Connection: close
Content-Type: text/html
Content-Length: 24854


<!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">

<head>

<title>Learning Solutio
...[SNIP]...
</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>
...[SNIP]...

Request 2

GET /index.php HTTP/1.1
Host: www.learningsolutions.com.hk
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)''
Connection: close

Response 2

HTTP/1.1 200 OK
Date: Thu, 03 Feb 2011 01:56:45 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.13
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: f6f411d73f2e572e53afd5afb059105f=-; path=/
Set-Cookie: lang=deleted; expires=Wed, 03-Feb-2010 01:56:44 GMT; path=/
Set-Cookie: mbfcookie=deleted; expires=Wed, 03-Feb-2010 01:56:44 GMT; path=/
Set-Cookie: mbfcookie[lang]=en; expires=Fri, 04-Feb-2011 01:56:45 GMT; path=/
Last-Modified: Thu, 03 Feb 2011 01:56:45 GMT
Connection: close
Content-Type: text/html
Content-Length: 24436


<!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">

<head>

<title>Learning Solutio
...[SNIP]...

1.2. http://www.thestandard.com.hk/news_detail.asp [art_id parameter]  previous  next

Summary

Severity:   High
Confidence:   Firm
Host:   http://www.thestandard.com.hk
Path:   /news_detail.asp

Issue detail

The art_id parameter appears to be vulnerable to SQL injection attacks. The payload ' was submitted in the art_id 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 Microsoft SQL Server.

Remediation detail

The application should handle errors gracefully and prevent SQL error messages from being returned in responses.

Request

GET /news_detail.asp?we_cat=4&art_id=107529'&sid=31063765&con_type=1&d_str=20110127&fc=4 HTTP/1.1
Host: www.thestandard.com.hk
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.1 500 Internal Server Error
Connection: close
Date: Thu, 03 Feb 2011 01:57:33 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 339
Content-Type: text/html
Set-Cookie: ASPSESSIONIDSSCSSRSQ=CABDPJKADHMKIKHPIDDLPNCO; path=/
Cache-control: private


<html>

<HTML>
<font face="Arial" size=2>
<p>Microsoft OLE DB Provider for ODBC Drivers</font> <font face="Arial" size=2>error '80040e21'</font>
<p>
<font face="Arial" size=2>ODBC driver does no
...[SNIP]...

1.3. http://www.youtube.com/ [Referer HTTP header]  previous

Summary

Severity:   High
Confidence:   Tentative
Host:   http://www.youtube.com
Path:   /

Issue detail

The Referer HTTP header appears to be vulnerable to SQL injection attacks. A single quote was submitted in the Referer HTTP header, 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 double URL-encoding the blocked characters - for example, by submitting %2527 instead of the ' character.

Remediation detail

There is probably no need to perform a second URL-decode of the value of the Referer HTTP header as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.

Request 1

GET /?q=bluefin+tuna&hl=en&tab=n1 HTTP/1.1
Host: www.youtube.com
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close
Referer: http://www.google.com/search?hl=en&q=%2527

Response 1

HTTP/1.1 200 OK
Date: Thu, 03 Feb 2011 01:57:33 GMT
Server: Apache
X-Content-Type-Options: nosniff
Set-Cookie: use_hitbox=72c46ff6cbcdb7c5585c36411b6b334edAEAAAAw; path=/; domain=.youtube.com
Set-Cookie: VISITOR_INFO1_LIVE=m0XBBtAthZY; path=/; domain=.youtube.com; expires=Sat, 01-Oct-2011 01:57:33 GMT
Set-Cookie: PREF=f1=50000000; path=/; domain=.youtube.com; expires=Sun, 31-Jan-2021 01:57:33 GMT
Set-Cookie: GEO=bc7103ce4190df0c025f1e8acab27b75cwsAAAAzR0KtwdbzTUoLjQ==; path=/; domain=.youtube.com
Expires: Tue, 27 Apr 1971 19:44:06 EST
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8
Connection: close

<!DOCTYPE html>
<html lang="en" dir="ltr" >
<!-- machid: nLThsU052OXJEdFhQTnNRNnZmYTRhLTdpdTd2UVBWaGsyWG5nbkZqNmZZcVNDM3RNTEtlWTJ3 -->
<head>
<script>
var yt = yt || {};

yt.timing
...[SNIP]...
<img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" title="Ultimate Caption FAIL, FAIL" data-thumb="//i1.ytimg.com/vi/hVNrkXM3TTI/default.jpg" alt="Thumbnail" class="" onmousedown="yt.analytics.urchinTracker('/Events/Home/PersonalizedHome/TOP/Logged_Out/28');" >
...[SNIP]...

Request 2

GET /?q=bluefin+tuna&hl=en&tab=n1 HTTP/1.1
Host: www.youtube.com
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close
Referer: http://www.google.com/search?hl=en&q=%2527%2527

Response 2

HTTP/1.1 200 OK
Date: Thu, 03 Feb 2011 01:57:33 GMT
Server: Apache
X-Content-Type-Options: nosniff
Set-Cookie: use_hitbox=72c46ff6cbcdb7c5585c36411b6b334edAEAAAAw; path=/; domain=.youtube.com
Set-Cookie: VISITOR_INFO1_LIVE=7W9y3yp9dBk; path=/; domain=.youtube.com; expires=Sat, 01-Oct-2011 01:57:33 GMT
Set-Cookie: PREF=f1=50000000; path=/; domain=.youtube.com; expires=Sun, 31-Jan-2021 01:57:33 GMT
Set-Cookie: GEO=bc7103ce4190df0c025f1e8acab27b75cwsAAAAzR0KtwdbzTUoLjQ==; path=/; domain=.youtube.com
Expires: Tue, 27 Apr 1971 19:44:06 EST
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8
Connection: close

<!DOCTYPE html>
<html lang="en" dir="ltr" >
<!-- machid: nLThsU052OXJEdFZ1el9MdThWQy1DcWhubzU0LXdXb18zOW5TYkdOeWdFc3dZV1JacW5PM3Bn -->
<head>
<script>
var yt = yt || {};

yt.timing
...[SNIP]...

Report generated by CloudScan Vulnerability Crawler at Fri Feb 04 13:42:37 CST 2011.