Out of bounds read in ANGLE (CVE-2026-9908)
The Vulkan backend of ANGLE sizes a staging buffer for 2D array textures using only the depth field, ignoring the layer count, so a later flush reads beyond the buffer. An attacker could potentially read GPU memory from other contexts in the same share group via glReadPixels.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 55 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: ImageHelper::reformatStagedBufferUpdates in ANGLE's Vulkan backend incorrectly sizes destination staging buffers for 2D array textures by ignoring the layerCount field. When these updates are later flushed, the GPU performs an out-of-bounds read from the shared staging pool, potentially leaking sensitive data from other contexts within the share group.
Affected files:
src/libANGLE/renderer/vulkan/vk_helpers.cppsrc/libANGLE/renderer/vulkan/TextureVk.cpp
Estimated timestamp from git blame: 2023-12-11
Description
In ANGLE's Vulkan backend, ImageHelper::reformatStagedBufferUpdates is responsible for re-encoding staged buffer updates when a texture's actual Vulkan format changes (e.g., when a texture initially using a sample-only format is first bound as a framebuffer attachment and requires a renderable fallback format).
A potential vulnerability exists in how the destination staging buffer is sized during this reformatting process. Specifically, for 2D array textures, ANGLE sets copy.imageExtent.depth to 1 and stores the actual number of layers in copy.imageSubresource.layerCount. However, reformatStagedBufferUpdates calculates the required buffer size using only copy.imageExtent.depth:
// From vk_helpers.cpp
size_t dstBufferSize = dstDataDepthPitch * copy.imageExtent.depth;
Because imageExtent.depth is 1 for array textures, the newly allocated buffer is only large enough for a single layer, regardless of how many layers were actually staged. The function subsequently calls CopyImageCHROMIUM with a depth of 1, reformatting only the first layer. It then updates the staged update's bufferOffset to point to the new buffer but fails to modify imageSubresource.layerCount.
When the staged updates are later flushed in ImageHelper::flushStagedUpdatesImpl, vkCmdCopyBufferToImage is called using the modified copyRegion which still retains the original layerCount. Because the newly allocated buffer is only sized for one layer, the GPU reads layerCount - 1 layers out-of-bounds from the buffer.
The staging buffer is suballocated from a BufferPool via the Vulkan Memory Allocator (VMA). Because the BufferPool is shared across all contexts within a ShareGroupVk, these adjacent memory blocks may contain uninitialized GPU memory, data from other textures in the same share group, or stale data from previously freed buffers.
Impact
An attacker can potentially exfiltrate the contents of the GPU staging pool. By staging a multi-layer update, triggering a format re-encoding, and then reading back the texture layers using glReadPixels, the attacker can retrieve the out-of-bounds memory. This represents a GPU-process information leak.
Suggested Reproduction Steps
Note: These are suggested steps based on code analysis, as our tooling does not currently run code to provide a working proof of concept.
- Environment: Run on a Vulkan implementation where a specific format (e.g.,
GL_RGBA4orGL_RGB5_A1) has different sample-only and renderable formats (common on mobile GPUs like Mali/Adreno or Intel iGPUs). - Define Texture: Create a
TEXTURE_2D_ARRAYwith formatGL_RGBA4usingglTexImage3D(passingnullfor pixels so it remains uninitialized on the GPU). - Stage Update: Call
glTexSubImage3Dwith multiple layers (e.g.,depth = 4). This stages a buffer update withlayerCount = 4andimageExtent.depth = 1. - Trigger Reformat: Bind the texture to a framebuffer and perform a rendering operation (like
glClear). This triggersTextureVk::ensureRenderable, which callsreformatStagedBufferUpdates, incorrectly allocating a 1-layer buffer for the 4-layer update. - Exfiltrate: Read back layers 1 through 3 using
glReadPixels. The resulting data will be the contents of the memory adjacent to the allocated staging buffer in the VMA pool.
Suggested Fix
In ImageHelper::reformatStagedBufferUpdates, calculate the buffer size by multiplying by the number of layers if the update is for an array texture. Additionally, the CopyImageCHROMIUM call should be updated to loop over all layers, or bufferRowLength and bufferImageHeight must be updated correctly if the data layout changes.
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 buffer size calculation uses only imageExtent.depth (which is 1 for array textures) instead of multiplying by the number of layers in imageSubresource.layerCount.
Impact
An attacker could potentially exfiltrate the contents of the GPU staging pool, leaking data from other contexts in the same share group.
What the attacker needed
Vulkan implementation with format differences; Ability to create and render to textures; Access to glReadPixels
The fix
The buffer size calculation should multiply by the number of layers for array textures, and the copy call should handle all layers correctly.
How it was found
- Run on a Vulkan implementation where a format has different sample-only and renderable formats.
- Create a 2D array texture with that format using glTexImage3D, leaving pixels uninitialized.
- Stage a multi-layer update with glTexSubImage3D.
- Bind the texture to a framebuffer and render to trigger reformatStagedBufferUpdates.
- Read back layers using glReadPixels to obtain out-of-bounds memory.
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 prepares a temporary memory area to hold texture data before sending it to the GPU. For textures with multiple layers, it accidentally makes that area too small, so when the GPU copies data out it reads past the end into memory used by other programs. This could let an attacker see leftover data from other graphics contexts.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.