Skip to content
XSS Write-up Advanced

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 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, 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

  1. Craft a filter rule that injects CSS using a comment bypass.
  2. Use the injected CSS to load a custom font that makes requests for specific characters.
  3. Apply the font to elements containing sensitive data, such as script contents or input fields.
  4. 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.

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.