The Spectrum Dispatch News

technology

Universal XSS Vulnerability Found in uBlock Origin Element Picker

A researcher discovered a one-click flaw allowing malicious websites to inject arbitrary code into any site through uBlock Origin's element picker.

Universal XSS Vulnerability Found in uBlock Origin Element Picker

A universal cross-site scripting (XSS) vulnerability was discovered earlier this month in uBlock Origin’s element picker feature, according to a post on iter.ca. The flaw affected the MV2 Firefox version of the extension, with a similar but less severe variant also impacting uBO Lite (the MV3 version). The issue has since been fixed.

Universal XSS Vulnerability Found in uBlock Origin Element Picker

The element picker is a legitimate uBlock Origin feature that lets users right-click on a page to create filter rules blocking specific elements. The vulnerability exploited how this feature works: the picker operates via an injected iframe pointing to a URL like moz-extension://[extension-UUID]/web_accessible_resources/epicker-ui.html, and the page can communicate with the extension’s background script to add filters.

According to the disclosure, attackers could execute the exploit through several steps. First, they needed to determine the extension’s internal UUID, which is randomly assigned per installation. A malicious website could extract this by hooking XMLHttpRequest calls triggered by existing uBlock Origin filter rules. Specifically, the default uAssets filter rule that hooks the fetch function and makes internal XHR requests to the extension could be monitored to leak the UUID.

Once an attacker obtained the UUID, they could embed an invisible iframe containing the element picker, then programmatically drive it using PostMessage API calls. By sending specific messages and setting particular field values, attackers could bypass the picker’s normal restrictions on filter types. A critical technique involved injecting a newline character into the filter options field to append arbitrary trusted filters, including scriptlet filters that inject JavaScript code.

The core issue centered on the element picker accepting commands from untrusted websites without authentication. Attackers could position the invisible iframe to coincide with legitimate user clicks, tricking users into activating the malicious filter creation without realizing it. Since filters added through the element picker are treated as trusted by default, malicious code could then execute on any website until the user recompiles their custom filters.

The researcher noted that Claude (GPT-5.6 Sol) assisted in identifying the vulnerability through code analysis, though the researcher verified and wrote up the findings independently. The fix involved implementing a secret password mechanism requiring the legitimate content script to authenticate with the element picker before accepting commands.

A GitHub security advisory with additional technical details is available through the extension maintainers.

Key facts

  • The vulnerability allowed one-click XSS attacks via uBlock Origin’s element picker on Firefox MV2
  • Attackers could extract the extension’s random UUID by monitoring XMLHttpRequest calls from existing filter rules
  • Malicious websites could embed invisible iframes of the picker and drive it programmatically using PostMessage API
  • The flaw enabled attackers to inject arbitrary trusted filters that execute JavaScript on any website
  • The main fix required the element picker to validate a secret password from the legitimate content script

Sources

← All posts