Use after free in ANGLE (CVE-2026-9941)
A heap-use-after-free exists in ANGLE's Vulkan backend because raw pointers to default vertex attribute buffers are cached and not cleared when the underlying buffer is resized and freed. An attacker who grooms the heap could forge a BufferHelper object and potentially achieve arbitrary code execution in the unsandboxed GPU process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 43 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 heap-use-after-free exists in ANGLE's Vulkan backend due to dangling raw pointers in VertexArrayVk. When a DynamicBuffer resizes, old BufferHelper objects are deleted, but stale pointers remain cached in mCurrentArrayBuffers. Subsequent draw calls can dereference these pointers, providing an arbitrary memory increment primitive and potential driver-level exploitation.
Affected files:
third_party/angle/src/libANGLE/renderer/vulkan/VertexArrayVk.cppthird_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cppthird_party/angle/src/libANGLE/renderer/vulkan/ContextVk.cppthird_party/angle/src/libANGLE/renderer/vulkan/VertexArrayVk.h
Estimated timestamp from git blame: 2025-09-22
Summary
A potential heap-use-after-free (UAF) vulnerability has been identified in the ANGLE Vulkan backend. The issue originates from how default vertex attributes are cached. When a program uses an attribute that is disabled on the bound Vertex Array Object (VAO), ANGLE allocates a BufferHelper for the default value and stores a raw pointer to it in VertexArrayVk::mCurrentArrayBuffers. If the underlying DynamicBuffer is later forced to resize, the old BufferHelper objects are deleted from the heap during a command flush. However, the VertexArrayVk cache is not updated. A subsequent draw call can dereference this dangling pointer, allowing an attacker who grooms the heap to forge a BufferHelper object and achieve arbitrary code execution in the unsandboxed GPU process.
Technical Details
- Allocation: During
ContextVk::setupDraw, if a program uses a disabled attributeA,VertexArrayVk::updateDefaultAttribis called. This allocates memory viaDynamicBuffer::allocate, returning a rawBufferHelper*which is cached inVertexArrayVk::mCurrentArrayBuffers[A]. - The Free: If the attacker forces the
DynamicBufferfor attributeAto require a larger block size (e.g., via a large instanced draw call), the oldBufferHelperis moved to an in-flight list. Upon a Vulkan command flush (ContextVk::flushAndSubmitCommands),DynamicBuffer::updateQueueSerialAndReleaseInFlightBuffersdetects the size mismatch and clears the list. This destroys thestd::unique_ptrholding theBufferHelper, callingoperator deleteon the heap object. The raw pointer inmCurrentArrayBuffers[A]is now dangling. - The Use: The attacker issues a new draw call using a different program that does not use attribute
A, but uses an attributeBwhereB > A. BecauseAis not active,updateDefaultAttribis skipped, leaving the dangling pointer in place. However,ContextVkcallsmRenderPassCommands->buffersVertexAttribRead(..., maxAttrib). Since the new program'smaxAttribisB + 1, the loop iterates over indexAand dereferences the stale pointer, callingbuffer->recordReadBarrier(...).
Impact and Exploitability
By grooming the heap, an attacker can replace the freed BufferHelper (approx 488 bytes) with controlled data. When recordReadBarrier is called on the forged object, it reads a forged mCurrentWriteEvent handle.
- Arbitrary Increment: The forged handle is passed to
eventCollector->emplace_back, invokingRefCountedEvent's copy constructor, which callsmHandle->addRef(). This performs an atomic 32-bit increment (mRefCount++) at the attacker-supplied memory address. - Driver-Level Execution: Later, when the event collector is cleared, the forged event's destructor calls
vkDestroyEvent(device, mHandle->event, nullptr). Passing an attacker-controlled handle to the Vulkan driver can allow the attacker to free arbitrary driver memory or hijack execution, leading to full Remote Code Execution (RCE) in the GPU process. Note that the GPU process is unsandboxed on Android.
mCurrentArrayBuffers is a standard std::array of raw pointers, so it is not protected by MiraclePtr/BRP.
Potential Attacker Steps (Suggested)
Note: Our tooling agent does not have the ability to run code, these are suggested steps based on static analysis.
- Create a WebGL2 context and a VAO.
- Compile Program 1 (uses attribute 0) and Program 2 (uses attribute 1).
- Disable attribute 0 (
glDisableVertexAttribArray(0)). - Call
glUseProgram(Program 1)andglDrawArrays(...)to cache a defaultBufferHelperpointer for attribute 0. - Force a resize of the
DynamicBufferfor attribute 0 (e.g., enable it, set a divisor, and draw a massive number of instances). - Trigger a flush (e.g.,
glReadPixels) to free the oldBufferHelperobject. - Groom the heap with controlled data to forge the
BufferHelperstructure at the freed location. - Call
glUseProgram(Program 2)andglDrawArrays(...)to trigger the UAF and execute the exploit primitives.
Suggested Fix
Replace the raw pointers in gl::AttribArray<vk::BufferHelper *> mCurrentArrayBuffers with a safer mechanism. Options include:
- Using
BackupRefPtr(e.g.,base::raw_ptr<vk::BufferHelper>) to immediately mitigate the exploitability by turning the UAF into a safe crash. - Having
VertexArrayVkobserve the destruction ofBufferHelperobjects or strictly clearingmCurrentArrayBuffersfor indices that are not active in the current program duringsetupDraw.
Evaluated with Chrome root at commit: c0eb5541aebfa4ea08806eaf6e94bcc69f87ab2f
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 raw pointers in VertexArrayVk::mCurrentArrayBuffers are not cleared when the corresponding BufferHelper objects are deleted during a DynamicBuffer resize, leaving dangling pointers that are later dereferenced.
Impact
An attacker who grooms the heap could forge a BufferHelper object and potentially achieve arbitrary code execution in the unsandboxed GPU process on Android.
What the attacker needed
WebGL2 support; Ability to run JavaScript in a browser; Heap grooming capability
The fix
The raw pointers in mCurrentArrayBuffers should be replaced with a safer mechanism such as BackupRefPtr or by clearing the cache for inactive attributes during setupDraw.
How it was found
- Create a WebGL2 context and a VAO.
- Compile Program 1 (uses attribute 0) and Program 2 (uses attribute 1).
- Disable attribute 0.
- Call glUseProgram(Program 1) and glDrawArrays to cache a default BufferHelper pointer for attribute 0.
- Force a resize of the DynamicBuffer for attribute 0 (e.g., enable it, set a divisor, and draw a massive number of instances).
- Trigger a flush (e.g., glReadPixels) to free the old BufferHelper object.
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.
When a program uses a vertex attribute that is turned off, the graphics driver creates a temporary buffer to hold a default value and keeps a pointer to it. If that buffer is later resized, the old buffer is freed but the pointer is not updated, so a later draw call uses memory that has already been freed. An attacker who can control what is placed in that freed memory could trick the driver into running their 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.