Skip to content
Memory corruption Disclosed report

Heap-buffer-overflow in js::AddValueRoot

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 9 days
  • Paid in 3 months
  • Disclosed after 9 days

Created attachment 731660 Testcase archive (run test.html)

Install Jesse's fuzzPriv [https://www.squarefree.com/extensions/domFuzzLite3.xpi] and run test.html from archive. Let a couple of reloads happen (change timeout to like 50 in test.html), you will see the crash.

DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created DOMFuzzHelper created

==6007== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x600c0014d000 at pc 0x7f9ac69c4da9 bp 0x7fff7b1d64d0 sp 0x7fff7b1d64c8 READ of size 8 at 0x600c0014d000 thread T0 #0 0x7f9ac69c4da8 in js::AddValueRoot(JSContext*, JS::Value*, char const*) src/js/src/gc/Heap.h:987 #1 0x7f9ac55fc282 in mozilla::ErrorResult::ThrowJSException(JSContext*, JS::Value) src/dom/bindings/BindingUtils.cpp:134 #2 0x7f9ac5607e1f in mozilla::dom::CallbackObject::CallSetup::~CallSetup() src/dom/bindings/CallbackObject.cpp:150 #3 0x7f9ac2d9d764 in nsTraversal::TestNode(nsINode*, mozilla::ErrorResult&) src/../../../dist/include/mozilla/dom/NodeFilterBinding.h:98 #4 0x7f9ac2da40a8 in mozilla::dom::TreeWalker::FirstChildInternal(bool, mozilla::ErrorResult&) src/content/base/src/TreeWalker.cpp:351 #5 0x7f9ac543b6b2 in mozilla::dom::TreeWalkerBinding::firstChild(JSContext*, JS::Handle<JSObject*>, mozilla::dom::TreeWalker*, unsigned int, JS::Value*) src/objdir-ff-asan/dom/bindings/TreeWalkerBinding.cpp:216 #6 0x7f9ac54394ac in mozilla::dom::TreeWalkerBinding::genericMethod(JSContext*, unsigned int, JS::Value*) src/objdir-ff-asan/dom/bindings/TreeWalkerBinding.cpp:439 #7 0x7f9ac6a56783 in js::InvokeKernel(JSContext*, JS::CallArgs, js::MaybeConstruct) src/js/src/jscntxtinlines.h:338 #8 0x7f9ac6a489d7 in js::Interpret(JSContext*, js::StackFrame*, js::InterpMode) src/js/src/jsinterp.cpp:2357 #9 0x7f9ac6a37480 in js::RunScript(JSContext*, js::StackFrame*) src/js/src/jsinterp.cpp:341 #10 0x7f9ac6a588fb in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::ExecuteType, js::AbstractFramePtr, JS::Value*) src/js/src/jsinterp.cpp:529 #11 0x7f9ac6d6bca7 in EvalKernel(JSContext*, JS::CallArgs const&, EvalType, js::AbstractFramePtr, JS::Handle<JSObject*>, unsigned char*) src/js/src/builtin/Eval.cpp:303 #12 0x7f9ac6d6c05b in js::DirectEval(JSContext*, JS::CallArgs const&) src/js/src/builtin/Eval.cpp:422 #13 0x7f9ac6a47ff4 in js::Interpret(JSContext*, js::StackFrame*, js::InterpMode) src/js/src/jsinterp.cpp:2304 #14 0x7f9ac6a37480 in js::RunScript(JSContext*, js::StackFrame*) src/js/src/jsinterp.cpp:341 #15 0x7f9ac6a588fb in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::ExecuteType, js::AbstractFramePtr, JS::Value*) src/js/src/jsinterp.cpp:529 #16 0x7f9ac6a58d68 in js::Execute(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value*) src/js/src/jsinterp.cpp:568 #17 0x7f9ac690d774 in JS::Evaluate(JSContext*, JS::Handle<JSObject*>, JS::CompileOptions, unsigned short const*, unsigned long, JS::Value*) src/js/src/jsapi.cpp:5621 #18 0x7f9ac3541e05 in nsJSContext::EvaluateString(nsAString_internal const&, JSObject&, JS::CompileOptions&, bool, JS::Value*) src/dom/base/nsJSEnvironment.cpp:1294 #19 0x7f9ac2d8aa35 in nsScriptLoader::EvaluateScript(nsScriptLoadRequest*, nsString const&) src/content/base/src/nsScriptLoader.cpp:851 #20 0x7f9ac2d8973c in nsScriptLoader::ProcessRequest(nsScriptLoadRequest*) src/content/base/src/nsScriptLoader.cpp:741 #21 0x7f9ac2d88d91 in nsScriptLoader::ProcessScriptElement(nsIScriptElement*) src/content/base/src/nsScriptLoader.cpp:581 #22 0x7f9ac2d81fa3 in nsScriptElement::MaybeProcessScript() src/content/base/src/nsScriptElement.cpp:139 #23 0x7f9ac3a56eae in nsHtml5TreeOpExecutor::RunScript(nsIContent*) src/../../dist/include/nsIScriptElement.h:220 #24 0x7f9ac3a54c08 in nsHtml5TreeOpExecutor::RunFlushLoop() src/parser/html/nsHtml5TreeOpExecutor.cpp:593 #25 0x7f9ac3a5a67c in nsHtml5ExecutorReflusher::Run() src/parser/html/nsHtml5TreeOpExecutor.cpp:61 #26 0x7f9ac56d37a3 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:627 #27 0x7f9ac561ab30 in NS_ProcessNextEvent(nsIThread*, bool) src/objdir-ff-asan/xpcom/build/nsThreadUtils.cpp:238 #28 0x7f9ac4bdc77c in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:82 #29 0x7f9ac5769a09 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:216 #30 0x7f9ac48f9fec in nsBaseAppShell::Run() src/widget/xpwidgets/nsBaseAppShell.cpp:163 #31 0x7f9ac43ef5ba in nsAppStartup::Run() src/toolkit/components/startup/nsAppStartup.cpp:288 #32 0x7f9ac1c87afa in XREMain::XRE_mainRun() src/toolkit/xre/nsAppRunner.cpp:3880 #33 0x7f9ac1c88920 in XREMain::XRE_main(int, char**, nsXREAppData const*) src/toolkit/xre/nsAppRunner.cpp:3947 #34 0x7f9ac1c897b9 in XRE_main src/toolkit/xre/nsAppRunner.cpp:4152 #35 0x425558 in main src/browser/app/nsBrowserApp.cpp:232 #36 0x7f9aca60d76c in #37 0x424864 in 0x600c0014d000 is located 0 bytes to the right of 64-byte region [0x600c0014cfc0,0x600c0014d000) freed by thread T0 here: #0 0x4186d2 in __interceptor_free #1 0x7f9ac248a6b0 in nsXBLBinding::Release() src/../../dist/include/mozilla/mozalloc.h:225 previously allocated by thread T0 here: #0 0x4187b2 in __interceptor_malloc #1 0x7f9acb64d418 in moz_xmalloc src/memory/mozalloc/mozalloc.cpp:54 #2 0x7f9ac34af7c0 in nsXBLService::GetBinding(nsIContent*, nsIURI*, bool, nsIPrincipal*, bool*, nsXBLBinding**, nsTArray<nsIURI*>&) src/content/xbl/src/nsXBLService.cpp:798 #3 0x7f9ac34af7c0 in nsXBLService::GetBinding(nsIContent*, nsIURI*, bool, nsIPrincipal*, bool*, nsXBLBinding**, nsTArray<nsIURI*>&) src/content/xbl/src/nsXBLService.cpp:798 #4 0x7f9ac34adb83 in nsXBLService::GetBinding(nsIContent*, nsIURI*, bool, nsIPrincipal*, bool*, nsXBLBinding**) src/content/xbl/src/nsXBLService.cpp:690 #5 0x7f9ac34ad0bb in nsXBLService::LoadBindings(nsIContent*, nsIURI*, nsIPrincipal*, nsXBLBinding**, bool*) src/content/xbl/src/nsXBLService.cpp:475 #6 0x7f9ac244b735 in nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState&, nsIContent*, nsIFrame*, nsIAtom*, int, bool, nsStyleContext*, unsigned int, nsCSSFrameConstructor::FrameConstructionItemList&) src/layout/base/nsCSSFrameConstructor.cpp:5096 #7 0x7f9ac24666de in nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState&, nsIContent*, bool, nsIFrame*, nsCSSFrameConstructor::FrameConstructionItemList&) src/layout/base/nsCSSFrameConstructor.cpp:5039 Shadow bytes around the buggy address: 0x0c02000219b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c02000219c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c02000219d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c02000219e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c02000219f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c0200021a00:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0200021a10: fa fa fa fa fa fa fa fa fa fa fa fa 00 00 00 00 0x0c0200021a20: 00 00 00 02 fa fa fa fa 00 00 00 00 00 00 00 00 0x0c0200021a30: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0200021a40: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0200021a50: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00 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 righ 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 ==6007== 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 9 April 2013.

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.