Use after free in ANGLE (CVE-2026-9932)
A use-after-free in ANGLE's D3D11 backend occurs when a mapped buffer's staging storage is garbage-collected because the buffer is bound to multiple uniform blocks and drawn. An attacker with a compromised renderer could potentially execute arbitrary code in the GPU process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 47 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.
Overview: A Use-After-Free vulnerability exists in ANGLE's D3D11 backend when a mapped buffer's staging storage is prematurely garbage-collected. This occurs if a read-only mapped buffer is bound to multiple uniform blocks and drawn, causing its idleness counter to exceed the deallocation threshold. An attacker could potentially exploit this from a compromised renderer to execute arbitrary code in the GPU process.
Affected files:
third_party/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cppthird_party/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.hthird_party/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
Estimated timestamp from git blame: 2025-05-14
Vulnerability Details
In ANGLE's D3D11 backend, Buffer11 manages multiple storage representations for a single GL buffer (e.g., SYSTEM_MEMORY, STAGING, UNIFORM). To optimize memory, Buffer11::garbageCollection periodically deallocates unused storages.
A Use-After-Free (UAF) condition can occur because the raw pointer Buffer11::mMappedStorage can be left dangling if its underlying storage object is reclaimed by garbage collection while the buffer is mapped. This relies on two distinct logic flaws:
- Priority Inversion in Mapping: When a buffer is mapped with
GL_MAP_READ_BITand itsmLatestBufferStorageisSYSTEM_MEMORY,Buffer11::mapRangecreates aSTAGINGstorage to provide CPU access. However, becauseBUFFER_USAGE_STAGING(index 1) does not have a strictly lower priority index thanBUFFER_USAGE_SYSTEM_MEMORY(index 0),mLatestBufferStorageremains pointing toSYSTEM_MEMORY.mMappedStorageis set to the newSTAGINGstorage. - Lack of UBO Mapping Validation: ANGLE's draw-time validation (
ValidateDrawStates) correctly prevents drawing if vertex or index buffers are mapped, but fails to validate the mapped state of Uniform Buffers (UBOs).
If a draw call is issued while the buffer is mapped and bound to multiple uniform blocks, StateManager11::syncUniformBuffersForShader iterates through the uniform bindings. For each binding, it calls Buffer11::getConstantBufferRange, which ultimately triggers garbageCollection and checkForDeallocation(BUFFER_USAGE_STAGING).
Each iteration increments mIdleness[BUFFER_USAGE_STAGING]. If the shader uses more than 8 uniform block bindings (the default deallocation threshold), the idleness exceeds the threshold. Because mLatestBufferStorage is SYSTEM_MEMORY, latestStorage != storage evaluates to true, and SafeDelete(storage) destroys the STAGING object.
mMappedStorage is completely unaware of this deletion. A subsequent call to glUnmapBuffer will trigger the virtual function mMappedStorage->unmap(), resulting in a virtual call on a freed object.
Potential Reproduction Steps
Note: These are suggested steps based on static analysis. Our tooling does not yet execute code to provide a working proof-of-concept.
- From a compromised renderer process, establish a WebGL2/GLES3 context that uses the passthrough command decoder (default on Windows for ANGLE D3D11).
- Create a GL buffer and initialize it with
GL_DYNAMIC_DRAWorGL_STREAM_DRAW. This sets the internal D3D usage to dynamic, forcing ANGLE to useSYSTEM_MEMORYas themLatestBufferStorage. - Compile a shader program that actively uses at least 9 uniform block bindings.
- Bind the buffer to all 9 uniform block binding points (
glBindBufferBase(GL_UNIFORM_BUFFER, 0 through 8)). - Map the buffer for reading via
MapBufferRangewithGL_MAP_READ_BIT. ANGLE allocatesSTAGINGstorage and pointsmMappedStorageto it. - Issue a
DrawArrayscommand. ANGLE fails to validate that the UBO is mapped, allowing the draw to proceed. - The loop in
syncUniformBuffersForShaderfetches the storage for each of the 9 bindings, callinggarbageCollection9 times. - On the 9th iteration,
mIdleness[STAGING]reaches 9, exceeding the threshold of 8. TheSTAGINGstorage isSafeDeleted. - (Optional) Spray the GPU process heap to reclaim the freed
NativeStorageobject and counterfeit its vtable. - Unmap the buffer (
glUnmapBuffer). The GPU process executesmMappedStorage->unmap(), dereferencing the attacker's payload and achieving Remote Code Execution in the GPU process.
Suggested Fix
There are multiple ways to address this issue:
- Prevent Deallocation of Mapped Storage: Update
Buffer11::checkForDeallocationto explicitly prevent deleting the storage if it is currently mapped:C++ if (storage != nullptr && storage != mMappedStorage && mIdleness[usage] > mDeallocThresholds[usage]) { // ... existing deletion logic ... } - Validate UBO Mapped State: Update ANGLE's top-level API validation (e.g.,
ValidateProgramDrawStates) to return an error (likekBufferMapped) if any active Uniform Buffer Object is currently mapped, bringing UBOs in line with vertex and index buffer validation. - Modernize Pointers: ANGLE relies extensively on raw pointers. Migrating ANGLE's pointers (like
mMappedStorage) tobase::raw_ptrwould mitigate the exploitability of this and similar UAFs by transforming them into safe, non-exploitable crashes via MiraclePtr/BackupRefPtr.
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
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 combination of a priority inversion that leaves the mapped storage pointer dangling and missing validation that uniform buffers are not mapped during draw calls, allowing garbage collection to free the staging storage.
Impact
An attacker with a compromised renderer could potentially execute arbitrary code in the GPU process, though the report notes the reproduction steps are based on static analysis and no working proof-of-concept was executed.
What the attacker needed
Compromised renderer process; Windows with ANGLE D3D11 backend; shader with at least 9 uniform blocks
The fix
The report suggests preventing deallocation of mapped storage, validating that uniform buffers are not mapped during draw calls, and migrating raw pointers to safe pointer types; it does not state that a fix was applied.
How it was found
- From a compromised renderer, create a WebGL2/GLES3 context using the passthrough command decoder.
- Create a GL buffer with dynamic or stream draw usage so its latest storage is system memory.
- Compile a shader that uses at least nine uniform block bindings.
- Bind the buffer to all nine uniform block binding points.
- Map the buffer for reading, which allocates staging storage and sets the mapped storage pointer.
- Issue a draw call; the uniform buffer sync loop triggers garbage collection and frees the staging storage.
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 is a bug where a program keeps a pointer to memory after that memory has been freed, so later use can run attacker-controlled data. Here, a graphics buffer's temporary copy is deleted while still in use, and a later unmap call jumps through the freed object. An attacker who already controls the renderer process could use this to run code in the more privileged 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.