[uBlock Origin] 2-click clickjacking to trusted-list compromise / “universal XSS” chain
Categories
(WebExtensions :: Developer Outreach, defect)
Tracking
(Not tracked)
People
(Reporter: web, Unassigned)
Details
(Keywords: reporter-external)
Attachments
(1 file)
|
21.33 KB,
application/zip
|
Details |
I discovered a bug chain in uBlock origin that starts with clickjacking and ends with new rules being added to the trusted ublock-* (eg ublock-filters) lists, allowing an attack to use privileged filters like replace= to arbitrary rewrite pages and inject scripts.
I validated this with a PoC on the latest 1.76.0 uBlock version.
The attack abuses the uBlock update mechanism so full exploitation takes hours and requires the victim to be online around the time of a new filterlist patch being released (around 4 times a day currently). If the victim goes offline in between the attack will be retried continously in the future with no additional action.
Going backwards from end to start:
Shared cache entry for trusted and untrusted update patches
During a single update run uBlock deduplicates requests by the basename of a patch ignoring origins.
An untrusted attacker list and a trusted / default filter list sharing the same patch name get mingled and only one of the two will be requested.
A patch file can carry updates for multiple lists.
uBlock filter updates always carry the filename of next patch to be released and a check-after time (implicitly in the file name) at which point the extension will start checking for that patch.
Diff-Path can also carry a full http:// url.
! Diff-Path: ../patches/2026.11.11.359.patch#ublock-filters
! Diff-Expires: 317 minutes
Hourly uBlock will check for lists that are due for an update and check if their patch files are available.
The request handling is deterministic, always the most-out-of-date list will be fetched first.
An attacker needs to:
a) import a list that carries the same Diff-Path basename, but hosted on their origin
b) manage to have a lastWrite timestamp before any of the real trusted lists
We will use clickjacking to achieve a) and a simple trick for b).
- The attacker adds a list with an arbitrary
Diff-Pathname on its own server. - uBlock will fetch this in its own updater cycle or always after the default lists.
- Once uBlock requests the list, the attacker keeps the connection open forever by responding with a newline every 15 seconds
- In the background the attacker polls the uAsset CDN for a new filterlist patch to become available
- As soon as the next patch becomes available, the attacker extracts its
Diff-Pathpointer (currently pointing at two versions ahead of the local ublock-* filter release) - It sends a final response to uBlock setting its
Diff-Pathto the version extracted
At this point the attacker filterlist has a Diff-Path pointing to the next-next patch version of the filter list.
During the next updater run it will not be considered, because its filterlist is not due yet but the regular filterlists will be updated to the just released patches.
As a result their lastWrite is now more recent than the one of the attacker list.
Once they cross the timestamp in the patch filename both lists will be due at the same time for the same basename.
The attacker list is older and its origin will be fetched.
If the attacker patch contains sections for #ublock-filters or similar trusted lists, they will be applied.
The updater also performs a SHA-1 checksum check on the updated list but the comparison uses startsWith().
A checksum "" is always valid.
Clickjacking to add a new untrusted list
Assuming an attacker knows the randomized WAR token, uBlocks click2load.html can be used as a web accessible proxy to embed asset-viewer.html with a ?aliasURL= parameter to render a subscribe to list button.
A victim needs to click twice, once for click2load to load and once to subscribe.
The PoC simulates a sample captcha page for this, rending the real buttons transparently over fake UI elements.
Extension uuid leak
uBlock injects some scriptlets into the MAIN world, in this exploit I used the prevent-clipboard-write.js one that gets loaded almost globally by the clickfix-prevention rule.
A document observer can see this scriptlet and extract the uuid / WAR secret.
PoC
PoC was build using LLMs, the agent never had access to the victim browser on my machine where I verified the impact.
I attached a PoC server for the entire chain written for bun.
The WAR leak + clickjacking can be seen instantly.
Full exploitation depends on uAssets pushing a new release and the device being online / connected to the exploit server during that time.
I validated the attack e2e on a laptop that got disconnected and moved multiple times during the attack phase and achieved compromise 2 days after the initial list creation.
After the clickjacking no user interaction is required, the server will try to perform the list overwrite continuously.
uBlock needs to reload the new rules, this happens worst case after a restart.
I did perform some code cleanup after my initial run and I'm currently rerunning the PoC myself.
Comment 1•13 days ago
|
||
Hello Martin, thank you for your report, I was gonna suggest to report the issue directly to the addon owner, https://github.com/gorhill/uBlock, but I don't see a method of reporting security bugs to them.
Hello Andreas, would you be able to help? Thanks.
Comment 2•12 days ago
|
||
Moving this to developer outreach. That usually kicks off a process to let the developer know via a separate channel, but since gorhill is on bugzilla, I added him to this bug.
:gorhill, could you look into this and take any necessary steps? Thanks!
Closing, as this isn't an AMO bug and to prevent duplicate notifications.
Updated•12 days ago
|
Updated•12 days ago
|
Updated•12 days ago
|
Comment 3•12 days ago
•
|
||
:Martin
Security issues can be send at ubo-security [at-sign] raymondhill.net -- when creating a new issue at https://github.com/uBlockOrigin/uBlock-issues/issues, there is a choice of entries, one of which is "Security Vulnerability Disclosure".
so full exploitation takes hours and requires the victim to be online around the time of a new filterlist patch being released (around 4 times a day currently). If the victim goes offline in between the attack will be retried continously in the future with no additional action.
Am I reading this right that the attack requires the user to first execute an attacker-crafted curl command?
Ok never mind, I think I understand the issue you are reporting.
:gorhill
thank you for that pointer, I have to admit I missed that channel. I checked the GitHub Security tab(s) but didn't want to create a public issue of course.
No curl / command execution or similar is needed, just two clicks on the attackers website to add the filter list. With the lastWrite manipulation the diff-upater takes care of everything. The delay pureley comes from needing to wait for a new filter patch to be released so the exploit can hijack it, while the victim Firefox is online.
I'm happy to provide additional information if needed. Otherwise thank you for your work on uBlock!
Comment 5•12 days ago
|
||
Martin,
I published a new version of uBO, 1.76.2, with a fix[1], hopefully this addresses the issue. Thanks for taking the time to report, and honestly I am impressed (and grateful) that the issue has been identified.
:gorhill,
I see that basename is currently still being called in hasPatchDetails. I don't think that is currently an issue but I'd recommend to get rid of basename entirely to prevent this class of issues on the future. Otherwise the change looks good to me.
Are you considering to also fix the other two issues? I fear leaks are difficult to end all together but at least making it more difficult to trick people into subscribing to lists by blocking the embedding path.
I'm planning to do a blog post about the research at one point but definitely want to give people some time to update and I'm happy to wait some more if you are planning follow up changes.
Comment 7•11 days ago
•
|
||
Regarding the leaked UUID through warOrigin, I should have removed this when I committed https://github.com/gorhill/uBlock/commit/150df125fd, this has been no longer needed by the injected code in MAIN world since 1.76.0. Removing warOrigin from the injected code in MAIN world appears to prevent the proof of concept from succeeding.
Do you think that for the time being removing warOrigin will be enough to address the two other reported issues?
I'm still trying to wrap my head around the full implementation but this is the script my exploit is leaking, where scriptletGlobals contains warOrigin.
I just verified, the leak + subscription part still works on 1.76.2 with the exploit I shared.
Ignore my previous comment, I misread your message (and I can't figure out how to edit my comment on bugzilla). I'll have another look to understand if that would fix the entire issue.
Comment 10•10 days ago
|
||
Dev build 1.76.3b1 should address all the issues you originally reported: https://github.com/gorhill/uBlock/releases/tag/1.76.3b1
I will promote these changes to stable release (1.76.4) later today after I further confirm the changes since 1.76.2 do not cause regressions.
Comment 11•10 days ago
|
||
Martin, I looked into GitHub's own support for reporting security vulnerability and I think I might have figured it out, so if I did everything right you should now be able to report at https://github.com/gorhill/uBlock/security/advisories?state=Triage.
Comment 12•10 days ago
|
||
Let me know when/if you want me to turn this hidden bug into a publicly visible one.
| Reporter | ||
Comment 13•9 days ago
|
||
:gorhill, the change seems to fix the issue.
I tried to create a GitHub advisory but for me the "New draft security advisory" button isn't visible. I suspect there is a permission issue.
Comment 14•8 days ago
•
|
||
Sorry for the delay, I didn't realize there was a new comment here. I modified the interaction limits which was set to "collaborators only". Hopefully this fixes the issue.
I looked at GitHub repo settings, and if you provide me with your GitHub user name I can add you as "trusted reporter" to be sure there is no obstacle to reporting in case the button still does not show up.
Updated•6 days ago
|
Comment 15•3 days ago
|
||
The reported vulnerability has been made public at https://github.com/gorhill/uBlock/security/advisories/GHSA-cmqw-9r2w-6wv2, so this can now be made visible.
Comment 16•3 days ago
|
||
Dropping visibility restrictions from the bug. It is publicly visible, effective immediately.
Description
•