WordPress Plugin Vulnerabilities

Yes/No Chart < 1.0.12 - Authenticated (contributor+) Blind SQL Injection

Description

The plugin did not sanitise its sid shortcode parameter before using it in a SQL statement, allowing medium privilege users (contributor+) to perform Blind SQL Injection attacks

Proof of Concept

To exploit, the site administrator must add a question set and a question first. (This requirement is usually met for all installations, as this plugin does not function without this.)

Users as low as contributors can then use a shortcode to cause blind SQL injection, which can be used to extract data by checking if the error message returned says "invalid ID" or "no question".

This proof of concept shortcode can be added and previewed to check if a user "teacher" is registered, given db prefix "wp_dbprefix_":

[yesno_chart sid="9999999 UNION SELECT 4,user_login,user_registered FROM wp_dbprefix_users WHERE user_login='teacher'"]

If this shows "Invalid Question Set ID." when previewed, the WHERE clause for the UNION SELECT is evaluated FALSE. If this shows "No question.", the WHERE clause is evaluated TRUE. If this is not reliable, choose larger integers instead of 9999999. (the vulnerable WHERE clause must be evaluated FALSE.)

Of course, the attacker can issue arbitrary WHERE clause checks on arbitrary tables, so this is a reliable blind SQL injection.

Note:  this cannot be exploited as a non-blind SQLi, as the code that is just below the injection point uses prepared statement, and triggers a error before showing extracted data.

Affects Plugins

Fixed in 1.0.12

References

Classification

Type
SQLI
OWASP top 10
CWE
CVSS

Miscellaneous

Original Researcher
apple502j
Submitter
apple502j
Verified
Yes

Timeline

Publicly Published
2021-05-31 (about 2 years ago)
Added
2021-05-31 (about 2 years ago)
Last Updated
2021-06-01 (about 2 years ago)

Other