Out of bounds read in ANGLE (CVE-2026-87586)
ANGLE's Vulkan backend passes the full buffer size instead of the remaining size when mapping an index buffer range, causing a GPU-side out-of-bounds read on discrete GPUs. An attacker could trigger this via WebGL2 by setting a vertex attribute divisor above 255, forcing streaming emulation that reaches the vulnerable path.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 52 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: An out-of-bounds GPU-side read vulnerability exists in ANGLE's Vulkan backend because BufferVk::getIndexRange incorrectly passes the full buffer size instead of the remaining size to mapRangeForReadAccessOnly. On discrete GPUs, this causes vkCmdCopyBuffer to read past the end of the suballocation when mapping device-local memory. The vulnerable path is reachable via WebGL2 by forcing streaming vertex attribute emulation.
Affected files:
third_party/angle/src/libANGLE/renderer/vulkan/BufferVk.cppthird_party/angle/src/libANGLE/renderer/vulkan/BufferVk.hthird_party/angle/src/libANGLE/renderer/vulkan/VertexArrayVk.cppthird_party/angle/src/libANGLE/renderer/vulkan/ContextVk.cpp
Estimated timestamp from git blame: 2021-05-08
1. Summary of the Issue (Meant for Human Triage)
ANGLE's Vulkan backend contains a potential out-of-bounds (OOB) memory read vulnerability in the BufferVk::getIndexRange implementation due to an incorrect buffer length calculation. When computing an index range, the code maps a range of the buffer starting at a client-controlled offset. However, instead of passing the remaining buffer size (getSize() - offset), it passes the full size of the buffer (getSize()) as the length argument to mapRangeForReadAccessOnly.
On systems using discrete Vulkan GPUs (such as dedicated NVIDIA or AMD GPUs on Linux, ChromeOS, or Windows), index buffers are typically allocated in device-local memory (!isHostVisible()). Consequently, the mapping requests are routed to handleDeviceLocalBufferMap, which allocates a staging buffer and schedules a GPU-to-GPU copy via vkCmdCopyBuffer to pull the data into host-visible memory. Because vkCmdCopyBuffer is instructed to copy getSize() bytes starting from the offset, it attempts to read up to offset bytes past the end of the buffer's designated suballocation within the shared BufferBlock pool. This leads to a GPU-side out-of-bounds read, violating Vulkan specification parameter constraints (VUID-vkCmdCopyBuffer-srcOffset-00113) and potentially exposing data from adjacent suballocations into the staging buffer.
Crucially, this path can be reached by a compromised renderer or standard WebGL2 content by setting a vertex attribute divisor greater than 255. This forces ANGLE to use a streaming vertex attribute emulation path that calls getIndexRange without being gated by standard robust buffer access checks.
2. Proof-of-Concept & Detailed Execution Flow
The following is a step-by-step sequence of events that results in the vulnerability, based on static analysis of the codebase:
- Environment Setup: The attacker requires a target running Chrome on an OS equipped with a discrete Vulkan GPU (
VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU). On these systems, ANGLE's Vulkan backendcanPreferDeviceLocalMemoryHostVisiblereturnsfalse(third_party/angle/src/libANGLE/renderer/vulkan/vk_renderer.cpp:5443). - Buffer Creation: The attacker creates an index buffer using standard WebGL2 API calls:
const ib = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ib); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, 0x100000, gl.STATIC_DRAW);. - Device-Local Allocation: Because
STATIC_DRAWis used,BufferVk::GetPreferredMemoryTypeselectskDeviceLocalFlagswithout theHOST_VISIBLEbit (third_party/angle/src/libANGLE/renderer/vulkan/BufferVk.cpp:83-86). The buffer's memory (mBuffer) is suballocated from a larger, sharedBufferBlock, andmBuffer.isHostVisible()evaluates to false. - Buffer Population: The attacker populates a small set of valid indices near the end of the allocated buffer space:
gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0xFFFF0, new Uint32Array([0,0,0]));. - Streaming Emulation Trigger: The attacker binds a vertex buffer to an attribute and calls
gl.vertexAttribDivisor(0, 0x10000). - Divisor Validation Bypass: In
vk_renderer.cpp:3958-3960, ANGLE strictly capsmMaxVertexAttribDivisorat 255. However, there is no client-side or WebGL frontend check that caps the divisor provided by the attacker. - Streaming Mask Flagging: When ANGLE processes the vertex array state in
VertexArrayVk::syncState, it recognizes that0x10000 > renderer->getMaxVertexAttribDivisor(). It sets a bit inmDivisorExceedMaxSupportedValueBindingMask(VertexArrayVk.cpp:1009-1011). - Attribute Opt-in: Subsequently,
VertexArrayVk::syncStatefolds the attributes bound to this binding intomStreamingVertexAttribsMask(VertexArrayVk.cpp:1037-1044). This forces ANGLE to emulate the vertex fetch for this attribute using CPU streaming. - Draw Call Execution: The attacker executes an indexed draw call with a large offset:
gl.drawElementsInstanced(gl.TRIANGLES, 3, gl.UNSIGNED_INT, 0xFFFF0, 1);. The WebGL frontend validation allows this becauseoffset + count * typeSize(0xFFFF0 + 12) is less than the buffer's size (0x100000). - Draw Setup:
ContextVk::setupDrawdetects the streaming attribute (getStreamingVertexAttribsMask().any()) and unconditionally invokesVertexArrayVk::updateStreamedAttribs(ContextVk.cpp:1663-1670). This path ignores the standardisBufferAccessValidationEnabled()check. - Index Range Lookup: To know which vertices to stream,
updateStreamedAttribscallsGetVertexRangeInfo(renderer_utils.cpp:1610-1615), which delegates tovao->getIndexRange(...), eventually landing inBufferVk::getIndexRange(BufferVk.cpp:968). - The Vulnerable Map Call: Inside
BufferVk::getIndexRange, ANGLE attempts to map the index buffer to read the index data. It callsANGLE_TRY(mapRangeForReadAccessOnly(contextVk, offset, getSize(), &mapPtr));(BufferVk.cpp:989). - Root Cause Failure: The
lengthargument is incorrectly passed as the full size of the buffer (getSize()), rather than the correct remaining size (getSize() - offset). Contrast this withgetSubData(BufferVk.cpp:963), which correctly calculates bounds. - Device-Local Fallthrough:
mapRangeForReadAccessOnlyforwards tomapRangeImpl. BecausehostVisibleis false for this device-local buffer, it executeshandleDeviceLocalBufferMap(contextVk, offset, length, mapPtrBytes)(BufferVk.cpp:841), wherelengthis0x100000. - Staging Buffer Allocation:
handleDeviceLocalBufferMapallocates a host-visible staging buffer large enough to holdsize(allocStagingBufferatBufferVk.cpp:676). - OOB Copy Region Formulation: The code creates a
VkBufferCopyregion:VkBufferCopy copyRegion = {mBuffer.getOffset() + offset, mStagingBuffer.getOffset(), size};(BufferVk.cpp:680). - GPU Command Recording: The source read boundary is
mBuffer.getOffset() + 0xFFFF0 + 0x100000. Since the buffer's true allocated size is approximately0x100000, the read bound overshoots the end of the suballocation by0xFFFF0bytes. The commandcommandBuffer->copyBuffer(...)is recorded (BufferVk.cpp:302). - Sink Triggered: When the command buffer is submitted, the GPU executes
vkCmdCopyBuffer. It reads0xFFFF0bytes past the end of the index buffer's suballocation, copying data from adjacent suballocations within the sharedBufferBlockinto the trailing portion of the staging buffer. This is a GPU-memory-resident out-of-bounds read.
Suggested Remediation
The length parameter passed to mapRangeForReadAccessOnly in BufferVk::getIndexRange should be corrected to account for the offset, preventing the copy from exceeding the buffer bounds.
--- a/third_party/angle/src/libANGLE/renderer/vulkan/BufferVk.cpp
+++ b/third_party/angle/src/libANGLE/renderer/vulkan/BufferVk.cpp
@@ -986,7 +986,7 @@
ANGLE_TRACE_EVENT0("gpu.angle", "BufferVk::getIndexRange");
void *mapPtr;
- ANGLE_TRY(mapRangeForReadAccessOnly(contextVk, offset, getSize(), &mapPtr));
+ ANGLE_TRY(mapRangeForReadAccessOnly(contextVk, offset, getSize() - offset, &mapPtr));
*outRange = gl::ComputeIndexRange(type, mapPtr, count, primitiveRestartEnabled);
ANGLE_TRY(unmapReadAccessOnly(contextVk));
3. Technical Verification Details (Automated Audit Logs - Reviewers may skip this section)
Prior Critic Verdict:
Severity: Medium (S2)
Brief Notes / Reasoning: The report accurately identifies an out-of-bounds read vulnerability in ANGLE's Vulkan backend. In
BufferVk::getIndexRange, thelengthparameter passed tomapRangeForReadAccessOnlyis incorrectly set to the total buffer size (getSize()) rather than the remaining size (getSize() - offset). When an attacker provides a non-zerooffset(e.g., viagl.drawElementsInstanced), this causes the mapped range[offset, offset + getSize()]to exceed the source buffer's actual size. On discrete GPUs where the index buffer is device-local,handleDeviceLocalBufferMapis invoked, issuing aVkBufferCopythat reads up tooffsetbytes past the end of the suballocation inside the sharedBufferBlockVkBuffer.The trigger path using WebGL2
vertexAttribDivisor> 255 to force the streaming-attribs path (which bypasses standard robust buffer access checks) is valid, as ANGLE limitsmMaxVertexAttribDivisorto 255 but emulates larger divisors by setting themStreamingVertexAttribsMask.Per the severity guidelines for 'GPU validating-layer gap', a spec-invalid value reaches
vkCmdCopyBufferviolatingVUID-vkCmdCopyBuffer-srcOffset-00113(if near the block tail) or ANGLE's suballocation isolation. Because the destination staging buffer is appropriately sized (getSize()), there is no out-of-bounds write primitive. Furthermore, the out-of-bounds bytes read into the staging buffer's tail are not directly observable or leaked back to the attacker. As the demonstrated consequence is a GPU-memory-resident out-of-bounds read only, the correct severity is Medium (S2). The runtime constraint to discrete GPUs does not qualify for the unsandboxed-Android Critical upgrade, which is consistent with the S2 rating.
Codebase Investigation Notes:
ContextVk::setupDraw(ContextVk.cpp:1663-1670) verified to callVertexArrayVk::updateStreamedAttribsbased ongetStreamingVertexAttribsMask().any().VertexArrayVk::updateStreamedAttribs(VertexArrayVk.cpp:1448-1449) verified to callGetVertexRangeInfo.mMaxVertexAttribDivisorcapping (vk_renderer.cpp:3958-3960) confirmed to bestd::numeric_limits<uint8_t>::max()(255).VertexArrayVk::syncState(VertexArrayVk.cpp:1009-1011) confirmed to flag bindings wheredivisor > renderer->getMaxVertexAttribDivisor()intomDivisorExceedMaxSupportedValueBindingMask, which then adds tomStreamingVertexAttribsMask.BufferVk::getIndexRange(BufferVk.cpp:989) confirmed to passgetSize()directly tomapRangeForReadAccessOnlywithout subtractingoffset.BufferVk::handleDeviceLocalBufferMap(BufferVk.cpp:680) confirmed to constructVkBufferCopywithout validatingoffset + size <= mBuffer.getSize(), resulting in a source range of[mBuffer.getOffset() + offset, mBuffer.getOffset() + offset + getSize()].- No bounds checks were found that abort or reject a valid large offset (
offset + count * typeSize <= getSize()) along the streaming emulation execution path.
Evaluated with Chrome root at commit: b96d2ec58f4f5f92b540a723966b199d6e9951b4
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 the length argument to mapRangeForReadAccessOnly was set to the full buffer size rather than the remaining size after the offset.
Impact
The GPU reads past the end of the buffer's suballocation, but the report states the out-of-bounds bytes are not directly observable or leaked back to the attacker, so the consequence is a GPU-memory-resident out-of-bounds read only.
What the attacker needed
Chrome with ANGLE Vulkan backend; Discrete Vulkan GPU; WebGL2 content or compromised renderer
The fix
The length passed to mapRangeForReadAccessOnly should be corrected to subtract the offset from the buffer size; the text does not say it was fixed.
How it was found
- Run Chrome on a system with a discrete Vulkan GPU.
- Create a static index buffer of about one megabyte via WebGL2.
- Write a few valid indices near the end of the buffer.
- Set a vertex attribute divisor above 255 to force streaming emulation.
- Issue an indexed draw call with a large offset near the end of the buffer.
- The GPU copies the full buffer size from that offset, reading past the suballocation.
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 graphics library used by the browser asks the GPU to copy a chunk of memory starting partway into a buffer, but tells it to copy the whole buffer's length rather than just the part that remains. The GPU then reads past the end of that buffer into neighbouring memory. The report says the extra data is not returned to the attacker, so the practical harm is limited.
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.