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

Out of bounds read in ANGLE (CVE-2026-14396)

ANGLE's Metal backend miscalculates index buffer slices for primitive restart when an index conversion uses pool allocation, causing the restart sentinel to be passed to Metal. An attacker could read out-of-bounds GPU heap memory and leak cross-origin data via WebGL.

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 without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: ANGLE's Metal backend incorrectly calculates index buffer slices for primitive restart when an index conversion uses pool allocation. A coordinate mismatch between the pool allocation offset and the original WebGL buffer indices causes the slicing logic to miss the primitive restart sentinel, passing 0xFFFF to Metal. Since Metal lacks primitive restart support for non-strip primitives and bounds checking is disabled, this leads to an out-of-bounds read from the GPU heap.

Affected files:

  • third_party/angle/src/libANGLE/renderer/metal/VertexArrayMtl.mm
  • third_party/angle/src/libANGLE/renderer/metal/ContextMtl.mm
  • third_party/angle/src/libANGLE/renderer/metal/BufferMtl.mm

Estimated timestamp from git blame: 2026-05-06

Overview

A potential vulnerability exists in ANGLE's Metal backend where a coordinate system mismatch in the index buffer slicing logic allows the primitive restart index to be passed to Metal drawing commands for non-strip primitives. This results in an out-of-bounds (OOB) vertex fetch from the GPU heap, which can be observed by the web page to leak cross-origin GPU data.

Vulnerability Details

When a WebGL2 application uses gl.drawElements with UNSIGNED_BYTE indices, ANGLE's Metal backend must convert these indices to UNSIGNED_SHORT (u16) because Metal's support for u8 indices is limited. This is handled by VertexArrayMtl::convertIndexBuffer.

The converted indices are allocated from a shared mtl::BufferPool. The offset into this pool is returned via idxBufferOffsetOut, which includes the sub-allocation offset (e.g., X bytes) within the shared pool and any alignment padding.

Subsequently, VertexArrayMtl::getDrawIndices is called to slice the draw call into multiple ranges to handle primitive restart, as Metal does not natively support primitive restart for non-strip primitives (e.g., GL_POINTS, GL_LINES, GL_TRIANGLES).

The bug lies in how VertexArrayMtl::getDrawIndices calculates the current index and compares it against known restart index positions:

C++
// VertexArrayMtl.mm line 854
size_t currentIndexOffset = offset / indexTypeBytes;
// ... later in a loop
if (range.restartBegin > currentIndexOffset)

Here, offset is the byte offset into the converted pool buffer. Therefore, currentIndexOffset is an element offset relative to the start of the Metal pool's sub-allocation (inflated by X).

However, the restart ranges (range.restartBegin) are obtained from BufferMtl::getRestartIndices:

C++
// BufferMtl.mm line 510
angle::Span<const uint8_t> data = getBufferDataReadOnly(ctx, 0);
// ...
ranges = CalculateRestartRanges<uint8_t>(data);

These restart ranges are calculated from byte 0 of the original WebGL ELEMENT_ARRAY_BUFFER. They are absolute element indices relative to the WebGL buffer, not the Metal pool buffer.

Because of this mismatch, if a pool allocation offset is present, currentIndexOffset will be artificially inflated. The comparison range.restartBegin > currentIndexOffset fails to correctly identify the restart index's position. Consequently, the restart sentinel (promoted from 0xFF to 0xFFFF) is not sliced out and is included in the draw command's range.

Impact

Since Metal is told to draw with a range that includes 0xFFFF, and it does not natively recognize 0xFFFF as a restart index for non-strip primitives, it treats it as a valid vertex index.

Furthermore, ANGLE disables robustBufferAccessBehaviorKHR on Metal (in DisplayMtl.mm), meaning there are no backend-level bounds checks for vertex fetches. The GPU will attempt to fetch vertex 65535. If the bound vertex buffer is smaller than this, it results in an out-of-bounds read of the GPU heap.

An attacker can leak cross-origin GPU memory by rendering this OOB data to a floating-point render target and reading the pixels back into JavaScript.

Potential Reproduction Steps

Please note: These are suggested steps to trigger the vulnerability. Our tooling agent cannot run code to verify them.

  1. On macOS with ANGLE-Metal (default), obtain a WebGL2 context.
  2. Create an ARRAY_BUFFER with a small number of vertices (e.g. 4) and bind it to a vertex attribute; configure the vertex shader to pass this attribute to the fragment shader to be written to a render target.
  3. Create an ELEMENT_ARRAY_BUFFER with UNSIGNED_BYTE indices, intentionally including the restart index 0xFF (e.g., [0, 1, 2, 0xFF, 4]).
  4. Call gl.drawElements(gl.POINTS, count, gl.UNSIGNED_BYTE, offset) where offset does not align with kIndexBufferOffsetAlignment (4), e.g., offset 7. This forces conversion and pool allocation.
  5. Observe that the draw call includes vertex 65535 by reading back the rendered pixels from the render target via gl.readPixels().
  6. To guarantee a non-zero pool offset, perform multiple index conversions or sub-data updates prior to the draw call to advance the BufferPool allocation pointer.

Suggested Fix

Ensure that the slicing logic uses the same coordinate space for comparisons. One approach is to calculate the slices based on the original WebGL buffer's element index and then apply the pool offset and alignment translation to the generated DrawCommandRange offset values, rather than attempting to slice using the post-conversion pool offsets.

Evaluated with Chrome root at commit: eca8648a4e1cdfdda68c495a6003059fed641955


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 slicing logic compares a pool-relative element offset against restart ranges calculated from the original WebGL buffer, so the restart sentinel is not removed.

Impact

An attacker could leak cross-origin GPU memory by rendering the out-of-bounds data to a floating-point render target and reading the pixels back into JavaScript.

What the attacker needed

MacOS with ANGLE-Metal; WebGL2 context; Ability to run JavaScript in a browser

The fix

The slicing logic should use the same coordinate space for comparisons, applying the pool offset and alignment translation to the generated DrawCommandRange offsets rather than slicing with post-conversion pool offsets.

How it was found

  1. Obtain a WebGL2 context on macOS with ANGLE-Metal.
  2. Create a small ARRAY_BUFFER and bind it to a vertex attribute.
  3. Create an ELEMENT_ARRAY_BUFFER with UNSIGNED_BYTE indices including the restart index 0xFF.
  4. Call gl.drawElements with an offset that forces conversion and pool allocation.
  5. Read back rendered pixels to observe vertex 65535.
  6. Perform multiple index conversions to guarantee a non-zero pool offset.

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.

WebGL lets web pages draw 3D graphics using the GPU. ANGLE translates WebGL commands for different graphics backends, here Metal on macOS. A bug in that translation lets a page ask the GPU to read past the end of a buffer, potentially exposing memory from other pages.

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.