Plugin broken vulnerable to sql injection!!!
-
Running 1.36.0 we noticed that our importer was breaking. After looking at the php error log I was shocked to see that the plugin was failing to escape dynamically created SQL statement! Any property with a ‘ in the title was breaking the importer.
WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘s Brand New Townhome Development” at line 1 for query SELECT ID FROM wp_posts where post_title = ‘Jackson’s Brand New Townhome Development’ …
This error occurs on line #4014 of \wp-content\plugins\wp-property\core\premium\class_wpp_property_import.php
You can patch it by replacing line #4014 with
$title = mysql_real_escape_string($data[$data['unique_id']][0]); $post_exists = $wpdb->get_var( "SELECT ID FROM ".$wpdb->posts." where {$data['unique_id']} = '{$title}' " );
This bad coding not only spent our development team hours to track down and fix but it also open a huge hole to SQL injection in our Website!
Don’t believe me? Change the title of one of the properties in your import xml to
‘; update wp_posts set post_title=’this plugin is bad’ where 1=1;#
run the import and see what happens.
- The topic ‘Plugin broken vulnerable to sql injection!!!’ is closed to new replies.