Skip to content
Memory corruption Disclosed report CVE-2013-5603

Heap-use-after-free in nsContentUtils::ContentIsHostIncludingDescendantOf

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 13 days
  • Paid in 4 months
  • Disclosed after 13 days

Created attachment 804830 Testcase

Need to install Jesse's fuzzPriv extension.

==19928==ERROR: AddressSanitizer: heap-use-after-free on address 0x6160020b5520 at pc 0x7f18a8bb0b38 bp 0x7fff1ca5cc20 sp 0x7fff1ca5cc18 READ of size 8 at 0x6160020b5520 thread T0 #0 0x7f18a8bb0b37 in get objdir-ff-asan/content/base/src/../../../dist/include/nsCOMPtr.h:800 #1 0x7f18a8bb0b37 in operator-> objdir-ff-asan/content/base/src/../../../dist/include/nsCOMPtr.h:820 #2 0x7f18a8bb0b37 in NodeType objdir-ff-asan/content/base/src/../../../dist/include/nsINode.h:506 #3 0x7f18a8bb0b37 in nsContentUtils::ContentIsHostIncludingDescendantOf(nsINode const*, nsINode const*) content/base/src/nsContentUtils.cpp:1862 #4 0x7f18a8d15a72 in IsAllowedAsChild(nsIContent*, nsINode*, bool, nsINode*) content/base/src/nsINode.cpp:1542 #5 0x7f18a8d12720 in nsINode::ReplaceOrInsertBefore(bool, nsINode*, nsINode*, mozilla::ErrorResult&) content/base/src/nsINode.cpp:1747 #6 0x7f18ab855e25 in InsertBefore objdir-ff-asan/dom/bindings/../../dist/include/nsINode.h:1515 #7 0x7f18ab855e25 in mozilla::dom::NodeBinding::insertBefore(JSContext*, JS::Handle<JSObject*>, nsINode*, JSJitMethodCallArgs const&) objdir-ff-asan/dom/bindings/NodeBinding.cpp:477 #8 0x7f18ab84d7fe in mozilla::dom::NodeBinding::genericMethod(JSContext*, unsigned int, JS::Value*) objdir-ff-asan/dom/bindings/NodeBinding.cpp:1230 #9 0x7f18ad83247a in native js/src/jscntxtinlines.h:218 #10 0x7f18ad83247a in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) js/src/vm/Interpreter.cpp:478 #11 0x7f18ad8257f7 in Interpret(JSContext*, js::RunState&) js/src/vm/Interpreter.cpp:2454 #12 0x7f18ad813ff1 in js::RunScript(JSContext*, js::RunState&) js/src/vm/Interpreter.cpp:435 #13 0x7f18ad8346fb in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::ExecuteType, js::AbstractFramePtr, JS::Value*) js/src/vm/Interpreter.cpp:619 #14 0x7f18ad834a56 in js::Execute(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value*) js/src/vm/Interpreter.cpp:655 #15 0x7f18ada25f6d in JS::Evaluate(JSContext*, JS::Handle<JSObject*>, JS::CompileOptions, unsigned short const*, unsigned long, JS::Value*) js/src/jsapi.cpp:4897 #16 0x7f18a961f8eb in nsJSUtils::EvaluateString(JSContext*, nsAString_internal const&, JS::Handle<JSObject*>, JS::CompileOptions&, nsJSUtils::EvaluateOptions&, JS::Value*, void**) dom/base/nsJSUtils.cpp:280 #17 0x7f18a960d71f in nsJSContext::EvaluateString(nsAString_internal const&, JS::Handle<JSObject*>, JS::CompileOptions&, bool, JS::Value*, void**) dom/base/nsJSEnvironment.cpp:994 #18 0x7f18a95cb7a4 in nsGlobalWindow::RunTimeoutHandler(nsTimeout*, nsIScriptContext*) dom/base/nsGlobalWindow.cpp:10489 #19 0x7f18a95aff22 in nsGlobalWindow::RunTimeout(nsTimeout*) dom/base/nsGlobalWindow.cpp:10733 #20 0x7f18a95ca9bc in nsGlobalWindow::TimerCallback(nsITimer*, void*) dom/base/nsGlobalWindow.cpp:10980 #21 0x7f18abff59d1 in nsTimerImpl::Fire() xpcom/threads/nsTimerImpl.cpp:546 #22 0x7f18abff6076 in nsTimerEvent::Run() xpcom/threads/nsTimerImpl.cpp:630 #23 0x7f18abfebb29 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:622 #24 0x7f18abf13601 in NS_ProcessNextEvent(nsIThread*, bool) objdir-ff-asan/xpcom/build/nsThreadUtils.cpp:238 #25 0x7f18aacaaf30 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:116 #26 0x7f18ac105363 in RunInternal ipc/chromium/src/base/message_loop.cc:220 #27 0x7f18ac105363 in RunHandler ipc/chromium/src/base/message_loop.cc:213 #28 0x7f18ac105363 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:187 #29 0x7f18aaa94e2c in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:161 #30 0x7f18aa48318e in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:269 #31 0x7f18a78842f0 in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:3869 #32 0x7f18a788522a in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:3937 #33 0x7f18a788615b in XRE_main toolkit/xre/nsAppRunner.cpp:4139 #34 0x45524d in do_main browser/app/nsBrowserApp.cpp:275 #35 0x45524d in main browser/app/nsBrowserApp.cpp:635 #36 0x7f18b6b4976c in #37 0x45483c in _start 0x6160020b5520 is located 32 bytes inside of 144-byte region [0x6160020b5500,0x6160020b5590) freed by thread T0 here: #0 0x441785 in free asan_rtl #1 0x7f18ac012144 in SnowWhiteKiller::~SnowWhiteKiller() xpcom/base/nsCycleCollector.cpp:1993 #2 0x7f18ac00967e in nsCycleCollector_doDeferredDeletion() xpcom/base/nsCycleCollector.cpp:3153 #3 0x7f18abfebb29 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:622 #4 0x7f18abf13601 in NS_ProcessNextEvent(nsIThread*, bool) objdir-ff-asan/xpcom/build/nsThreadUtils.cpp:238 #5 0x7f18aacaaf51 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:81 #6 0x7f18ac105363 in RunInternal ipc/chromium/src/base/message_loop.cc:220 #7 0x7f18ac105363 in RunHandler ipc/chromium/src/base/message_loop.cc:213 #8 0x7f18ac105363 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:187 #9 0x7f18aaa94e2c in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:161 #10 0x7f18a788522a in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:3937 #11 0x7f18a788615b in XRE_main toolkit/xre/nsAppRunner.cpp:4139 #12 0x45524d in do_main browser/app/nsBrowserApp.cpp:275 #13 0x45524d in main browser/app/nsBrowserApp.cpp:635 #14 0x7f18b6b4976c in previously allocated by thread T0 here: #0 0x4418c5 in malloc asan_rtl #1 0x7f18b7f044e8 in moz_xmalloc memory/mozalloc/mozalloc.cpp:54 Shadow bytes around the buggy address: 0x0c2c8040ea50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c8040ea60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c8040ea70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c8040ea80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c8040ea90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c2c8040eaa0: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd 0x0c2c8040eab0: fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c8040eac0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c8040ead0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c8040eae0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c8040eaf0: 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 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 ASan internal: fe ==19928==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 DOM: Core & HTML. Mozilla made it public on 27 September 2013 as CVE-2013-5603.

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.