Technical Analysis
The WooCommerce product importer only protected the first step (file upload) with a nonce, leaving later steps like import unprotected. An attacker could trick an administrator into visiting a malicious site that submits a crafted request to the import step, which generates a valid nonce and imports a CSV file containing unsanitised HTML, leading to stored XSS in product descriptions.
blog.ripstech.com
Published on blog.ripstech.com
In WooCommerce shop managers and administrators have the ability to import (insert/update) products via a .csv file. Every product in WooCommerce has a product description where the shop manager can insert limited HTML, i.e. very basic HTML tags and attributes, such as the <a> tag in combination with the href…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could execute arbitrary JavaScript in the browser of the administrator who triggered the CSRF or any visitor of the shop, potentially leading to PHP code execution if the administrator has file editing enabled.
What the attacker needed
Attacker has author role or higher; victim is an administrator; victim visits malicious site
How it was found
- The attacker uploads a CSV file containing a product with malicious HTML in the description, using an account with author role or higher.
- The attacker tricks an administrator into visiting a malicious website.
- The malicious website causes the administrator's browser to send a request to the import step of the WooCommerce importer.
- The import step generates a valid nonce and enqueues JavaScript that sends an AJAX request with attacker-controlled parameters.
- The AJAX request imports the CSV file, storing the malicious HTML in the product description.
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 write-up has not been written yet. The Original tab links to the source.
A nonce is a one-time code used to prove a request came from the site's own pages, not from an attacker. Here, only the first step of importing products checked this code, so an attacker could skip that step and make the site perform the import without the victim knowing. The imported product descriptions could contain malicious JavaScript that runs when anyone views the product.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.