Skip to content
Memory corruption Advisory Advanced CVE-2026-9930

Out of bounds write in Dawn (CVE-2026-9930)

A logic error in Dawn's Metal backend fails to reset the depthPlane property when applying a workaround that swaps a 3D texture attachment for a temporary 2D texture. An attacker could supply a non-zero depthSlice, causing the Metal driver to calculate an out-of-bounds memory offset and potentially write to arbitrary 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. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team.

Overview: A logic error exists in Dawn's Metal backend where the depthPlane property is not reset when applying the MetalRenderR8RG8UnormSmallMipToTempTexture workaround. If a 3D texture is used as a color attachment, this omission passes an attacker-controlled, non-zero depth slice to the Metal driver alongside a 1-depth temporary 2D texture. This mismatch causes the GPU driver to calculate an out-of-bounds memory offset during the render pass, potentially leading to arbitrary writes in GPU memory.

Affected files:

  • third_party/dawn/src/dawn/native/metal/UtilsMetal.mm
  • third_party/dawn/src/dawn/native/metal/TextureMTL.mm
  • third_party/dawn/src/dawn/native/metal/CommandBufferMTL.mm

Estimated timestamp from git blame: 2022-05-01

Summary

A vulnerability exists in Dawn's Metal backend within the PatchAttachmentWithTemporary function. When the Toggle::MetalRenderR8RG8UnormSmallMipToTempTexture workaround is triggered (default-enabled for Intel GPUs on macOS), Dawn swaps the render attachment with a temporary 2D texture. However, it fails to reset the depthPlane property of the Metal render pass descriptor. When an attacker provides a 3D texture view and specifies a depthSlice, the stale depthPlane value is used by the Metal driver against the temporary 1-depth 2D texture, resulting in a potential out-of-bounds (OOB) write on the GPU.

Technical Details

Dawn permits 3D textures to be created with the RENDER_ATTACHMENT usage flag and supports rendering to specific slices via the depthSlice property in the render pass descriptor. During command translation, CreateMTLRenderPassDescriptor (CommandBufferMTL.mm:214) maps this depthSlice directly to the depthPlane property of the MTLRenderPassColorAttachmentDescriptor.

When EncodeMetalRenderPass (UtilsMetal.mm:845) detects a small mip level (>= 2) of an R8Unorm or RG8Unorm texture on Intel hardware, it triggers a workaround to patch the attachment using PatchAttachmentWithTemporary.

This function (UtilsMetal.mm:154) allocates a temporary MTLTextureType2D texture with a hardcoded depth of 1. It then updates the attachment descriptor in-place:

C++
    // Replace the attachment with the temporary
    attachment.texture = result.temporary.Get();
    attachment.level = 0;
    attachment.slice = 0;
    // BUG: attachment.depthPlane is not reset.

Because depthPlane is not reset to 0, the Metal driver receives a descriptor for a 2D texture with a potentially large depthPlane index. Without Metal validation layers enabled in release builds, the driver calculates the memory offset using base_address + (depthPlane * slice_stride). Since the temporary allocation is only 1 layer deep, the GPU will perform the render pass out-of-bounds of the temporary texture's backing memory.

Further evidence that 3D textures were completely overlooked in this workaround can be found in SavedMetalAttachment. When copying the data back to the original texture (CopyFromTemporaryToAttachment), it hardcodes destinationOrigin:MTLOriginMake(0, 0, 0) and destinationSlice:0, ignoring the original depthPlane entirely.

Potential Exploit Steps

  1. Using WebGPU, create a 3D texture with format r8unorm (or rg8unorm), usage RENDER_ATTACHMENT, and mipLevelCount >= 3.
  2. Create a GPUTextureView targeting this 3D texture with baseMipLevel: 2 (or greater) and dimension: "3d".
  3. Begin a render pass, using this view as a color attachment and specifying an out-of-bounds depthSlice multiplier (e.g., depthSlice: 3). This passes Dawn's frontend validation because it is within the bounds of the original 3D texture.
  4. Submit the commands. The Metal backend translates the depthSlice to depthPlane: 3.
  5. The MetalRenderR8RG8UnormSmallMipToTempTexture workaround activates, swapping the 3D texture for a newly allocated 1-depth 2D texture, but leaving depthPlane: 3.
  6. The Metal driver executes the render pass. Because depthPlane is 3 on a 1-depth allocation, fragment shader outputs (or clear colors) are written to an out-of-bounds memory address on the GPU.

Note: These are suggested steps based on static code analysis; our tooling agent does not yet have the ability to run code to provide a working proof of concept.

Suggested Fix

  1. In PatchAttachmentWithTemporary (third_party/dawn/src/dawn/native/metal/UtilsMetal.mm), explicitly reset the depthPlane property:
C++
    attachment.texture = result.temporary.Get();
    attachment.level = 0;
    attachment.slice = 0;
    attachment.depthPlane = 0;
  1. To ensure correct functional behavior for 3D textures, SavedMetalAttachment should be updated to store the original depthPlane value. CopyFromTemporaryToAttachment and CopyFromAttachmentToTemporary should then use this saved depthPlane value for the Z-coordinate of the origin or the destination slice, ensuring the workaround successfully copies data to and from the correct Z-slice of the original 3D texture.

Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b


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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 workaround that replaces a 3D texture attachment with a temporary 2D texture does not reset the depthPlane property, so the driver uses a stale, attacker-controlled depth slice against a 1-depth allocation.

Impact

An attacker could potentially write to arbitrary GPU memory, but the report notes that these are suggested steps based on static code analysis and no working proof of concept was provided.

What the attacker needed

Intel GPU on macOS; WebGPU access; 3D texture with RENDER_ATTACHMENT usage; mipLevelCount >= 3

The fix

The fix should explicitly reset the depthPlane property to 0 in PatchAttachmentWithTemporary and update SavedMetalAttachment to store and use the original depthPlane for correct 3D texture handling.

How it was found

  1. Create a 3D texture with format r8unorm or rg8unorm, usage RENDER_ATTACHMENT, and mipLevelCount >= 3.
  2. Create a texture view targeting this 3D texture with baseMipLevel 2 or greater and dimension 3d.
  3. Begin a render pass using this view as a color attachment and specifying an out-of-bounds depthSlice multiplier (e.g., depthSlice: 3).
  4. Submit the commands; the Metal backend translates the depthSlice to depthPlane: 3.
  5. The workaround activates, swapping the 3D texture for a newly allocated 1-depth 2D texture but leaving depthPlane: 3.
  6. The Metal driver executes the render pass, writing fragment shader outputs or clear colors to an out-of-bounds memory address on the GPU.

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 program uses a graphics card to draw, it sometimes uses a temporary texture as a stand-in. A mistake in the code means the graphics driver is told to write to a slice of that temporary texture that does not exist, so it writes past the end of the memory allocated for it. This could let an attacker corrupt other data on the graphics card.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.