[mercantile.wordpress.org] Reflected XSS
A reflected cross-site scripting flaw existed on a WordPress site's search page, where a crafted query string was rendered by Angular and executed as a template expression. A second XSS issue was found in the discount code field on the checkout page, allowing script execution in a victim's browser.
- Triaged in under an hour
- Fixed in 5 months
- Paid in 5 months
- Disclosed after 14 months
Summary by the program
@zee_shan found a bypass for #230234. Payload used :
{{constructor.constructor('alert(document.domain)')()}}
URL to trigger XSS : https://mercantile.wordpress.org/?s=%26%23123%3B%26%23123%3Bconstructor.constructor%28%27alert%28document.domain%29%27%29%28%29%7D%7D&post_type=product
Soon after another XSS issue on the /checkout endpoint: mercantile.wordpress.org/checkout/
Have a discount code? Enter it here is vulnerable. You can use this payload to trigger XSS:
{{constructor.constructor('alert(document.domain)')()}}
Due to a collection of similar reports and @zee_shan's findings we did a full audit on the site that resulted in ripping out all of the Angular code and replacing it with other solutions, which took several months to complete. During that time a bounty was awarded and when when it was completed @zee_shan confirmed that the issues were fixed and they saw no additional bypasses.
Full disclosure was requested by WordPress, but @zee_shan preferred partial disclosure with a summary.
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
Likely the Angular template engine was evaluating user-controlled input as an expression rather than treating it as plain text, and the earlier fix for a related report did not cover all input paths.
Impact
An attacker could run script in a victim's browser on the affected pages, though the report does not describe any further actions taken with it.
What the attacker needed
Victim opens a crafted link; or victim enters crafted discount code
The fix
The site's Angular code was removed and replaced with other solutions, and the reporter confirmed the issues were fixed with no further bypasses.
How it was found
- Open the site's search page with a crafted query string in the s parameter
- The page renders the input through Angular and the expression executes
- On the checkout page, enter a crafted value in the discount code field
- The value is evaluated and the script runs
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.
XSS is when a site puts visitor input into the page unsafely, so the browser runs it as code. Here Angular evaluated crafted text as a template, so a crafted link could run the attacker's script in the victim's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.