Skip to content
XSS Write-up Intermediate

How Three Low-Severity Bugs Chained Into One-Click XSS

The blog page used a URL slug to build a fetch path without normalisation, allowing client-side path traversal to reach an open redirect endpoint. That endpoint accepted protocol-relative URLs and redirected to an attacker server, whose JSON response was rendered via innerHTML, enabling one-click XSS and token theft from localStorage.

medium.com

Published on medium.com

Chain → CSPT pivots the fetcher to the redirect endpoint, the redirect endpoint sends it to my server, my server returns JSON with a malicious blog.Content, and the page happily renders it as HTML on the target origin.

dot., on medium.com

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

Root cause

Likely the combination of unnormalised slug concatenation into a fetch path, a redirect filter that only checked for http:// or https:// prefixes instead of parsing the URL, and rendering API content with innerHTML.

Impact

An attacker could execute script on the target origin with one click, read the token from localStorage, and perform authenticated actions such as changing the victim's bio, potentially leading to account takeover.

What the attacker needed

Victim clicks a crafted link; victim is logged in with token in localStorage; attacker controls an external server

The fix

The report recommends normalising or validating slugs before concatenation, parsing redirect_to as a URL and allow-listing hosts or rejecting external origins, and rendering content with innerText or sanitising it with a library like DOMPurify.

How it was found

  1. Visit the crafted blog URL containing encoded traversal and redirect parameters.
  2. The client builds a fetch to the redirect endpoint with the attacker's redirect_to value.
  3. The server responds with a redirect to the attacker's server.
  4. The attacker's server returns JSON with a malicious blog.Content field.
  5. The page renders that content via innerHTML, executing script on the target origin.

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 web page took part of the address bar and used it to request data from the site's own API. Because it did not clean that value, an attacker could make the request go to a different API endpoint that redirects anywhere. That endpoint then sent the browser to an attacker's server, which returned data containing HTML and script. The page inserted that data as HTML, so the script ran as if it came from the real site and could read the user's login token.

What is XSS?

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

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.