uBlock, I exfiltrate: exploiting ad blockers with CSS
uBlock Origin's filter rules were vulnerable to CSS injection, allowing a malicious filter to inject arbitrary CSS into any page. An attacker could then use CSS-based techniques to exfiltrate sensitive data such as script contents, attribute values, and even passwords from input fields.
portswigger.net
Published on portswigger.net
Ad blockers like uBlock Origin are extremely popular, and typically have access to every page a user visits. Behind the scenes, they're powered by community-provided filter lists - CSS selectors that dictate which elements to block.
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, uBlock Origin's validation of filter rules was insufficient, allowing CSS injection through malformed selectors and alternative CSS functions.
Impact
A malicious filter list could exfiltrate sensitive data from any web page, including script contents and passwords (when unmasked in Edge), though the attack requires the user to install the malicious filter.
What the attacker needed
Malicious filter rule installed; victim uses uBlock Origin
The fix
uBlock Origin patched the vulnerabilities by improving validation and blocking dangerous CSS functions like image-set().
How it was found
- Craft a filter rule that injects CSS using a comment bypass.
- Use the injected CSS to load a custom font that makes requests for specific characters.
- Apply the font to elements containing sensitive data, such as script contents or input fields.
- Observe the requests made to the attacker's server to reconstruct the stolen 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.
Ad blockers like uBlock Origin use lists of rules to decide what to hide on web pages. These rules are written in CSS, the language that styles web pages. The researcher found that a malicious rule could sneak in extra CSS that steals information from the page, like text you type or data stored in the page's code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.