Out of bounds read in GPU (CVE-2026-8578)
A missing validation check in D3DImageBacking::BeginAccessDawnBuffer allows a compromised renderer to obtain concurrent write access to a D3D12 resource from both WebNN and WebGPU. This race condition can be exploited to cause out-of-bounds reads in Dawn's indirect draw validation, potentially leaking cross-origin GPU memory.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 48 days
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: A synchronization flaw exists in D3DImageBacking::BeginAccessDawnBuffer where it fails to call ValidateBeginAccess. This allows a compromised renderer to establish concurrent, unsynchronized write access to a single D3D12 resource from both WebNN and WebGPU. This concurrent access can be used to exploit a Time-of-Check Time-of-Use (TOCTOU) vulnerability in Dawn's indirect draw validation, leading to out-of-bounds reads and cross-origin GPU memory disclosure.
Affected files:
gpu/command_buffer/service/shared_image/d3d_image_backing.ccgpu/command_buffer/service/shared_image/d3d_image_backing_factory.ccservices/webnn/webnn_context_impl.ccgpu/command_buffer/service/webgpu_decoder_impl.cc
Estimated timestamp from git blame: 2024-09-12
Summary
A synchronization vulnerability exists in D3DImageBacking where the BeginAccessDawnBuffer method (located in gpu/command_buffer/service/shared_image/d3d_image_backing.cc) fails to call ValidateBeginAccess. This omission allows a compromised renderer to bypass internal state tracking (in_write_access_) and obtain concurrent write access to an underlying D3D12 resource while it is already locked for exclusive access by WebNN.
Vulnerability Details
In the D3DImageBacking implementation, all other access entry points—BeginAccessDawn, BeginAccessD3D11, and BeginAccessWebNN—call ValidateBeginAccess() to ensure that the backing is not already locked for exclusive (write) access.
However, BeginAccessDawnBuffer (lines 1591-1643) lacks this critical check. Furthermore, Dawn has its own internal mExclusiveAccess tracking, but this check is bypassed because WebNN access only updates Chrome's SharedImage state (in_write_access_ via BeginAccessCommon) and does not interact with Dawn's internal resource management.
Attack Scenario / Exploitation
This concurrency enables a Time-of-Check to Time-of-Use (TOCTOU) vulnerability in Dawn's indirect draw validation. Specifically, Dawn's IndirectDrawValidationEncoder reads parameters (like indexCount and firstIndex) from an indirect buffer, validates them against bounds, and then re-reads the buffer to copy the values to a safe scratch buffer for ExecuteIndirect.
An attacker can use WebNN to concurrently overwrite the indirect buffer after Dawn's validation but before the copy. This allows unvalidated out-of-bounds indexCount or firstIndex values to be consumed by ExecuteIndirect. In D3D12, an out-of-bounds index buffer read will fetch arbitrary memory from the D3D12 heap. By crafting a vertex shader to reflect these fetched values, an attacker can leak cross-origin GPU memory, such as textures belonging to other origins or browser UI elements.
Suggested Steps to Reproduce
(Note: These are potential steps, as Fortify LLM agent doesn't yet have the ability to run code.)
- Preparation: A compromised renderer creates a SharedImage with both
SHARED_IMAGE_USAGE_WEBGPU_SHARED_BUFFERandSHARED_IMAGE_USAGE_WEBNN_SHARED_TENSORusages. This combination is explicitly permitted inD3DImageBackingFactory::IsSupported. - WebNN Access: The renderer sends an
ImportTensorWebNN Mojo command to acquire WebNN access to the tensor. The GPU process executesBeginAccessWebNN, which callsBeginAccessCommon(true), settingin_write_access_ = trueand clearing any existingwrite_fences_andread_fences_. - Bypassed WebGPU Access: Without finishing the WebNN access, the renderer sends an
AssociateMailboxForBufferImmediatecommand for WebGPU using the same SharedImage mailbox. The GPU process executesBeginAccessDawnBuffer. - Race Condition: Because
BeginAccessDawnBuffermissesValidateBeginAccess(true), it does not checkin_write_access_. It reads the empty fences (cleared by WebNN) and initiates Dawn access with zero fence waits. Now, both DirectML (via WebNN) and Dawn (via WebGPU) are submitting commands to the sameID3D12Resourceconcurrently without synchronization. - Exploitation: The attacker dispatches a WebGPU indirect draw command that sources parameters from this SharedImage buffer. Concurrently, the attacker dispatches a WebNN workload that rapidly writes out-of-bounds (OOB) values (e.g., extremely large
indexCount) to the buffer. If the WebNN overwrite occurs precisely between Dawn's validation read and its copy read insRenderValidationShaderSource, Dawn will copy the unvalidated OOB values to its internal scratch buffer. - Information Leak: The hardware executes
ExecuteIndirectusing the OOB parameters from the scratch buffer, fetching out-of-bounds indices from the D3D12 heap. The attacker's vertex shader reflects these leaked values onto a render target, which is read back to the renderer, disclosing cross-origin memory. - State Corruption: Upon
EndAccess, the overlapping access causesnum_readers_to underflow (decrementing from 0 to -1), permanently corrupting the synchronization state for thatSharedImage.
Suggested Fix
Add the missing validation check to D3DImageBacking::BeginAccessDawnBuffer:
wgpu::Buffer D3DImageBacking::BeginAccessDawnBuffer(
const wgpu::Device& device,
wgpu::BackendType backend_type,
wgpu::BufferUsage usage) {
AutoLock auto_lock(this);
// Add validation check here
if (!ValidateBeginAccess(true)) {
return nullptr;
}
// ... rest of the function
}
Note: BeginAccessDawnBuffer implicitly grants write access as it creates a wgpu::Buffer and Dawn currently treats all mapped buffers as potentially writable from the perspective of SharedImage synchronization.
Evaluated with Chrome root at commit: 0eb4855bda702feaaa8b899336664f97e3df88b8
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. Please feel free to reach out to me if you have concerns or feedback.
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 BeginAccessDawnBuffer method omits a call to ValidateBeginAccess, so it does not check the in_write_access_ flag and allows concurrent write access to a resource already locked by WebNN.
Impact
An attacker could leak cross-origin GPU memory, such as textures from other origins or browser UI elements, and also cause state corruption in the SharedImage synchronization.
What the attacker needed
Compromised renderer; ability to create SharedImage with both usages; ability to send WebNN and WebGPU commands
The fix
The fix is to add a call to ValidateBeginAccess(true) at the start of BeginAccessDawnBuffer and return nullptr if validation fails.
How it was found
- A compromised renderer creates a SharedImage with both WebGPU shared buffer and WebNN shared tensor usages.
- The renderer sends an ImportTensor WebNN command to acquire WebNN access, setting in_write_access_ to true.
- Without finishing WebNN access, the renderer sends an AssociateMailboxForBufferImmediate command for WebGPU using the same SharedImage.
- BeginAccessDawnBuffer runs without checking in_write_access_, initiating Dawn access with zero fence waits.
- The attacker dispatches a WebGPU indirect draw and a WebNN workload that overwrites the indirect buffer with out-of-bounds values.
- If the overwrite occurs between Dawn's validation and copy, unvalidated values are used in ExecuteIndirect, leading to out-of-bounds reads and memory disclosure.
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 component fails to check if a resource is already in use before allowing another part of the system to write to it. This lets an attacker who already controls one part of the browser cause a race condition, where two operations overlap in a way that reads memory outside the intended buffer. The result could be leaking data from other websites or browser interface elements.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.