Skip to content
Memory corruption Disclosed report Advanced CVE-2021-29980

AddressSanitizer: attempting double-free from gfx::RecordedFillGlyphs and UAF (0xe5e5e5e5e5e5e5e5 on crash report)

A crafted page triggers a double-free and apparent use-after-free in Firefox's canvas recording code (RecordedFillGlyphs) when the page is reloaded. On non-ASan builds this shows up as crashes with suspicious register values, so an attacker could at least crash the browser and possibly corrupt memory.

Irvan Kurniawan Follow

Originally disclosed on Mozilla

  • Fixed in 5 days
  • Paid in 10 days
  • Disclosed after 5 days

After visiting the testcase then reloading the page I noticed Firefox window become blank for a few second after that Firefox ASan will show output logs AddressSanitizer: attempting double-free on address in thread T46 from mozilla::gfx::RecordedFillGlyphs::~RecordedFillGlyphs.

On Firefox (non-asan) some crash report contain 0xe5e5e5e5e5e5e5e5 in one of CPU registers (which I assume the UAF address). Furthermore after some crash, I observe in some crash report it show access-violation on 0x100000009, 0x10b0481d060, 0xffffffffffffffff or breakpoint on some address.

I'm currently reducing the testcase, I'll attach the testcase following with STR as soon as I'm done =).

Tested on:

  • Firefox Nightly 92.0a1 (2021-07-24) (64-bit) on Windows 10
  • m-c-20210723213232-asan-opt on Windows 10
  • m-c-20210715094037-asan-opt on Windows 10
  • Firefox 90.0.2 (64-bit) on Windows 10
  • m-c-20210406094706-asan-opt on Windows 10

ASan output:

=================================================================
==13524==ERROR: AddressSanitizer: attempting double-free on 0x11f34206ab50 in thread T46:
    #0 0x7ff963c15afb in free Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_malloc_win.cpp:82
    #1 0x7ff9500ae3ba in operator delete[] /builds/worker/workspace/obj-build/dist/include/mozilla/cxxalloc.h:60
    #2 0x7ff9500ae3ba in mozilla::gfx::RecordedFillGlyphs::~RecordedFillGlyphs /builds/worker/checkouts/gecko/gfx/2d/RecordedEventImpl.h:2366
    #3 0x7ff9500ae3ba in mozilla::gfx::RecordedEvent::DoWithEvent<class mozilla::gfx::EventRingBuffer>(class mozilla::gfx::EventRingBuffer &, enum mozilla::gfx::RecordedEvent::EventType, class std::function<(class mozilla::gfx::RecordedEvent *)> const &) /builds/worker/checkouts/gecko/gfx/2d/RecordedEventImpl.h:3989
    #4 0x7ff950858f5a in mozilla::layers::CanvasTranslator::TranslateRecording(void) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:245
    #5 0x7ff950858837 in mozilla::layers::CanvasTranslator::StartTranslation(void) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:168
    #6 0x7ff94d77441a in mozilla::detail::RunnableMethodArguments<>::applyImpl /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1148
    #7 0x7ff94d77441a in mozilla::detail::RunnableMethodArguments<>::apply /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1154
    #8 0x7ff94d77441a in mozilla::detail::RunnableMethodImpl<class nsCOMPtr<class mozilla::dom::SVGSVGElement>, void (__cdecl mozilla::dom::SVGSVGElement::*)(void), 1, 0>::Run(void) /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1201
    #9 0x7ff94d941d4d in mozilla::TaskQueue::Runner::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/TaskQueue.cpp:208
    #10 0x7ff94d974808 in nsThreadPool::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:303
    #11 0x7ff94d95fc74 in nsThread::ProcessNextEvent(bool, bool *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1142
    #12 0x7ff94d96ff2c in NS_ProcessNextEvent(class nsIThread *, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:466
    #13 0x7ff94ed1413e in mozilla::ipc::MessagePumpForNonMainThreads::Run(class base::MessagePump::Delegate *) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:300
    #14 0x7ff94ec21615 in MessageLoop::RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331
    #15 0x7ff94ec21615 in MessageLoop::RunHandler(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324
    #16 0x7ff94ec213e5 in MessageLoop::Run(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306
    #17 0x7ff94d958a00 in nsThread::ThreadFunc(void *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:390
    #18 0x7ff974151fbe in _PR_NativeRunThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:399
    #19 0x7ff97412b08b in pr_root /builds/worker/checkouts/gecko/nsprpub/pr/src/md/windows/w95thred.c:139
    #20 0x7ff9d1691bb1  (C:\Windows\System32\ucrtbase.dll+0x180021bb1)
    #21 0x7ff963c20617 in __asan::AsanThread::ThreadStart(unsigned __int64) Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_thread.cpp:270
    #22 0x7ff9d28b7033  (C:\Windows\System32\KERNEL32.DLL+0x180017033)
    #23 0x7ff9751345ec in mozilla::interceptor::FuncHook<mozilla::interceptor::WindowsDllInterceptor<mozilla::interceptor::VMSharingPolicyShared>,void (*)(int, void *, void *)>::operator() /builds/worker/workspace/obj-build/dist/include/nsWindowsDllInterceptor.h:150
    #24 0x7ff9751345ec in patched_BaseThreadInitThunk /builds/worker/checkouts/gecko/mozglue/dllservices/WindowsDllBlocklist.cpp:588
    #25 0x7ff9d3982650  (C:\Windows\SYSTEM32\ntdll.dll+0x180052650)

0x11f34206ab50 is located 0 bytes inside of 12-byte region [0x11f34206ab50,0x11f34206ab5c)
freed by thread T46 here:
    #0 0x7ff963c15afb in free Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_malloc_win.cpp:82
    #1 0x7ff9500ae3ba in operator delete[] /builds/worker/workspace/obj-build/dist/include/mozilla/cxxalloc.h:60
    #2 0x7ff9500ae3ba in mozilla::gfx::RecordedFillGlyphs::~RecordedFillGlyphs /builds/worker/checkouts/gecko/gfx/2d/RecordedEventImpl.h:2366
    #3 0x7ff9500ae3ba in mozilla::gfx::RecordedEvent::DoWithEvent<class mozilla::gfx::EventRingBuffer>(class mozilla::gfx::EventRingBuffer &, enum mozilla::gfx::RecordedEvent::EventType, class std::function<(class mozilla::gfx::RecordedEvent *)> const &) /builds/worker/checkouts/gecko/gfx/2d/RecordedEventImpl.h:3989
    #4 0x7ff950858f5a in mozilla::layers::CanvasTranslator::TranslateRecording(void) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:245
    #5 0x7ff950858837 in mozilla::layers::CanvasTranslator::StartTranslation(void) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:168
    #6 0x7ff94d77441a in mozilla::detail::RunnableMethodArguments<>::applyImpl /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1148
    #7 0x7ff94d77441a in mozilla::detail::RunnableMethodArguments<>::apply /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1154
    #8 0x7ff94d77441a in mozilla::detail::RunnableMethodImpl<class nsCOMPtr<class mozilla::dom::SVGSVGElement>, void (__cdecl mozilla::dom::SVGSVGElement::*)(void), 1, 0>::Run(void) /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1201
    #9 0x7ff94d941d4d in mozilla::TaskQueue::Runner::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/TaskQueue.cpp:208
    #10 0x7ff94d974808 in nsThreadPool::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:303
    #11 0x7ff94d95fc74 in nsThread::ProcessNextEvent(bool, bool *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1142
    #12 0x7ff94d96ff2c in NS_ProcessNextEvent(class nsIThread *, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:466
    #13 0x7ff94ed1413e in mozilla::ipc::MessagePumpForNonMainThreads::Run(class base::MessagePump::Delegate *) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:300
    #14 0x7ff94ec21615 in MessageLoop::RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331
    #15 0x7ff94ec21615 in MessageLoop::RunHandler(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324
    #16 0x7ff94ec213e5 in MessageLoop::Run(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306
    #17 0x7ff94d958a00 in nsThread::ThreadFunc(void *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:390
    #18 0x7ff974151fbe in _PR_NativeRunThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:399
    #19 0x7ff97412b08b in pr_root /builds/worker/checkouts/gecko/nsprpub/pr/src/md/windows/w95thred.c:139
    #20 0x7ff9d1691bb1  (C:\Windows\System32\ucrtbase.dll+0x180021bb1)
    #21 0x7ff963c20617 in __asan::AsanThread::ThreadStart(unsigned __int64) Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_thread.cpp:270
    #22 0x7ff9d28b7033  (C:\Windows\System32\KERNEL32.DLL+0x180017033)
    #23 0x7ff9751345ec in mozilla::interceptor::FuncHook<mozilla::interceptor::WindowsDllInterceptor<mozilla::interceptor::VMSharingPolicyShared>,void (*)(int, void *, void *)>::operator() /builds/worker/workspace/obj-build/dist/include/nsWindowsDllInterceptor.h:150
    #24 0x7ff9751345ec in patched_BaseThreadInitThunk /builds/worker/checkouts/gecko/mozglue/dllservices/WindowsDllBlocklist.cpp:588

previously allocated by thread T46 here:
    #0 0x7ff963c15c0b in malloc Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_malloc_win.cpp:98
    #1 0x7ff97513139d in moz_xmalloc /builds/worker/checkouts/gecko/memory/mozalloc/mozalloc.cpp:52
    #2 0x7ff9500eb502 in operator new[] /builds/worker/workspace/obj-build/dist/include/mozilla/cxxalloc.h:42
    #3 0x7ff9500eb502 in mozilla::gfx::RecordedFillGlyphs::RecordedFillGlyphs<class mozilla::gfx::EventStream>(class mozilla::gfx::EventStream &) /builds/worker/checkouts/gecko/gfx/2d/RecordedEventImpl.h:2398
    #4 0x7ff9500ae2e2 in mozilla::gfx::RecordedEvent::DoWithEvent<class mozilla::gfx::EventRingBuffer>(class mozilla::gfx::EventRingBuffer &, enum mozilla::gfx::RecordedEvent::EventType, class std::function<(class mozilla::gfx::RecordedEvent *)> const &) /builds/worker/checkouts/gecko/gfx/2d/RecordedEventImpl.h:3989
    #5 0x7ff950858f5a in mozilla::layers::CanvasTranslator::TranslateRecording(void) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:245
    #6 0x7ff950858837 in mozilla::layers::CanvasTranslator::StartTranslation(void) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:168
    #7 0x7ff94d77441a in mozilla::detail::RunnableMethodArguments<>::applyImpl /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1148
    #8 0x7ff94d77441a in mozilla::detail::RunnableMethodArguments<>::apply /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1154
    #9 0x7ff94d77441a in mozilla::detail::RunnableMethodImpl<class nsCOMPtr<class mozilla::dom::SVGSVGElement>, void (__cdecl mozilla::dom::SVGSVGElement::*)(void), 1, 0>::Run(void) /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1201
    #10 0x7ff94d941d4d in mozilla::TaskQueue::Runner::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/TaskQueue.cpp:208
    #11 0x7ff94d974808 in nsThreadPool::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:303
    #12 0x7ff94d95fc74 in nsThread::ProcessNextEvent(bool, bool *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1142
    #13 0x7ff94d96ff2c in NS_ProcessNextEvent(class nsIThread *, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:466
    #14 0x7ff94ed1413e in mozilla::ipc::MessagePumpForNonMainThreads::Run(class base::MessagePump::Delegate *) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:300
    #15 0x7ff94ec21615 in MessageLoop::RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331
    #16 0x7ff94ec21615 in MessageLoop::RunHandler(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324
    #17 0x7ff94ec213e5 in MessageLoop::Run(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306
    #18 0x7ff94d958a00 in nsThread::ThreadFunc(void *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:390
    #19 0x7ff974151fbe in _PR_NativeRunThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:399
    #20 0x7ff97412b08b in pr_root /builds/worker/checkouts/gecko/nsprpub/pr/src/md/windows/w95thred.c:139
    #21 0x7ff9d1691bb1  (C:\Windows\System32\ucrtbase.dll+0x180021bb1)
    #22 0x7ff963c20617 in __asan::AsanThread::ThreadStart(unsigned __int64) Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_thread.cpp:270

Thread T46 created by T4 here:
    #0 0x7ff963c216b2 in __asan_wrap_CreateThread Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_win.cpp:146
    #1 0x7ff9d1691896  (C:\Windows\System32\ucrtbase.dll+0x180021896)
    #2 0x7ff97412aebd in _PR_MD_CREATE_THREAD /builds/worker/checkouts/gecko/nsprpub/pr/src/md/windows/w95thred.c:153
    #3 0x7ff974152d9c in _PR_NativeCreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:1058
    #4 0x7ff9741536f3 in _PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:1184
    #5 0x7ff974149abf in PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:1404
    #6 0x7ff94d95b20c in nsThread::Init(class nsTSubstring<char> const &) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:602
    #7 0x7ff94d96d53b in nsThreadManager::NewNamedThread(class nsTSubstring<char> const &, unsigned int, class nsIThread **) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadManager.cpp:573
    #8 0x7ff94d97947c in NS_NewNamedThread(class nsTSubstring<char> const &, class nsIThread **, struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:162
    #9 0x7ff94d972be6 in NS_NewNamedThread /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:155
    #10 0x7ff94d972be6 in nsThreadPool::PutEvent(struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:118
    #11 0x7ff94d975eeb in nsThreadPool::Dispatch(struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:354
    #12 0x7ff94d92b86a in mozilla::SharedThreadPool::Dispatch(struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/workspace/obj-build/dist/include/mozilla/SharedThreadPool.h:73
    #13 0x7ff94d93f09a in mozilla::TaskQueue::DispatchLocked(class nsCOMPtr<class nsIRunnable> &, unsigned int, enum mozilla::AbstractThread::DispatchReason) /builds/worker/checkouts/gecko/xpcom/threads/TaskQueue.cpp:68
    #14 0x7ff94d97d22b in mozilla::TaskQueue::Dispatch(struct already_AddRefed<class nsIRunnable>, enum mozilla::AbstractThread::DispatchReason) /builds/worker/workspace/obj-build/dist/include/mozilla/TaskQueue.h:88
    #15 0x7ff9508585da in mozilla::layers::CanvasTranslator::RecvResumeTranslation(void) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:160
    #16 0x7ff9508570cd in mozilla::layers::CanvasTranslator::RecvInitTranslator(enum mozilla::layers::TextureType const &, void *const &, void *const &, void *const &) /builds/worker/checkouts/gecko/gfx/layers/ipc/CanvasTranslator.cpp:151
    #17 0x7ff94f7f20fe in mozilla::layers::PCanvasParent::OnMessageReceived(class IPC::Message const &) /builds/worker/workspace/obj-build/ipc/ipdl/PCanvasParent.cpp:188
    #18 0x7ff94ed09904 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(class mozilla::ipc::ActorLifecycleProxy *, class IPC::Message const &) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:2084
    #19 0x7ff94ed05d6f in mozilla::ipc::MessageChannel::DispatchMessage(class IPC::Message &&) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:2011
    #20 0x7ff94ed07bf1 in mozilla::ipc::MessageChannel::RunMessage(class mozilla::ipc::MessageChannel::MessageTask &) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1859
    #21 0x7ff94ed0819c in mozilla::ipc::MessageChannel::MessageTask::Run(void) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1890
    #22 0x7ff94d941d4d in mozilla::TaskQueue::Runner::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/TaskQueue.cpp:208
    #23 0x7ff94d974808 in nsThreadPool::Run(void) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:303
    #24 0x7ff94d95fc74 in nsThread::ProcessNextEvent(bool, bool *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1142
    #25 0x7ff94d96ff2c in NS_ProcessNextEvent(class nsIThread *, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:466
    #26 0x7ff94ed1413e in mozilla::ipc::MessagePumpForNonMainThreads::Run(class base::MessagePump::Delegate *) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:300
    #27 0x7ff94ec21615 in MessageLoop::RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331
    #28 0x7ff94ec21615 in MessageLoop::RunHandler(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324
    #29 0x7ff94ec213e5 in MessageLoop::Run(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306
    #30 0x7ff94d958a00 in nsThread::ThreadFunc(void *) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:390
    #31 0x7ff974151fbe in _PR_NativeRunThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:399
    #32 0x7ff97412b08b in pr_root /builds/worker/checkouts/gecko/nsprpub/pr/src/md/windows/w95thred.c:139
    #33 0x7ff9d1691bb1  (C:\Windows\System32\ucrtbase.dll+0x180021bb1)
    #34 0x7ff963c20617 in __asan::AsanThread::ThreadStart(unsigned __int64) Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_thread.cpp:270
    #35 0x7ff9d28b7033  (C:\Windows\System32\KERNEL32.DLL+0x180017033)
    #36 0x7ff9751345ec in mozilla::interceptor::FuncHook<mozilla::interceptor::WindowsDllInterceptor<mozilla::interceptor::VMSharingPolicyShared>,void (*)(int, void *, void *)>::operator() /builds/worker/workspace/obj-build/dist/include/nsWindowsDllInterceptor.h:150
    #37 0x7ff9751345ec in patched_BaseThreadInitThunk /builds/worker/checkouts/gecko/mozglue/dllservices/WindowsDllBlocklist.cpp:588
    #38 0x7ff9d3982650  (C:\Windows\SYSTEM32\ntdll.dll+0x180052650)

Thread T4 created by T0 here:
    #0 0x7ff963c216b2 in __asan_wrap_CreateThread Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_win.cpp:146
    #1 0x7ff9d1691896  (C:\Windows\System32\ucrtbase.dll+0x180021896)
    #2 0x7ff97412aebd in _PR_MD_CREATE_THREAD /builds/worker/checkouts/gecko/nsprpub/pr/src/md/windows/w95thred.c:153
    #3 0x7ff974152d9c in _PR_NativeCreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:1058
    #4 0x7ff9741536f3 in _PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:1184
    #5 0x7ff974149abf in PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/threads/combined/pruthr.c:1404
    #6 0x7ff94d95b20c in nsThread::Init(class nsTSubstring<char> const &) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:602
    #7 0x7ff94d96d53b in nsThreadManager::NewNamedThread(class nsTSubstring<char> const &, unsigned int, class nsIThread **) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadManager.cpp:573
    #8 0x7ff94d97947c in NS_NewNamedThread(class nsTSubstring<char> const &, class nsIThread **, struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:162
    #9 0x7ff94d972be6 in NS_NewNamedThread /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:155
    #10 0x7ff94d972be6 in nsThreadPool::PutEvent(struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:118
    #11 0x7ff94d975eeb in nsThreadPool::Dispatch(struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:354
    #12 0x7ff94d96673d in BackgroundEventTarget::Dispatch(struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadManager.cpp:166
    #13 0x7ff94d97b825 in nsIEventTarget::Dispatch /builds/worker/workspace/obj-build/dist/include/nsIEventTarget.h:41
    #14 0x7ff94d97b825 in nsThreadManager::DispatchToBackgroundThread /builds/worker/checkouts/gecko/xpcom/threads/nsThreadManager.cpp:501
    #15 0x7ff94d97b825 in NS_DispatchBackgroundTask(struct already_AddRefed<class nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:502
    #16 0x7ff956f9f679 in mozilla::crashreporter::LSPAnnotate(void) /builds/worker/checkouts/gecko/widget/windows/LSPAnnotator.cpp:131
    #17 0x7ff956fdd990 in nsAppShell::Init(void) /builds/worker/checkouts/gecko/widget/windows/nsAppShell.cpp:501
    #18 0x7ff956f1dd4f in nsAppShellInit /builds/worker/checkouts/gecko/widget/nsAppShellSingleton.h:47
    #19 0x7ff956f1dd4f in nsWidgetWindowsModuleCtor(void) /builds/worker/checkouts/gecko/widget/windows/nsWidgetFactory.cpp:49
    #20 0x7ff94d8b7d51 in mozilla::xpcom::CallInitFunc /builds/worker/workspace/obj-build/xpcom/components/StaticComponents.cpp:8961
    #21 0x7ff94d8b7d51 in mozilla::xpcom::CreateInstanceImpl /builds/worker/workspace/obj-build/xpcom/components/StaticComponents.cpp:11279
    #22 0x7ff94d905ad3 in `anonymous namespace'::EntryWrapper::CreateInstance /builds/worker/checkouts/gecko/xpcom/components/nsComponentManager.cpp:174
    #23 0x7ff94d905ad3 in nsComponentManagerImpl::GetServiceLocked /builds/worker/checkouts/gecko/xpcom/components/nsComponentManager.cpp:1276
    #24 0x7ff94d904c58 in nsComponentManagerImpl::GetService(struct nsID const &, struct nsID const &, void **) /builds/worker/checkouts/gecko/xpcom/components/nsComponentManager.cpp:1330
    #25 0x7ff94d90f74e in CallGetService /builds/worker/checkouts/gecko/xpcom/components/nsComponentManagerUtils.cpp:51
    #26 0x7ff94d90f74e in nsGetServiceByCID::operator()(struct nsID const &, void **) const /builds/worker/checkouts/gecko/xpcom/components/nsComponentManagerUtils.cpp:220
    #27 0x7ff94d706743 in nsCOMPtr_base::assign_from_gs_cid(class nsGetServiceByCID, struct nsID const &) /builds/worker/checkouts/gecko/xpcom/base/nsCOMPtr.cpp:64
    #28 0x7ff95b3d3219 in nsCOMPtr<nsIAppShell>::nsCOMPtr /builds/worker/workspace/obj-build/dist/include/nsCOMPtr.h:611
    #29 0x7ff95b3d3219 in XRE_RunAppShell(void) /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:867
    #30 0x7ff94ec21615 in MessageLoop::RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331
    #31 0x7ff94ec21615 in MessageLoop::RunHandler(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324
    #32 0x7ff94ec213e5 in MessageLoop::Run(void) /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306
    #33 0x7ff95b3d2709 in XRE_InitChildProcess(int, char **const, struct XREChildData const *) /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:742
    #34 0x7ff6b0631f49 in content_process_main /builds/worker/checkouts/gecko/browser/app/../../ipc/contentproc/plugin-container.cpp:58
    #35 0x7ff6b0631f49 in NS_internal_main(int, char **, char **) /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:327
    #36 0x7ff6b06314d4 in wmain /builds/worker/checkouts/gecko/toolkit/xre/nsWindowsWMain.cpp:131
    #37 0x7ff6b072f207 in invoke_main f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:90
    #38 0x7ff6b072f207 in __scrt_common_main_seh f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    #39 0x7ff9d28b7033  (C:\Windows\System32\KERNEL32.DLL+0x180017033)
    #40 0x7ff9d3982650  (C:\Windows\SYSTEM32\ntdll.dll+0x180052650)

SUMMARY: AddressSanitizer: double-free Z:\task_1626506473\fetches\llvm-project\llvm\projects\compiler-rt\lib\asan\asan_malloc_win.cpp:82 in free
==13524==ABORTING

The original report as published on Mozilla's Bugzilla, by Irvan Kurniawan. 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 a lifetime or ownership mistake in the canvas recording translation path, where a RecordedFillGlyphs event's buffer is freed twice while the recording is being replayed on the canvas translator thread.

Impact

The page could crash the browser and, given the use-after-free indications, may allow memory corruption, though the report does not demonstrate code execution.

What the attacker needed

Victim loads a crafted page; victim reloads the page; Windows build of Firefox

How it was found

  1. Visit the testcase page in Firefox.
  2. Reload the page.
  3. Observe the window going blank briefly and the ASan double-free report.

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.

Firefox draws some page content, such as canvas graphics, on a separate background thread and passes drawing instructions to it. A bug meant the same small block of memory was released twice, which is a double-free, and the program may then read memory that has already been freed, a use-after-free. The reporter saw this as a blank window and browser crashes after loading and reloading a test page.

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 Irvan Kurniawan

View all

72 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.