Skip to content
XSS Write-up Intermediate

Cache Poisoning via SelfXSS + Path Parameter

A JSP page reflected the X-Forwarded-For header without sanitisation, allowing self-XSS. By appending a path parameter ending in .css, the attacker tricked a caching proxy into storing the response as a CSS file, turning the self-XSS into a cached stored XSS.

ElMahdi Mrhassel Follow

Published on web.archive.org

« 2021/08 »

ElMahdi Mrhassel (@ElMrhassel), on web.archive.org

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 the X-Forwarded-For header without sanitisation, and the caching proxy used the URL extension to decide how to cache the response, ignoring the path parameter.

Impact

An attacker could poison the cache so that other visitors receive a response containing the XSS payload, turning a self-XSS into a stored XSS affecting multiple users.

What the attacker needed

Target uses a caching proxy; JSP application reflects X-Forwarded-For; attacker can send crafted requests

How it was found

  1. Find a JSP file that returns the visitor IP and reflects the X-Forwarded-For header.
  2. Confirm the header value is reflected, creating self-XSS.
  3. Try cache-key manipulation and cache deception tricks, which did not work.
  4. Use a Java path parameter ending in .css so the proxy caches the response as CSS.
  5. Send a request with the XSS payload in X-Forwarded-For and the path parameter in the URL.

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.

Self-XSS only affects the person who enters the malicious input, so it is usually low impact. Here the attacker found that a proxy in front of the site would save (cache) the page as a CSS file because of a trick in the URL. That meant the malicious script was served to other visitors from the cache, making it a stored XSS.

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 ElMahdi Mrhassel

View all

4 more disclosed reports, best first.

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.