Out of bounds read and write in Angle (CVE-2026-7354)
The Vulkan backend of ANGLE incorrectly sets the compute shader's workload to the full source buffer size instead of the remaining size after the draw offset when emulating uint8 index buffers. This causes the shader to write far beyond the allocated destination suballocation, potentially corrupting adjacent GPU memory and enabling a sandbox escape.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 28 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 security team.
Overview: A potential out-of-bounds read and write vulnerability exists in ANGLE's Vulkan backend when emulating uint8 index buffers. The convertIndexBufferGPU function incorrectly uses the full source buffer size to set the compute shader's workload, rather than the remaining size after the draw offset. Because ANGLE uses memory suballocations, this causes the shader to massively overrun the destination suballocation, potentially leading to arbitrary GPU memory corruption.
Affected files:
src/libANGLE/renderer/vulkan/VertexArrayVk.cppsrc/libANGLE/renderer/vulkan/shaders/src/ConvertIndex.compsrc/libANGLE/renderer/vulkan/UtilsVk.cpp
Estimated timestamp from git blame: 2022-01-06
Summary
There is a potential out-of-bounds (OOB) read and write vulnerability in VertexArrayVk::convertIndexBufferGPU within ANGLE's Vulkan backend. On Vulkan implementations that do not support the VK_EXT_index_type_uint8 extension, ANGLE emulates uint8 indices by converting them to uint16 indices using a compute shader (ConvertIndex.comp).
When calculating the shader parameters, the code incorrectly uses the total size of the original buffer as the maxIndex limit, instead of calculating the limit based on the size of the data actually being converted (total size minus the draw offset). This mismatch results in the shader writing far beyond its allocated destination buffer.
Technical Details
In third_party/angle/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp, the convertIndexBufferGPU function correctly calculates the size of the data that needs to be converted and allocates the destination suballocation accordingly:
// srcDataSize is correctly bounded by the offset
size_t srcDataSize = static_cast<size_t>(bufferVk->getSize()) - offsetIntoSrcData;
// Allocate buffer for results (e.g. if srcDataSize is 3, allocates ~6 bytes)
ANGLE_TRY(contextVk->initBufferForVertexConversion(&mTranslatedByteIndexData,
sizeof(GLushort) * srcDataSize,
vk::MemoryHostVisibility::NonVisible));
However, a few lines later, when preparing the parameters for the compute shader, maxIndex is set to the full size of the original buffer, disregarding the offset:
params.maxIndex = static_cast<uint32_t>(bufferVk->getSize()); // Flawed!
This maxIndex determines how many workgroups are dispatched and dictates the bounds check inside the ConvertIndex.comp compute shader. If an attacker supplies a large buffer but issues a draw call with an offset near the end of the buffer, srcDataSize will be very small, resulting in a tiny destination suballocation. However, maxIndex will remain extremely large.
The compute shader will consequently write maxIndex * 2 bytes to the destination array. Because ANGLE pools allocations into large (e.g., 8MB) BufferBlocks backing a single VkBuffer/VkDeviceMemory, standard Vulkan robustBufferAccess hardware checks (which only validate against the underlying memory object bounds) are bypassed. The out-of-bounds write corrupts adjacent suballocations within the shared buffer pool.
Potential Exploitation Steps
Note: These are suggested steps to trigger the vulnerability based on code analysis. Our tooling agent does not currently have the capability to run a working Proof of Concept (PoC) to verify execution natively.
- Environment: Target a device lacking
VK_EXT_index_type_uint8(common on many Android Vulkan drivers). - Buffer Creation: In WebGL, create a large
ELEMENT_ARRAY_BUFFER(e.g., 65,536 bytes). - Pool Grooming: Carefully create and delete other WebGL buffers to groom the Vulkan
BufferPool. The goal is to position a sensitive object—like an indirect draw command buffer (VkDrawIndexedIndirectCommand) or a Uniform Buffer Object (UBO)—immediately after the destination suballocation for the upcoming conversion. - Force GPU Path: Issue a benign draw call using the source buffer to make it "GPU-busy." This forces ANGLE to take the asynchronous GPU compute shader conversion path instead of the CPU mapping path.
- Trigger Bug: Call
gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_BYTE, 65533), where65533is the offset. - Result: ANGLE allocates a tiny destination suballocation (~6 bytes) but commands the shader to process 65,536 indices. The shader writes ~131KB out-of-bounds, overwriting the groomed target object. This could allow the attacker to execute arbitrary indirect commands on the GPU, leading to a Renderer-to-GPU Sandbox Escape.
Suggested Fix
Update VertexArrayVk::convertIndexBufferGPU to calculate maxIndex based on srcDataSize rather than the total buffer size.
// Fix in src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
params.srcOffset = static_cast<uint32_t>(offsetIntoSrcData);
params.dstOffset = 0;
- params.maxIndex = static_cast<uint32_t>(bufferVk->getSize());
+ params.maxIndex = static_cast<uint32_t>(srcDataSize);
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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 code sets the compute shader's maxIndex parameter to the full buffer size instead of the size of the data actually being converted after the draw offset.
Impact
This could allow the attacker to execute arbitrary indirect commands on the GPU, leading to a Renderer-to-GPU Sandbox Escape.
What the attacker needed
Device lacking VK_EXT_index_type_uint8; ability to run WebGL content; careful GPU memory grooming
The fix
The fix is to calculate maxIndex based on srcDataSize rather than the total buffer size.
How it was found
- Target a device lacking VK_EXT_index_type_uint8 (common on many Android Vulkan drivers).
- In WebGL, create a large ELEMENT_ARRAY_BUFFER (e.g., 65,536 bytes).
- Carefully create and delete other WebGL buffers to groom the Vulkan BufferPool, positioning a sensitive object immediately after the destination suballocation.
- Issue a benign draw call using the source buffer to make it GPU-busy, forcing ANGLE to take the asynchronous GPU compute shader conversion path.
- Call gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_BYTE, 65533), where 65533 is the offset.
- ANGLE allocates a tiny destination suballocation (~6 bytes) but commands the shader to process 65,536 indices, writing ~131KB out-of-bounds and overwriting the groomed target 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 graphics driver lacks native support for 8-bit index buffers, ANGLE converts them to 16-bit using a GPU compute shader. The bug is that the shader is told to process the entire original buffer size, even when only a small part is needed, so it writes past the end of a small allocated buffer. This can overwrite other GPU memory and potentially let an attacker run malicious commands on the GPU.
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.