Vulnerable Extension can hang entire Browser
Categories
(WebExtensions :: General, defect)
Tracking
(Not tracked)
People
(Reporter: sad_bunny, Unassigned, NeedInfo)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:159.0) Gecko/20100101 Firefox/159.0
Steps to reproduce
This issue was observed when using the Floccus bookmark-sync extension. A corresponding issue report was filed for Floccus and can be found here:-
https://github.com/floccusaddon/floccus/issues/2409#issuecomment-6615780925
Note that in this case, the underlying issue looks to be Firefox, not Floccus. In this specific scenario, several discrete Firefox installations share a common bookmark set, coordinated using the Floccus extension and the BookmarkManager application of NextCloud.
Steps to Reproduce
- Configure a browser to use Floccus and enroll one or more bookmark sync profiles
- Leave that specific browser instance idle for an extended period [my case: 10 months]
- Make numerous changes to other Firefox instances enrolled in the same bookmark-sharing scheme
- 10 months later, go back to the previously idle Firefox instance and launch it.
- Observe that after the first page loads, all other attempts to get the browser to do anything will apparently hang the entire browser
Actual results
What seems to happen is:-
- On browser launch, the floccus Extension connects with the remote Bookmark server and an initial handshake/data exchange is seen to take place
- Floccus then attempts to perform some kind of "sync" calculation
- Firefox seems to be written in such a way that all Extensions share a single thread
- As a result of the single-threaded nature of Extension handling, any attempt by any other Extension to do anything when a new page load occurs will fail, because Floccus has not completed it's actions from the first page load.
- The serial nature of Extension handling, in a single thread, means that once Floccus has been allowed to load once, it effectively acts as an absolute block unless/until it is allowed to complete it's synchronisation activity.
- Until it completes [or is disabled] the browser will not respond and pages will not load.
In simple terms, an Extension should not be capable of performing a "DOS attack" against the parent browser.
Expected results
Firefox should either isolate or detect and warn about an aberrant Extension.
A single Extension cannot be allowed to "bring down" an entire browser instance.
An expensive way to solve this might be to assign a discrete thread to each loaded extension, though this may of course not be efficient in threading terms [and may cause other [e.g. race condition] issues]...
However, Firefox may need to have some kind of preemption logic if it is going to "hand" a thread to an extension, since there does not seem to be any form of protection mechanism against a rogue or looping Extension. So if discrete threading for Extensions is unappealing, some form of preemption may be an alternative.
In the event that neither of the above are viable, would it be possible to set a "watcher" in a different thread, to monitor the "Extension Thread" so that it can at minimum raise a visible alert [if not intervene directly] if/when an Extension starts to spiral or gets caught in an excessively long-running task.
Comment 1•18 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Bookmarks & History' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•18 days ago
|
Updated•18 days ago
|
Apologies: additional failure data...
This is likely more relevant to the specific Floccus behavior, but when attempting to triage the issue, use of "about:processes" and a review of the "Extensions" items shows to key pieces of information.
First, the CPU utilization shows that one single core of the host processor appears to become quickly saturated and sit at 100%. However, because this is only a single core, overall CPU consumption remains at e.g. 3%, which makes the behavior harder to spot.
Second, memory consumption for the "Extensions" element of Firefox quickly and significantly extends - 2 minutes after launch, "Extensions" RAM consumption was showing > 500Mb. The actual number fluctuated and would slowly increase by a few Mb and then slip back by 1 or 2 Mb, before increasing again. This "saw-tooth" practice continued while Floccus was active - perhaps this was some form of garbage collection in action? In "normal" use with 3 open tabs, I would typically see Extension RAM consumption at approx 300Mb.
I reviewed the report and the related Floccus GitHub issue:
Docs suggestion: a long-stale profile’s merge can hang the browser (Firefox) · Issue #2409 · floccus…
The Floccus maintainer reproduced the issue and confirmed that a fix is included in Floccus v5.13.0, released on November 8, 2026.
Could you please confirm:
Does the issue still occur with Floccus v5.13.0?
If it persists, can it also be reproduced on the latest Firefox Nightly?
Does the browser still hang when running Floccus without other extensions enabled?
If reproducible, would you be able to capture a Firefox performance profile during the hang?
This would help determine whether there is a remaining Firefox-side issue after the Floccus fix.
QA status: Need More Info — not independently reproduced.
Hello vcarciu,
Thanks for taking a look at this issue for me. Some partial [and likely unsatisfactory] answers to your questions:-
Does the issue still occur with Floccus v5.13.0?
No... but as per the Defect report on GitHub for the Floccus element, please note that I was able to implement a permanent fix by temporarily disabling the "auto-sync" feature of Fluccus, accepting a one-off download from the NextCloud Server and then over-riding the built-in protective alerts to accept the scale of changes introduced.
The fact that I did this brought my two browsers back in to synchronisation and so I'm unable to directly check the effectiveness of the Floccus fix.
This would help determine whether there is a remaining Firefox-side issue after the Floccus fix.
Based on observed behavior [but with complete ignorance of FF internals] I strongly suspect that an issue remains.
My reasoning is based on the observations at failure: what happened with Floccus 5.12.0 was the following:-
- Firefox was launched in a configuration with "Stale" Floccus bookmark data.
- At startup, Floccus requested a handshake with the configured back-end server - in my case that's NextCloud running on my local network, hosted on an 8Gb Raspberry Pi4B, with MariaDB served out of an i5-based QNAP NAS running as the back end.
- A page was requested and cleanly downloaded.
- By the time that the page load concluded, Floccus had received it's handshake/update information from NextCloud and was working on it's internal analysis in order to compute the delta between the local bookmark configuration and the server setup. Note that in total there are 4k bookmarks in play in this setup.
- When the browser was asked to load a second page - any second page - everything simply froze. FF's "about:processes" showed it's single thread to be at maximum 100%, with memory rising as Floccus attempted to reconcile the two bookmark data sets. The 100% utilisation of the single "Extension Thread" prevents my other installed Extensions from getting any CPU time, hence no further page loads.
Your questions are entirely reasonable, as they will help you triage whether this is a problem within the specific Extension - Floccus - or perhaps triggered by my configuration.
What I've tried to offer you in this answer - through imperfect observation - is that the evidence I saw when I had the issue very strongly suggests that any Extension has the ability put FF in to a "hung" state, because once FF invokes a vulnerable Extension, the dedicated "Extension" thread in the code becomes locked.
You can probably tell I'm not a developer, just passingly familiar with the software concepts I'm trying to express. But based on my limited knowledge I think there are a couple of things that might be worth looking at. First would be whether or not there is any ability for FF to pre-emptively take control from an overloaded Extension? I know that modern operating systems do this... but not if this is possible within an application calling subroutines. Second would almost certainly be possible, but much more resource-expensive: give each Extension a dedicated thread.
Unfortunately, I think the prompt response and fix from Marcel for Floccus makes it harder to test the FF side of this issue. I only have one NextCloud instance, so even though I could create a couple of extra user profiles on a couple of client machines, running a test against my production NC data set risks corrupting it, which I'd rather not do.
I do have a couple of spare R-Pi machines that I need to rebuild in order to test a new FreeIPA setup I just build... so if/when I get them working, I could put an all-new instance of NextCloud on one, then test that way. However, I can't commit to when that might be available for testing.
Either way, I very much appreciate you reviewing this issue report - and hopefully you can find enough in the above to guide a review of the code to determine if there is anything that can be done within FF to mitigate this risk.
Thanks again.
Comment 5•6 days ago
|
||
Today I triaged another bug, which shares the same underlying cause: https://bugzilla.mozilla.org/show_bug.cgi?id=2092766#c3
The fix is for extensions to be in separate processes - bug 1827085 (or at least threads, if they use service workers, which we still need to support).
If you are able to reproduce the issue, could you capture and share a performance profile, with https://profiler.firefox.com? Then we can check whether it is really an extension bug, or whether there is something in Firefox that is broken.
Description
•