A security researcher discovered a 'one-click' universal Cross-Site Scripting (XSS) vulnerability in uBlock Origin that could allow a malicious website to execute arbitrary JavaScript in the context of any other webpage. By exploiting the way the extension handles its element picker—a tool used to block specific page elements—attackers could trick the extension into installing 'trusted' filters that bypass standard security boundaries.

The Mechanism of the Vulnerability

uBlock Origin provides an element picker that users can trigger via a right-click to create rules for blocking specific parts of a page. This picker is implemented by injecting an iframe into the webpage, which communicates with the extension's background script to add new filters.

A screenshot of the uBlock Origin element picker interface.
The uBlock Origin element picker, which was the focus of the security vulnerability.iter.ca

This image illustrates the specific tool used to create blocking rules that was exploited in the XSS vulnerability.

The attack began by extracting the extension's internal UUID. Because uBlock Origin has a default filter rule that hooks the `fetch` API, an attacker website could hook the resulting XHR request to steal this unique identifier. Once the UUID was obtained, the attacker could iframe the element picker directly on their own malicious site.

A code listing showing the logic for figuring out the element picker URL.
Technical details regarding the identification of the element picker's internal URL.iter.ca

This screenshot provides technical context for how researchers identified the mechanism used to iframe the picker.

“The element picker shouldn’t accept messages from the attacker.”

— Universal XSS in uBlock Origin from website-driven element picker

Smuggling Trusted Filters

Once the picker was iframed, the attacker could send `postMessage` commands to it. Because the picker originally failed to verify if these messages came from the legitimate extension UI, it would accept instructions to create new filters.

The attacker could 'smuggle' a second filter into a field intended only for the filter type (such as 'image'). By inserting a newline into this field, the attacker could force the extension to add a trusted filter containing a scriptlet. Since filters added via the picker are automatically treated as trusted, the injected script could then run on any other website the user visited.

Mitigation and Security Implications

The vulnerability was addressed in version 1.75.4. The fix introduced a secret password that the real element picker receives from the content script, ensuring that only the official UI can send commands to the background script. Additionally, the extension now validates the content of the filters being created to prevent smuggling.

While the attack required a user click, researchers noted that malicious sites could make the embedded picker invisible by setting its opacity to zero. This effectively allows a site to trick a user into clicking a 'Create' button without them realizing they are interacting with a security-compromising tool.

What Hacker News readers are saying

  • Alternative: One commenter argued that the fundamental design of extensions placing interfaces within a website's DOM is inherently risky, noting it could lead to data leaks even in non-vulnerability scenarios. comment ↗
  • Skeptical: Another user suggested that the broad permissions required for uBlock Origin to function make the extension a more susceptible target for exploitation. comment ↗
  • Skeptical: One commenter observed that the vulnerability highlights the dangers of web extension designs that allow direct interaction with page content. comment ↗

Summarized opinions from the Hacker News thread, not verified facts. Read the full discussion ↗