DefenseCode ThunderScan SAST Advisory: WordPress Form Maker Plugin Multiple Security Vulnerabilities Advisory ID: DC-2018-05-001 Advisory Title: WordPress Form Maker Plugin Multiple Vulnerabilities Advisory URL: http://www.defensecode.com/advisories.php Software: WordPress Form Maker plugin Language: PHP Version: 1.12.24 and below Vendor Status: Vendor contacted, update released Release Date: 2018/06/07 Risk: High 1. General Overview =================== During the security audit of Form Maker plugin for WordPress CMS, multiple vulnerabilities were discovered using DefenseCode ThunderScan application source code security analysis platform. More information about ThunderScan is available at URL: http://www.defensecode.com 2. Software Overview ==================== According to the plugin developers, Form Maker is a power-packed yet user-friendly form builder plugin, best WordPress form builder plugin in WordPress Plugin Directory. According to wordpress.org, it has more than 100 000 active installs. According to the developer's website, it was downloaded over two million times. The exact number of "premium" version installs remains to be determined. Homepage: https://wordpress.org/plugins/form-maker/ https://web-dorado.com/products/wordpress-form.html 3. Vulnerability Description ============================ During the security analysis, ThunderScan discovered SQL injection and Cross-Site Scripting vulnerabilities in Form Maker WordPress plugin. The SQL injection points are susceptible to Cross Site Request Forgery (CSRF). The easiest way to reproduce the SQL injection vulnerabilities is to open the presented HTML/JavaScript snippet in your browser while being logged in as administrator or another user that is authorized to access the plugin settings page. Users that do not have full administrative privileges could abuse the database access the vulnerabilities provide to either escalate their privileges or obtain and modify database contents they were not supposed to be able to. Since the injection points are also susceptible to CSRF (due to the improper checking of the nonce token), a valid attack vector is also to send a link to the administrator that leads to any attacker controlled web page containing such or similar code snippet. The Cross-Site Scripting vulnerabilities can enable the attacker to construct the URL that contains malicious JavaScript code. If the administrator of the site makes a request to such an URL, the attacker's code will be executed, with unrestricted access to the WordPress site in question. The attacker can entice the administrator to visit the URL in various ways, including sending the URL by email, posting it as a part of the comment on the vulnerable site or another forum. 3.1 SQL injection Vulnerable Function: get_results() Vulnerable Variable: $_POST['name'] Vulnerable URL: http://vulnerablesite.com/wp-admin/admin-ajax.php?action=FormMakerSQLMapping&task=db_table_struct File: form-maker/admin/models/FMSqlMapping.php Proof of Concept: See Appendix #1 --------- 81 $name = isset($_POST['name']) ? $_POST['name'] : NULL; ... 87 $query = "SHOW COLUMNS FROM " . $name; ... 94 $table_struct = $wpdb_temp->get_results($query); --------- 3.2 SQL injection Vulnerable Function: get_col() Vulnerable Variable: $_REQUEST['search_labels'] Vulnerable URL: http://vulnerablesite.com/wp-admin/admin-ajax.php?form_id=6&send_header=0&action=generete_csv&limitstart=0 File: form-maker/framework/WDW_FM_Library.php Proof of Concept: See Appendix #2 --------- 3901 $search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : ''; ... 3934 $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d and group_id IN(" . $search_labels . ")", $form_id); 3935 $group_id_s = $wpdb->get_col($query); --------- 3.3 Cross-Site Scripting Vulnerable Function: echo() Vulnerable Variable: $_REQUEST["active_tab"] Vulnerable URL: http://vulnerablesite.com/wp-admin/admin.php?page=themes_fm&task=edit&active_tab="> File: form-maker/admin/views/Themes_fm.php --------- 192 $active_tab = isset($_REQUEST["active_tab"]) && $_REQUEST["active_tab"] ? $_REQUEST["active_tab"] : ($row->version == 1 ? 'custom_css' : 'global'); ... 199 --------- 3.4 Cross-Site Scripting Vulnerable Function: echo() Vulnerable Variable: $_REQUEST["pagination"] Vulnerable URL: http://vulnerablesite.com/wp-admin/admin.php?page=themes_fm&task=edit&pagination="> 9. Appendix #2 - SQLi PoC snippet =================================