WordPress Plugin Vulnerabilities

Quiz And Survey Master < 7.1.12 - Authenticated SQL injection via shortcode

Description

The plugin did not sanitise the result_id GET parameter on pages with the [qsm_result] shortcode without id attribute, concatenating it in a SQL statement and leading to an SQL injection. The lowest role allowed to use this shortcode in post or pages being author, such user could gain unauthorised access to the DBMS. If the shortcode (without the id attribute) is embed on a public page or post, then unauthenticated users could exploit the injection.

Proof of Concept

https://drive.google.com/file/d/1axeL8lGH1gFSOEoOFtgGV6xsrNlxJXQB/view?usp=sharing

As an author, create a post/page with the shortcode [qsm_result], view the created page/post and append ?result_id=0 or sleep(2)

// https://plugins.svn.wordpress.org/quiz-master-next/tags/7.1.10/php/classes/class-qmn-quiz-manager.php
public function shortcode_display_result($atts){
        extract(shortcode_atts(array(
            'id' => 0,
                        ), $atts));
        ob_start();
        if($id == 0){
            $id = isset($_GET['result_id']) ? $_GET['result_id'] : 0;
        }
        global $wpdb;
        $result_data = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = {$id}", ARRAY_A);
...
}

Affects Plugins

Fixed in 7.1.12

References

Classification

Type
SQLI
OWASP top 10
CWE
CVSS

Miscellaneous

Original Researcher
Nguyen Van Khanh - SunCSR (Sun* Cyber Security Research)
Submitter
khanh
Verified
Yes

Timeline

Publicly Published
2021-03-26 (about 3 years ago)
Added
2021-03-26 (about 3 years ago)
Last Updated
2021-03-28 (about 3 years ago)

Other