Use after free in ANGLE (CVE-2026-9946)
A use-after-free exists in ANGLE's parallel shader linking because a background linking task holds a raw reference to a destroyed Context's capabilities. An attacker with a compromised renderer could trigger this to achieve arbitrary code execution in the GPU process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 41 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see go/chrome-ai-generated-security-bugs-faq for more information.
Overview: A potential Use-After-Free vulnerability exists in ANGLE's parallel shader linking when a background worker thread (MainLinkTask) holds a raw reference to a destroyed Context's capabilities. An attacker can trigger this by utilizing a shared context group and forcing context loss while an unbound program is linking in the background. This allows a compromised renderer to achieve arbitrary code execution in the GPU process.
Affected files:
third_party/angle/src/libANGLE/Program.cppthird_party/angle/src/libANGLE/Context.cppgpu/command_buffer/service/gles2_cmd_decoder_passthrough.ccthird_party/angle/src/libANGLE/State.h
Estimated timestamp from git blame: 2023-10-24
Summary
A potential Use-After-Free (UAF) vulnerability has been identified in ANGLE's parallel shader compilation logic. The MainLinkTask class, which handles background program linking, captures raw C++ references to the Caps and Limitations structures (const Caps &mCaps;) owned by the Context's inline PrivateState.
When a Context is destroyed, its PrivateState and the associated Caps memory are freed. However, Context::onDestroy only ensures that pending link tasks for the currently bound program (or pipeline) are explicitly joined. If a linking program is unbound and the context is destroyed, the background thread will continue executing and eventually dereference the freed Caps memory, resulting in a UAF.
Potential Trigger Steps
An attacker with a compromised renderer process could theoretically trigger this via the command buffer IPCs to the GPU process:
- Setup Shared Context: The attacker requests a GLES2 command buffer (creating Context A). They then send an IPC like
CopySharedImageINTERNAL, which lazily initializeslazy_context_in the passthrough decoder. This creates Context B, which explicitly shares the same ANGLEShareGroupas Context A. - Start Background Link: The attacker creates a shader program, attaches complex shaders (to prolong linking), and calls
glLinkProgram. This creates aMainLinkTaskthat captures a reference to Context A'sCapsand is dispatched to a background worker thread. - Unbind Program: The attacker calls
glUseProgram(0)to ensure the program is no longer currently bound to Context A. - Force Context Teardown: The attacker sends a
LoseContextCHROMIUMcommand and destroys the command buffer. Context A is destroyed. - Bypass Link Resolution: Because the program is unbound,
Context::onDestroy's call tomState.ensureNoPendingLink(this)ignores it, failing to join the background thread. - Program Leakage: Context A is destroyed, freeing its
Caps. However, Context B keeps theShareGroup(and thus theShaderProgramManagerand the linking program) alive. - UAF: The worker thread continues execution and accesses fields like
caps.maxVertexAttributesfrom the freed memory.
Note: These are suggested steps based on source code analysis; our tooling agent cannot execute code to provide a live proof-of-concept.
Impact
By utilizing heap spraying techniques in the GPU process before Context A is fully destroyed, an attacker could potentially control the freed Caps memory. Modifying values like maxVertexAttributes bypasses bounds checks during linking (e.g., when populating usedAttribMap in Program::linkAttributes), leading to arbitrary out-of-bounds reads and writes. Because ANGLE is a third-party library without MiraclePtr protections, this UAF can be reliably exploited for a renderer-to-GPU sandbox escape.
Suggested Fix
- Capture by Value: Update
MainLinkTask(and related structures) to captureCaps,Limitations, andVersionby value rather than by reference. These structures are relatively small and copying them would guarantee the worker thread does not depend on the lifetime of theContext. - Complete Thread Joining: Ensure that
Context::onDestroyorShaderProgramManagerproperly joins all background compilation/linking threads belonging to the context/share group upon destruction, even if the program is not currently bound.
Evaluated with Chrome root at commit: 661452647ddb2827305122ff3273bd5dea403f09
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
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, the background linking task captures raw references to the Context's capabilities instead of copying them, and context destruction does not wait for unbound linking programs to finish.
Impact
An attacker with a compromised renderer could potentially control the freed memory via heap spraying and achieve arbitrary code execution in the GPU process, leading to a sandbox escape.
What the attacker needed
Compromised renderer process; ability to send GPU command buffer IPCs
The fix
The fix should capture the capabilities by value and ensure all background linking threads are joined on context destruction.
How it was found
- Create a shared context group by requesting a GLES2 command buffer and triggering lazy context creation.
- Start a background link by creating a program with complex shaders and calling glLinkProgram.
- Unbind the program with glUseProgram(0).
- Force context teardown by sending LoseContextCHROMIUM and destroying the command buffer.
- Because the program is unbound, the pending link is not joined and the background thread continues.
- The background thread accesses freed memory, causing a use-after-free.
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.
A use-after-free happens when a program keeps using memory after it has been freed. Here, a background task that links shaders still points to data from a graphics context that has been destroyed. If an attacker can control what is placed in that freed memory, they could run their own code in the GPU process.
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.