Safeguard Web Apps: PortSwigger Shows How Overlapping CSS Fragments Bypass Token Limits to Steal Data
PortSwigger Research details a technique using overlapping CSS fragments to bypass token limits and exfiltrate sensitive data from web applications.

Key points
- PortSwigger Research published a report on CSS injection token exfiltration using overlapping fragments.
- The method allows attackers to bypass traditional token size limits during data theft.
- The technique relies on manipulating CSS selectors to extract information in smaller, overlapping pieces.
System administrators should review their web applications for vulnerabilities to CSS injection, as researchers have detailed a new method for stealing sensitive tokens. PortSwigger Research published a report titled "Smashing the token limit with overlapping fragments" that outlines this specific attack vector. The findings were shared on the r/netsec subreddit by user /u/theomkamble, drawing attention to the technical nuances of the exploit. This development highlights the evolving nature of client-side attacks and the need for robust input validation.
In plain English
CSS injection is an attack where malicious code is inserted into a web page's style sheets. Attackers use this to steal data, such as session tokens or API keys, from users who view the compromised page. Traditionally, these attacks are limited by the size of the data that can be sent back to the attacker in a single request. The new method described by PortSwigger Research bypasses these limits by breaking the stolen data into smaller, overlapping fragments. This allows the attacker to reconstruct the full token even if individual parts are too small to be useful on their own.
The background
The report submitted to r/netsec explains how overlapping fragments work in the context of CSS injection. By carefully crafting CSS selectors, an attacker can target specific characters or sections of a sensitive token. Each selector extracts a small piece of data, which is then sent to the attacker's server. Because the fragments overlap, the attacker can piece together the entire token from multiple smaller requests. This technique effectively smashes the traditional token limit that previously constrained the amount of data an attacker could exfiltrate in one go.
What changes now
Security teams must recognize that CSS injection is not just a cosmetic issue but a serious data theft vector. The ability to bypass token limits means that even small injections can lead to significant data breaches. Administrators should audit their applications for any instances where user input can influence CSS styles. Input sanitization and Content Security Policy (CSP) headers are critical defenses against this type of attack. The PortSwigger Research findings serve as a reminder to treat all client-side inputs with extreme caution.
What to do and how to stay safe: PortSwigger
- Audit web applications for any fields that allow user input to affect CSS styles or selectors.
- Implement strict Content Security Policy (CSP) headers to restrict the sources of stylesheets and scripts.
- Use input validation to ensure that no malicious CSS code can be injected into the application.
- Monitor network logs for unusual patterns of small, frequent requests that may indicate fragment-based exfiltration.
Step-by-step guide: Risk-Based Vulnerability Management: Benefits, Limits, and Reality
General security guidance from the Vector Update newsroom. It is not confirmed advice from the organisations named in this story.
Frequently asked questions
What is the main finding of the PortSwigger Research report?
The report details a CSS injection technique that uses overlapping fragments to bypass token limits and exfiltrate sensitive data.
Where was this information first shared?
The report was shared on the r/netsec subreddit by user /u/theomkamble.
How does this attack bypass traditional limits?
It breaks the stolen data into smaller, overlapping fragments, allowing the attacker to reconstruct the full token from multiple requests.



