Stored XSS on Broken Themes via filename
A WordPress theme whose folder name contains HTML markup is shown unescaped on the broken themes page, so the markup runs as script in the admin's browser. An attacker who can place a theme folder with a crafted name could execute stored cross-site scripting against an administrator viewing that page.
Originally disclosed on HackerOne
- Triaged in 35 hours
- Fixed in 21 months
- Paid in 20 months
- Disclosed after 24 months
Hi, I've found something here,
##Description XSS Stored because filename of theme when broken, So when theme is broken, Wordpress will inform the name of theme who has been broken which is the folder name of theme and inform the error with description message.

Looks like the filename is reflected, on the Name of the detail broken themes. I try to rename the folder to malicious name ( payload : <img src=x onerror=alert(1)> ) and the payload it'll be execute.

##POC
- Upload theme
- Delete the style.css ( or you can make new folder on theme path with payload name )
- Rename the folder to
<img src=x onerror=alert(1)> - See theme page.
##Video https://youtu.be/IuJrcR_BoKo
Impact
XSS will be execute , because the filename is stored on page without any filter, and this is possible to make stored XSS.
It'll be good to filter / encoding the illegal character, like wordpress do on themes upload.
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 broken-themes page outputs the theme folder name without HTML encoding, so markup in the name is rendered as HTML.
Impact
Script in the theme folder name executes when the broken themes page is viewed.
What the attacker needed
Ability to create or rename a theme folder
The fix
The theme name should be filtered or encoded before output, as WordPress already does for theme uploads.
How it was found
- Upload a theme.
- Delete the theme's style.css so the theme is reported as broken, or create a new folder in the themes path with a crafted name.
- Rename the theme folder to a name containing HTML markup.
- Open the themes page and observe the markup executing.
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.
A theme is a set of files that changes how a WordPress site looks, and it lives in a folder whose name WordPress displays. When a theme is broken, WordPress shows that folder name on a page, but it does not treat the name as plain text. If the name contains HTML, the browser runs it as code, which is cross-site scripting (XSS): an attacker's code runs 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.