Skip to content
XSS Disclosed report Intermediate

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.

apapedulimu Follow

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.

Screen_Shot_2018-09-06_at_1.25.01_PM.png
Screen_Shot_2018-09-06_at_1.25.01_PM.png From the original on HackerOne

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.

Screen_Shot_2018-09-06_at_1.32.24_PM.png
Screen_Shot_2018-09-06_at_1.32.24_PM.png From the original on HackerOne

##POC

  1. Upload theme
  2. Delete the style.css ( or you can make new folder on theme path with payload name )
  3. Rename the folder to <img src=x onerror=alert(1)>
  4. 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.

The original report as published on HackerOne, by apapedulimu. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. Upload a theme.
  2. 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.
  3. Rename the theme folder to a name containing HTML markup.
  4. 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.

More by apapedulimu

View all

9 more disclosed reports, best first.

More from WordPress

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.