Skip to content
Memory corruption Disclosed report

Heap-use-after-free in mozilla::css::SheetLoadData::ScheduleLoadEventIfNeeded

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 36 hours
  • Paid in 26 days
  • Disclosed after 36 hours

Created attachment 8465199 test.html

Install fuzzPriv extension from https://www.squarefree.com/extensions/domFuzzLite3.xpi

Load firefox with testcase in multiple tabs. For me, fully reproducible if i just pass testcase path 3 times, loading it in three tabs.

==2680==ERROR: AddressSanitizer: heap-use-after-free on address 0x61c000067880 at pc 0x7f640be5c80b bp 0x7fff071f1470 sp 0x7fff071f1468 READ of size 8 at 0x61c000067880 thread T0 #0 0x7f640be5c80a in mozilla::css::SheetLoadData::ScheduleLoadEventIfNeeded(tag_nsresult) layout/style/Loader.cpp:495:7 #1 0x7f640be67abc in mozilla::css::Loader::DoSheetComplete(mozilla::css::SheetLoadData*, tag_nsresult, nsTArray<nsRefPtrmozilla::css::SheetLoadData >&) layout/style/Loader.cpp:1777:7 #2 0x7f640be6387e in mozilla::css::Loader::SheetComplete(mozilla::css::SheetLoadData*, tag_nsresult) layout/style/Loader.cpp:1703:3 #3 0x7f640be61e4e in mozilla::css::SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader*, nsISupports*, tag_nsresult, nsAString_internal const&) layout/style/Loader.cpp:811:5 #4 0x7f6406f44a25 in nsUnicharStreamLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) netwerk/base/src/nsUnicharStreamLoader.cpp:99:5 #5 0x7f6406e94dc4 in nsBaseChannel::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) netwerk/base/src/nsBaseChannel.cpp:751:7 #6 0x7f6406e94fbf in non-virtual thunk to nsBaseChannel::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) netwerk/base/src/nsBaseChannel.cpp:765:1 #7 0x7f6406ec5316 in nsInputStreamPump::OnStateStop() netwerk/base/src/nsInputStreamPump.cpp:711:9 #8 0x7f6406ec3896 in nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) netwerk/base/src/nsInputStreamPump.cpp:440:25 #9 0x7f6406ce22f9 in nsInputStreamReadyEvent::Run() xpcom/io/nsStreamUtils.cpp:88:9 #10 0x7f6406d19dd0 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:770:7 #11 0x7f6406d70aaa in NS_ProcessNextEvent(nsIThread*, bool) xpcom/glue/nsThreadUtils.cpp:265:10 #12 0x7f6407639613 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:99:21 #13 0x7f64075a7c31 in RunInternal ipc/chromium/src/base/message_loop.cc:229:3 #14 0x7f64075a7c31 in RunHandler ipc/chromium/src/base/message_loop.cc:222 #15 0x7f64075a7c31 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:196 #16 0x7f640a9ba2d7 in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:164:3 #17 0x7f640cfe58d4 in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:278:19 #18 0x7f640cdcb5e0 in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:4013:10 #19 0x7f640cdcc3ed in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:4084:8 #20 0x7f640cdcd1dc in XRE_main toolkit/xre/nsAppRunner.cpp:4298:16 #21 0x4bd530 in do_main browser/app/nsBrowserApp.cpp:282:12 #22 0x4bd530 in main browser/app/nsBrowserApp.cpp:643 #23 0x7f64169a976c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 #24 0x4bcb9c in _start

0x61c000067880 is located 0 bytes inside of 1896-byte region [0x61c000067880,0x61c000067fe8) freed by thread T0 here: #0 0x49c981 in __interceptor_free asan_rtl #1 0x7f6406c27015 in SnowWhiteKiller::~SnowWhiteKiller() xpcom/base/nsCycleCollector.cpp:2619:9 #2 0x7f6406c26c38 in nsCycleCollector::FreeSnowWhite(bool) xpcom/base/nsCycleCollector.cpp:2786:3 #3 0x7f6407f55b0c in AsyncFreeSnowWhite::Run() js/xpconnect/src/XPCJSRuntime.cpp:222:34 #4 0x7f6406d19dd0 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:770:7 #5 0x7f6406d70aaa in NS_ProcessNextEvent(nsIThread*, bool) xpcom/glue/nsThreadUtils.cpp:265:10 #6 0x7f6407639613 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:99:21 #7 0x7f64075a7c31 in RunInternal ipc/chromium/src/base/message_loop.cc:229:3 #8 0x7f64075a7c31 in RunHandler ipc/chromium/src/base/message_loop.cc:222 #9 0x7f64075a7c31 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:196 #10 0x7f640a9ba2d7 in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:164:3 #11 0x7f640cfe58d4 in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:278:19 #12 0x7f640cdcb5e0 in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:4013:10 #13 0x7f640cdcc3ed in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:4084:8 #14 0x7f640cdcd1dc in XRE_main toolkit/xre/nsAppRunner.cpp:4298:16 #15 0x4bd530 in do_main browser/app/nsBrowserApp.cpp:282:12 #16 0x4bd530 in main browser/app/nsBrowserApp.cpp:643 #17 0x7f64169a976c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226

previously allocated by thread T0 here: #0 0x49cc59 in malloc asan_rtl #1 0x7f6413f37aed in moz_xmalloc memory/mozalloc/mozalloc.cpp:52:17 #2 0x7f640b13838d in operator new objdir-ff-asan/content/html/document/src/../../../../dist/include/mozilla/mozalloc.h:201:12 #3 0x7f640b13838d in operator new objdir-ff-asan/content/html/document/src/../../../../dist/include/nsIDocument.h:172 #4 0x7f640b13838d in NS_NewHTMLDocument(nsIDocument**, bool) content/html/document/src/nsHTMLDocument.cpp:169 #5 0x7f640b8fe2bc in CreateHTMLDocument(nsISupports*, nsID const&, void**) layout/build/nsLayoutModule.cpp:509:1 #6 0x7f6406cfc677 in nsComponentManagerImpl::CreateInstance(nsID const&, nsISupports*, nsID const&, void**) xpcom/components/nsComponentManager.cpp:998:14 #7 0x7f6406d5b247 in CallCreateInstance xpcom/glue/nsComponentManagerUtils.cpp:135:10 #8 0x7f6406d5b247 in nsCreateInstanceByCID::operator()(nsID const&, void**) const xpcom/glue/nsComponentManagerUtils.cpp:183 #9 0x7f6406d5764d in nsCOMPtr_base::assign_from_helper(nsCOMPtr_helper const&, nsID const&) xpcom/glue/nsCOMPtr.cpp:123:7 #10 0x7f640b8fa5b1 in nsCOMPtr objdir-ff-asan/layout/build/../../dist/include/nsCOMPtr.h:657:5 #11 0x7f640b8fa5b1 in nsContentDLF::CreateDocument(char const*, nsIChannel*, nsILoadGroup*, nsIDocShell*, nsID const&, nsIStreamListener**, nsIContentViewer**) layout/build/nsContentDLF.cpp:393 #12 0x7f640b8fa012 in nsContentDLF::CreateInstance(char const*, nsIChannel*, nsILoadGroup*, char const*, nsIDocShell*, nsISupports*, nsIStreamListener**, nsIContentViewer**) layout/build/nsContentDLF.cpp:224:14 #13 0x7f640c90f3a9 in nsDocShell::NewContentViewerObj(char const*, nsIRequest*, nsILoadGroup*, nsIStreamListener**, nsIContentViewer**) docshell/base/nsDocShell.cpp:8512:19 #14 0x7f640c90bd02 in nsDocShell::CreateContentViewer(char const*, nsIRequest*, nsIStreamListener**) docshell/base/nsDocShell.cpp:8312:19 #15 0x7f640c9425b4 in nsDSURIContentListener::DoContent(char const*, bool, nsIRequest*, nsIStreamListener**, bool*) docshell/base/nsDSURIContentListener.cpp:122:10 #16 0x7f640849f30b in nsDocumentOpenInfo::TryContentListener(nsIURIContentListener*, nsIChannel*) uriloader/base/nsURILoader.cpp:725:17 #17 0x7f640849c999 in nsDocumentOpenInfo::DispatchContent(nsIRequest*, nsISupports*) uriloader/base/nsURILoader.cpp:401:30 #18 0x7f640849bfde in nsDocumentOpenInfo::OnStartRequest(nsIRequest*, nsISupports*) uriloader/base/nsURILoader.cpp:262:8 #19 0x7f6406e93ee6 in nsBaseChannel::OnStartRequest(nsIRequest*, nsISupports*) netwerk/base/src/nsBaseChannel.cpp:734:14 #20 0x7f6406ec410d in nsInputStreamPump::OnStateStart() netwerk/base/src/nsInputStreamPump.cpp:521:14 #21 0x7f6406ec37bb in nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) netwerk/base/src/nsInputStreamPump.cpp:433:25 #22 0x7f6406ce22f9 in nsInputStreamReadyEvent::Run() xpcom/io/nsStreamUtils.cpp:88:9 #23 0x7f6406d19dd0 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:770:7 #24 0x7f6406d70aaa in NS_ProcessNextEvent(nsIThread*, bool) xpcom/glue/nsThreadUtils.cpp:265:10 #25 0x7f6407639613 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:99:21 #26 0x7f64075a7c31 in RunInternal ipc/chromium/src/base/message_loop.cc:229:3 #27 0x7f64075a7c31 in RunHandler ipc/chromium/src/base/message_loop.cc:222 #28 0x7f64075a7c31 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:196 #29 0x7f640a9ba2d7 in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:164:3 #30 0x7f640cfe58d4 in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:278:19 #31 0x7f640cdcb5e0 in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:4013:10 #32 0x7f640cdcc3ed in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:4084:8 #33 0x7f640cdcd1dc in XRE_main toolkit/xre/nsAppRunner.cpp:4298:16 #34 0x4bd530 in do_main browser/app/nsBrowserApp.cpp:282:12 #35 0x4bd530 in main browser/app/nsBrowserApp.cpp:643 #36 0x7f64169a976c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226

SUMMARY: AddressSanitizer: heap-use-after-free ??:0 ?? Shadow bytes around the buggy address: 0x0c3880004ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3880004ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3880004ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3880004ef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa 0x0c3880004f00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c3880004f10:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3880004f20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3880004f30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3880004f40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3880004f50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3880004f60: 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: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc ASan internal: fe ==2680==ABORTING

The original report as published on Mozilla's Bugzilla, by Abhishek Arya. 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 CSS Parsing and Computation. Mozilla made it public on 1 August 2014.

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 Abhishek Arya

View all

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