Use after free in ANGLE (CVE-2026-17718)
A heap-use-after-free exists in ANGLE's Vulkan backend because VertexArrayVk caches raw pointers to BufferHelper objects that can be destroyed during DynamicBuffer resizing. An attacker could trigger this via WebGL to achieve memory corruption in the GPU process, potentially leading to full system compromise on Android where the GPU process is unsandboxed.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 50 days
Flapjack, 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential heap-use-after-free vulnerability exists in ANGLE's Vulkan backend because VertexArrayVk caches raw pointers to vk::BufferHelper objects that can be destroyed during DynamicBuffer resizing. If a previously streamed attribute is inactive in a subsequent draw call, its cached pointer is not updated, leaving a dangling pointer. When vertex buffers are synchronized, iterating up to the maximum active attribute index causes the dangling pointer to be dereferenced.
Affected files:
third_party/angle/src/libANGLE/renderer/vulkan/VertexArrayVk.cppthird_party/angle/src/libANGLE/renderer/vulkan/ContextVk.cppthird_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.h
Estimated timestamp from git blame: 2025-09-22
Technical Details
A potential heap-use-after-free (UAF) vulnerability has been identified in the Vulkan backend of ANGLE. The issue stems from VertexArrayVk maintaining dangling raw pointers to vk::BufferHelper objects that have been destroyed.
Root Cause Analysis
In ANGLE's Vulkan backend, VertexArrayVk caches pointers to vertex buffer helpers in its mCurrentArrayBuffers array. For vertex attributes that use client-side memory streaming, these BufferHelper objects are dynamically allocated from ContextVk::mStreamedVertexBuffers.
While WebGL normally restricts client-side memory pointers, an attacker can force ANGLE to use client-side streaming by enabling the ANGLE_instanced_arrays extension and setting a vertexAttribDivisor that exceeds the Vulkan backend's maximum limit (which is capped at 255). This flags the attribute for divisor emulation via streaming.
The vulnerability occurs due to a lifecycle mismatch between the DynamicBuffer managing the memory and the cached pointers in VertexArrayVk:
- Dynamic Buffer Resizing: When
ContextVk::mStreamedVertexBuffersneeds more space, it pushes oldBufferHelperblocks to an in-flight list. After a GPU flush, these blocks move to a free list. If the block size needs to change significantly,DynamicBuffer::allocateclears the free list, deleting theBufferHelperC++ objects and freeing their memory. - Partial Synchronization: Before a draw call,
VertexArrayVk::updateStreamedAttribsupdates the cached pointers inmCurrentArrayBuffers. However, it only updates attributes that are both enabled and active in the current shader program (mStreamingVertexAttribsMask & activeAttribs). - Dangling Pointer: If a VAO has a streamed attribute (e.g., Attribute 0) that was previously cached, but the current draw call uses a shader program where Attribute 0 is inactive,
updateStreamedAttribsskips it. If the underlyingBufferHelperwas destroyed by another VAO causing a resize,mCurrentArrayBuffers[0]now contains a dangling pointer. - UAF Trigger:
ContextVk::handleDirtyGraphicsVertexBuffersVertexInputDynamicStateDisabledcallsmRenderPassCommands->buffersVertexAttribRead(..., maxAttrib), wheremaxAttribis the maximum active attribute location. If Attribute 1 is active,maxAttribis at least 2. The function iterates from 0 tomaxAttrib - 1, dereferencing the dangling pointer at index 0 to callbufferRead, resulting in a UAF.
Potential Trigger Steps
Note: Our tooling agent does not run code, so these are suggested steps based on static analysis.
- Create a WebGL context with the
ANGLE_instanced_arraysextension. - Create and bind
vao1. Bind a WebGL buffer, enable Attribute 0 and Attribute 1, and configure them. - Call
gl.vertexAttribDivisor(0, 0xFFFFFFFF)to force Attribute 0 into client-side streaming emulation. - Draw using
programA(which uses both attributes). ANGLE allocates aBufferHelperand caches its pointer invao1'smCurrentArrayBuffers[0]. - Create and bind
vao2. Configure it identically tovao1to use streaming on Attribute 0. - Execute numerous, large draw calls using
vao2. This exhausts the per-contextDynamicBufferblock, pushing the originalBufferHelperto the in-flight list. - Force a GPU flush (e.g.,
gl.readPixels()), moving theBufferHelperto the free list. - Execute another draw call with
vao2using a vastly different allocation size.DynamicBuffer::allocateresizes its blocks and clears the free list, destroying the originalBufferHelperC++ object. - Rebind
vao1. ThemCurrentArrayBuffers[0]pointer is now dangling. - Draw using
programB(which uses Attribute 1, but not Attribute 0). updateStreamedAttribsskips Attribute 0 because it is inactive.buffersVertexAttribReaditerates up tomaxAttrib(which is >= 2), accessing index 0 and dereferencing the freed pointer.
Impact
This vulnerability can be triggered via WebGL, allowing a malicious website to achieve memory corruption in the GPU process. Because the GPU process is unsandboxed on Android, this could allow for a full system compromise.
Suggested Fix
To address this issue, VertexArrayVk::updateStreamedAttribs should ensure that all cached pointers in VertexArrayVk are reset to a safe fallback (such as ContextVk::mEmptyBuffer) if they are inactive but their underlying BufferHelper might have been invalidated. Alternatively, buffersVertexAttribRead could iterate over the active attribute mask instead of all indices up to maxAttrib.
Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
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, VertexArrayVk caches raw pointers to BufferHelper objects that can be destroyed when DynamicBuffer resizes, and updateStreamedAttribs only refreshes pointers for attributes that are active in the current shader, leaving inactive attributes with dangling pointers that are later dereferenced.
Impact
This vulnerability can be triggered via WebGL, allowing a malicious website to achieve memory corruption in the GPU process; because the GPU process is unsandboxed on Android, this could allow for a full system compromise.
What the attacker needed
Victim visits a malicious webpage; WebGL with ANGLE_instanced_arrays; Android for full system compromise
The fix
VertexArrayVk::updateStreamedAttribs should reset cached pointers to a safe fallback (such as ContextVk::mEmptyBuffer) if they are inactive but their underlying BufferHelper might have been invalidated, or buffersVertexAttribRead should iterate over the active attribute mask instead of all indices…
How it was found
- Create a WebGL context with the ANGLE_instanced_arrays extension.
- Create and bind vao1, bind a WebGL buffer, enable Attribute 0 and Attribute 1, and configure them.
- Call gl.vertexAttribDivisor(0, 0xFFFFFFFF) to force Attribute 0 into client-side streaming emulation.
- Draw using programA (which uses both attributes) so ANGLE allocates a BufferHelper and caches its pointer in vao1.
- Create and bind vao2, configure it identically to vao1, and execute numerous large draw calls to exhaust the DynamicBuffer block and push the original BufferHelper to the in-flight list.
- Force a GPU flush (e.g., gl.readPixels()) to move the BufferHelper to the free list, then execute another draw call with vao2 using a vastly different allocation size to resize blocks and destroy the original BufferHelper.
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, and later uses it as if it were still valid. Here, a WebGL page can cause the browser's graphics code to free a buffer object but leave a stale pointer to it, and then a later drawing operation reads through that stale pointer. This can corrupt memory in the GPU process, which on Android runs without a sandbox, so it could be serious.
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.