Universal XSS in uBlock Origin from website-driven element picker
A malicious website could trick uBlock Origin's element picker into adding arbitrary trusted filters, which can inject JavaScript into any page. This allowed the attacker to run arbitrary JavaScript in the context of any site.
iter.ca
Published on iter.ca
Earlier this month I found a one-click universal XSS issue with uBlock Origin (the MV2 Firefox version, although a similar but less problematic issue also affected the MV3 version, uBO Lite), where a malicious website could trick the extension into adding arbitrary trusted filters. Trusted filters can inject…
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
The element picker accepted messages from any website without authentication, and the 'opt' field was not sanitised, allowing newline injection to add arbitrary trusted filters.
Impact
The attacker could run arbitrary JavaScript in the context of any site, but the exploit required the user to click on the page.
What the attacker needed
Victim uses uBlock Origin; victim visits malicious site; victim clicks on the page
The fix
The issue was fixed by adding a secret password that the real element picker gets from the content script and sends in the initial postMessage.
How it was found
- Figure out the element picker URL by leaking the extension UUID via a hooked XHR.
- Create an invisible iframe that embeds the element picker.
- Send messages to the picker to set a filter and enable the create button.
- Position the invisible iframe to trick the user into clicking the create button.
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.
uBlock Origin is a browser extension that blocks ads. It has a feature called the element picker that lets you create rules to hide parts of a page. The bug let a malicious website pretend to be the element picker and add a rule that runs harmful code on other websites.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.