Skip to content
Memory corruption Disclosed report Advanced

webgl heap overflow (raw_fDrawElementsInstanced) (lin+nv)

A WebGL draw call with instancing caused a heap overflow in the NVIDIA EGL driver, leading to a crash. An attacker could potentially exploit this to execute code or cause a denial of service.

Omair Follow

Originally disclosed on Mozilla

  • Fixed in 9 months
  • Paid in 6 months
  • Disclosed after 9 months

Created attachment 9264281 9.html

Steps to reproduce:

Tested on the latest ASAN build.

==93156==ERROR: AddressSanitizer: SEGV on unknown address 0x000041414141 (pc 0x7fb2dd019510 bp 0x61e000030c98 sp 0x7fff13b3a4a8 T0)
==93156==The signal is caused by a READ memory access.
    #0 0x7fb2dd019510  (/lib/x86_64-linux-gnu/libnvidia-eglcore.so.510.47.03+0xc10510)
    #1 0x7fb2dd01b2ee  (/lib/x86_64-linux-gnu/libnvidia-eglcore.so.510.47.03+0xc122ee)
    #2 0x7fb2dd01bd77  (/lib/x86_64-linux-gnu/libnvidia-eglcore.so.510.47.03+0xc12d77)
    #3 0x7fb2dd01cd30  (/lib/x86_64-linux-gnu/libnvidia-eglcore.so.510.47.03+0xc13d30)
    #4 0x7fb2dd370f3f  (/lib/x86_64-linux-gnu/libnvidia-eglcore.so.510.47.03+0xf67f3f)
    #5 0x7fb2dd02b2cc  (/lib/x86_64-linux-gnu/libnvidia-eglcore.so.510.47.03+0xc222cc)
    #6 0x7fb2f618002d in mozilla::gl::GLContext::raw_fDrawElementsInstanced(unsigned int, int, unsigned int, void const*, int) /builds/worker/checkouts/gecko/gfx/gl/GLContext.h:2521:5
    #7 0x7fb2f6172d0d in mozilla::gl::GLContext::fDrawElementsInstanced(unsigned int, int, unsigned int, void const*, int) /builds/worker/checkouts/gecko/gfx/gl/GLContext.h:2504:5
    #8 0x7fb2f617274c in mozilla::WebGLContext::DrawElementsInstanced(unsigned int, int, unsigned int, long, int) /builds/worker/checkouts/gecko/dom/canvas/WebGLContextDraw.cpp:918:17
    #9 0x7fb2f60737c3 in DrawElementsInstanced /builds/worker/checkouts/gecko/dom/canvas/HostWebGLContext.h:743:15
    #10 0x7fb2f60737c3 in void mozilla::ClientWebGLContext::Run<void (mozilla::HostWebGLContext::*)(unsigned int, int, unsigned int, long, int) const, &(mozilla::HostWebGLContext::DrawElementsInstanced(unsigned int, int, unsigned int, long, int) const), unsigned int&, int&, unsigned int&, long&, int&>(unsigned int&, int&, unsigned int&, long&, int&) const /builds/worker/checkouts/gecko/dom/canvas/ClientWebGLContext.cpp:344:12
    #11 0x7fb2f60734f1 in mozilla::ClientWebGLContext::DrawElementsInstanced(unsigned int, int, unsigned int, long, int, mozilla::FuncScopeId) /builds/worker/checkouts/gecko/dom/canvas/ClientWebGLContext.cpp:4671:3
    #12 0x7fb2f559f76c in mozilla::ClientWebGLContext::DrawRangeElements(unsigned int, unsigned int, unsigned int, int, unsigned int, long) /builds/worker/checkouts/gecko/dom/canvas/ClientWebGLContext.h:2046:5
    #13 0x7fb2f559f2d5 in mozilla::dom::WebGL2RenderingContext_Binding::drawRangeElements(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/WebGL2RenderingContextBinding.cpp:7413:24
    #14 0x7fb2f5e9b9ed in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:3306:13
    #15 0x7fb2fcdb5784 in CallJSNative /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:425:13
    #16 0x7fb2fcdb5784 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:512:12
    #17 0x7fb2fcda1cee in CallFromStack /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:576:10
    #18 0x7fb2fcda1cee in Interpret(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:3309:16
    #19 0x7fb2fcd86b01 in js::RunScript(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:394:13
    #20 0x7fb2fcdb9823 in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>, JS::Handle<JS::Value>, js::AbstractFramePtr, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:767:13
    #21 0x7fb2fd01262b in ExecuteScript(JSContext*, JS::Handle<JSObject*>, JS::Handle<JSScript*>, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/vm/CompilationAndEvaluation.cpp:515:10
    #22 0x7fb2fd012935 in JS_ExecuteScript(JSContext*, JS::Handle<JSScript*>) /builds/worker/checkouts/gecko/js/src/vm/CompilationAndEvaluation.cpp:539:10
    #23 0x7fb2f4301dda in mozilla::dom::JSExecutionContext::ExecScript() /builds/worker/checkouts/gecko/dom/base/JSExecutionContext.cpp:296:8
    #24 0x7fb2f83f0e22 in ExecuteCompiledScript /builds/worker/checkouts/gecko/dom/script/ScriptLoader.cpp:2311:16
    #25 0x7fb2f83f0e22 in mozilla::dom::ScriptLoader::EvaluateScript(nsIGlobalObject*, mozilla::dom::ScriptLoadRequest*) /builds/worker/checkouts/gecko/dom/script/ScriptLoader.cpp:2499:10
    #26 0x7fb2f83eef81 in mozilla::dom::ScriptLoader::EvaluateScriptElement(mozilla::dom::ScriptLoadRequest*) /builds/worker/checkouts/gecko/dom/script/ScriptLoader.cpp:2371:10
    #27 0x7fb2f83ea0a6 in mozilla::dom::ScriptLoader::ProcessRequest(mozilla::dom::ScriptLoadRequest*) /builds/worker/checkouts/gecko/dom/script/ScriptLoader.cpp:2046:10
    #28 0x7fb2f83e770f in mozilla::dom::ScriptLoader::ProcessInlineScript(nsIScriptElement*, mozilla::dom::ScriptKind) /builds/worker/checkouts/gecko/dom/script/ScriptLoader.cpp:1499:10
    #29 0x7fb2f83d183e in mozilla::dom::ScriptLoader::ProcessScriptElement(nsIScriptElement*) /builds/worker/checkouts/gecko/dom/script/ScriptLoader.cpp:1214:10
    #30 0x7fb2f83d09ca in mozilla::dom::ScriptElement::MaybeProcessScript() /builds/worker/checkouts/gecko/dom/script/ScriptElement.cpp:118:18
    #31 0x7fb2f34c22ae in nsIScriptElement::AttemptToExecute() /builds/worker/workspace/obj-build/dist/include/nsIScriptElement.h:211:18
    #32 0x7fb2f34c1378 in nsHtml5TreeOpExecutor::RunScript(nsIContent*) /builds/worker/checkouts/gecko/parser/html/nsHtml5TreeOpExecutor.cpp:897:22
    #33 0x7fb2f34bff89 in nsHtml5TreeOpExecutor::RunFlushLoop() /builds/worker/checkouts/gecko/parser/html/nsHtml5TreeOpExecutor.cpp:690:7
    #34 0x7fb2f34c7377 in nsHtml5ExecutorFlusher::Run() /builds/worker/checkouts/gecko/parser/html/nsHtml5StreamParser.cpp:173:18
    #35 0x7fb2f142488f in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/checkouts/gecko/xpcom/threads/SchedulerGroup.cpp:140:20
    #36 0x7fb2f1471432 in mozilla::RunnableTask::Run() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:467:16
    #37 0x7fb2f143745d in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:770:26
    #38 0x7fb2f1434d18 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:606:15
    #39 0x7fb2f1435429 in mozilla::TaskController::ProcessPendingMTTask(bool) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:390:36
    #40 0x7fb2f1479bf1 in operator() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:124:37
    #41 0x7fb2f1479bf1 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.h:531:5
    #42 0x7fb2f14576c7 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1171:16
    #43 0x7fb2f1462b7c in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:467:10
    #44 0x7fb2f26110b8 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:85:21
    #45 0x7fb2f2518f81 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331:10
    #46 0x7fb2f2518f81 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324:3
    #47 0x7fb2f2518f81 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306:3
    #48 0x7fb2f87c70c7 in nsBaseAppShell::Run() /builds/worker/checkouts/gecko/widget/nsBaseAppShell.cpp:137:27
    #49 0x7fb2fcb7d26f in XRE_RunAppShell() /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:878:20
    #50 0x7fb2f2518f81 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331:10
    #51 0x7fb2f2518f81 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324:3
    #52 0x7fb2f2518f81 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306:3
    #53 0x7fb2fcb7cc90 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:715:34
    #54 0x561a7a7046bd in content_process_main(mozilla::Bootstrap*, int, char**) /builds/worker/checkouts/gecko/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
    #55 0x561a7a704ae1 in main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:327:18
    #56 0x7fb30c8960b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
    #57 0x561a7a6537ac in _start (/home/omair/Downloads/firefox-asan/firefox+0x587ac)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libnvidia-eglcore.so.510.47.03+0xc10510) 

The original report as published on Mozilla's Bugzilla, by Omair. 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 heap buffer overflow in the NVIDIA EGL driver when handling instanced draw calls from WebGL.

Impact

A website could crash the browser or potentially execute arbitrary code in the browser process.

What the attacker needed

Victim visits a malicious webpage; browser uses vulnerable NVIDIA driver

How it was found

  1. Open the provided HTML file in a browser with WebGL enabled.
  2. The page executes JavaScript that calls WebGL drawRangeElements with instancing.
  3. The browser passes the call to the graphics driver, triggering the overflow.

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.

WebGL lets websites draw 3D graphics using the graphics card. A bug in the graphics driver software caused it to read memory it shouldn't when a specific drawing command was used, crashing the browser. This could let an attacker run harmful code on your computer.

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 Omair

View all

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