SQL Injection, DORK, mediapost.com, Single Quote, Database Error

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

Report generated by XSS.CX at Sun Mar 13 07:19:58 CDT 2011.

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

XSS Crawler | SQLi Crawler | HTTPi Crawler | FI Crawler
Loading

1. SQL injection



1. SQL injection

Summary

Severity:   High
Confidence:   Firm
Host:   http://www.mediapost.com
Path:   /publications/

Issue detail

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

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

GET /publications/?fa=Articles.showArticle&art_aid=109859' HTTP/1.1
Host: www.mediapost.com
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
Date: Sun, 13 Mar 2011 03:07:02 GMT
Server: Apache/2.2.15 (Unix) DAV/2 PHP/5.3.2 with Suhosin-Patch mod_ssl/2.2.15 OpenSSL/1.0.0a mod_wsgi/3.2 Python/2.6.5 JRun/4.0
server-error: true
Set-Cookie: SESSIONSCOPETESTED=0;path=/
Set-Cookie: HASSESSIONSCOPE=0;path=/
Set-Cookie: SESSIONSCOPETESTED=1;path=/
Set-Cookie: HASSESSIONSCOPE=1;path=/
Set-Cookie: CFID=19856214;expires=Tue, 05-Mar-2041 03:07:02 GMT;path=/
Set-Cookie: CFTOKEN=79987848;expires=Tue, 05-Mar-2041 03:07:02 GMT;path=/
Set-Cookie: LASTVISIT=%7Bts%20%272011%2D03%2D12%2022%3A07%3A02%27%7D;domain=.mediapost.com;expires=Mon, 12-Mar-2012 03:07:02 GMT;path=/
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: 5901


                                                           
...[SNIP]...
<font style="COLOR: black; FONT: 8pt/11pt verdana">
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 art_state ' at line 42

...[SNIP]...

Report generated by XSS.CX at Sun Mar 13 07:19:58 CDT 2011.