Skip to content
XSS Write-up Advanced

Smashing the token limit with overlapping fragments

A CSS injection technique can exfiltrate long tokens by collecting overlapping short fragments and stitching them together, rather than using recursive stylesheet imports. An attacker could recover tokens hundreds of characters long with a single stylesheet.

portswigger.net

Published on portswigger.net

I'm delighted to introduce Alex, my fellow swigger who I've collaborated with in the past with tools like DOM Invader. He showed me that it's possible to exfiltrate larger tokens than demonstrated in my original "CSS: the bomb inside your inbox" post.

The author, on portswigger.net

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 allows user-controlled CSS to be injected into a page that contains a secret token, and the browser's conditional requests leak whether short substrings are present.

Impact

An attacker could recover tokens hundreds of characters long using a single stylesheet, though the technique requires a CSS injection point and the reconstruction may yield multiple candidate tokens.

What the attacker needed

A CSS injection point; victim loads the injected page; token appears in a URL or attribute

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.

CSS injection lets an attacker add their own style rules to a web page. Those rules can make the browser request a URL only if a secret value contains a certain short piece of text, which leaks that piece to the attacker. By collecting many overlapping pieces and joining them like a jigsaw, the attacker can rebuild a long secret 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.