Mozilla Firefox SharedWorkerService Code Execution Vulnerability
A race condition in Firefox's SharedWorkerService lets a reference-counted object be freed on one thread while another thread is still using it, producing a use-after-free. A malicious web page could trigger this and, with heap grooming, potentially achieve remote code execution.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the SharedWorkerService functionality of Mozilla Firefox 76.0a1 (2020-04-01) x64. A specially crafted HTML web page can cause a use after free condition, resulting in a remote code execution.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a missing lock (mutex) in GetOrCreateWorkerManager, so the SharedWorkerService object can be released on the main thread while the background thread still holds and uses it.
Impact
The use-after-free could be turned into arbitrary code execution if the attacker can groom the heap, though the text only demonstrates a crash under AddressSanitizer.
What the attacker needed
Victim visits a malicious web page; affected Firefox build (76.0a1)
How it was found
- Open the malicious web page in the affected Firefox build.
- The page causes SharedWorker objects to be created, allocating a SharedWorkerService on the background thread.
- A concurrent event on another thread releases the last reference, freeing that object.
- The background thread then increments the reference count on the freed memory, which AddressSanitizer reports as a heap-use-after-free.
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 report has not been written yet. The Original tab links to the source.
A shared worker is a background script a web page can start, and Firefox manages these in a service object. Here two parts of the browser handled events at the same time: one freed that service object while the other was still using it, so the browser touched memory that no longer belonged to it. That kind of mistake (use-after-free) can crash the browser and, in skilled hands, be turned into running an attacker's code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.