Skip to content
XSS Write-up Intermediate

Mirror, Mirror in the Cache: The Day I Became a Digital Pickpocket

A reflected input endpoint was cached by a CDN, allowing cache poisoning with a script payload that could steal authentication tokens. The stolen tokens then gave access to a GraphQL endpoint that exposed sensitive user data including PII and credit card details.

infosecwriteups.com

Published on infosecwriteups.com

Free link ๐ŸŽˆ

Iski, on infosecwriteups.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 application reflected user input without proper sanitisation and the CDN cached responses without varying on user input, allowing stored XSS via cache poisoning; additionally the GraphQL endpoint lacked proper authorisation checks.

Impact

Any user loading the cached endpoint could have their authentication tokens stolen, leading to exposure of PII and credit card information via the GraphQL endpoint.

What the attacker needed

Victim visits the cached endpoint; attacker can send requests to the reflect endpoint

How it was found

  1. Perform subdomain reconnaissance to find mirror-api.target.com.
  2. Send a GET request to the reflect endpoint with a test input and observe it is reflected in the response.
  3. Discover the GraphQL endpoint and run an introspection query to find getUserDataById.
  4. Craft a request with a script payload in the input parameter and a spoofed X-Forwarded-Host header to poison the cache.
  5. Use stolen tokens to query getUserDataById and retrieve sensitive 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 write-up has not been written yet. The Original tab links to the source.

The website had a page that echoed back whatever you typed into it, and a caching system stored that response for everyone. An attacker could put malicious code in the echoed text, and because it was cached, other users would receive that code and have their login tokens stolen. Those tokens then allowed the attacker to query a database and retrieve personal information.

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.