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

Out of bounds memory access in ANGLE (CVE-2026-17801)

A logic flaw in ANGLE's shader translator means loop-based indirect indices into gl_FragData are not counted when dual-source blending is active, so the parser's size check passes. The generated backend shader then declares a one-element output array but clamps accesses to a range of eight, giving out-of-bounds GPU memory reads and writes that could potentially lead to a sandbox escape on platforms with an unsandboxed GPU process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 2 months

Flapjack, 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: A logic flaw in ANGLE's shader translator allows loop-based indirect indices to bypass array size tracking for gl_FragData when dual-source blending is active. This leads to incorrect clamping bounds being injected into the AST, resulting in potential out-of-bounds shader accesses in backend compilers like Metal or SPIR-V. On platforms with an unsandboxed GPU process (such as Android), this could potentially facilitate a sandbox escape.

Affected files:

  • third_party/angle/src/compiler/translator/ParseContext.cpp
  • third_party/angle/src/compiler/translator/tree_ops/ClampIndirectIndices.cpp
  • third_party/angle/src/compiler/translator/tree_ops/spirv/EmulateFragColorData.cpp
  • third_party/angle/src/compiler/translator/msl/TranslatorMSL.cpp

Estimated timestamp from git blame: 2023-02-02

Background

In ANGLE, the gl_FragData built-in array typically has a size of MaxDrawBuffers (e.g., 8). However, when a shader uses the GL_EXT_blend_func_extended extension for dual-source blending (indicated by statically using gl_SecondaryFragDataEXT), the maximum number of draw buffers is reduced to MaxDualSourceDrawBuffers (typically 1).

Vulnerability Details

There is a potential vulnerability resulting from a mismatch between index validation, AST clamping, and backend code generation in ANGLE's translator:

  1. Validation Bypass: In third_party/angle/src/compiler/translator/ParseContext.cpp (TParseContext::addIndexExpression), the variable mMaxFragDataArrayIndexUsed tracks the highest index used to access gl_FragData. However, this tracker is only updated when the index is a literal constant (indexConstantUnion is non-null). In ESSL 100, loop indices are valid constant-index-expressions, meaning they are successfully compiled but bypass this tracking. Consequently, TParseContext::validateShaderLayout incorrectly evaluates mMaxFragDataArrayIndexUsed >= mResources.MaxDualSourceDrawBuffers as false (since it remains 0).
  2. Incorrect AST Clamping: The AST transformation pass ClampIndirectIndices injects clamping bounds for indirect array accesses. It determines the clamp range by querying the array type's size (ClampIndirectIndices.cpp:71). At this stage, gl_FragData is still sized to MaxDrawBuffers (8). Therefore, the loop index is clamped to [0, 7].
  3. Backend Array Downsizing: Backend code generators (like TranslatorMSL.cpp for Metal and EmulateFragColorData.cpp for SPIR-V) detect the dual-source blending state and shrink the actual output gl_FragData array to MaxDualSourceDrawBuffers (1).

This sequence causes ANGLE to generate backend shader code (e.g., MSL) that declares an array of size 1, but accesses it using indices clamped to [0, 7] (e.g., gl_FragData[clamp(i, 0, 7)]).

Potential Impact

When the shader executes on the GPU, indices 1 through 7 will access memory outside the bounds of the generated output array. This provides an Out-of-Bounds (OOB) read/write primitive within the GPU's execution context. Because the GPU process is unsandboxed on platforms like Android, corrupting driver structures via shader memory could potentially lead to a sandbox escape and arbitrary code execution.

Suggested Attacker Steps

(Note: Our tooling agent cannot run code, so these are theoretical steps to trigger the issue.)

  1. Create a WebGL context and enable the WEBGL_draw_buffers and EXT_blend_func_extended extensions.
  2. Provide a malicious ESSL 100 fragment shader that enables GL_EXT_draw_buffers and GL_EXT_blend_func_extended.
  3. Statically use gl_SecondaryFragDataEXT in the shader (e.g., write to gl_SecondaryFragDataEXT[0]) to force ANGLE into dual-source blending mode.
  4. Write a for loop that iterates from 0 to 7. Inside the loop, use the loop variable to index and write to gl_FragData (e.g., gl_FragData[i] = vec4(1.0);).
  5. Compile the shader and issue a draw call to execute the OOB writes on the GPU.

Suggested Fix

  1. Parser Fix: Update the logic in TParseContext::addIndexExpression to correctly track or reject loop indices for gl_FragData when GL_EXT_blend_func_extended is active. If the index is not a literal constant, the parser should either determine the maximum loop bound or defensively flag it as potentially exceeding MaxDualSourceDrawBuffers.
  2. Clamping Fix: Update ClampIndirectIndices to evaluate the effective runtime size of built-in output arrays taking active extensions into account, rather than relying exclusively on the symbol's initial type dimensions.

Evaluated with Chrome root at commit: b7d0c4d810da1b31400f198c70d9720fc8f0e5a0


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.

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 parser only records the highest gl_FragData index when it is a literal constant, so loop indices bypass the dual-source draw-buffer limit check, while the clamping pass and the backends disagree on the array's effective size.

Impact

Indices beyond the array could read and write GPU memory, and on platforms with an unsandboxed GPU process such as Android this could potentially lead to a sandbox escape and arbitrary code execution; the steps are theoretical and were not executed.

What the attacker needed

WebGL with draw buffers and dual-source blending; Attacker-controlled shader compiled by ANGLE; Unsandboxed GPU process for escape impact

The fix

The parser should track or reject non-constant loop indices for gl_FragData when dual-source blending is active, and the clamping pass should use the effective runtime size of built-in output arrays rather than the symbol's initial type dimensions.

How it was found

  1. Create a WebGL context and enable the draw buffers and dual-source blending extensions.
  2. Supply a fragment shader that enables both extensions and statically uses the secondary fragment data output to force dual-source blending mode.
  3. Add a loop from 0 to 7 that indexes gl_FragData with the loop variable and writes to it.
  4. Compile the shader and issue a draw call so the out-of-bounds writes execute 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.

Shaders are small programs that run on the graphics card. ANGLE is the layer that translates them for different graphics backends. Here a check on how many output slots a shader uses was skipped for loop counters, so the translated program could write past the end of a small array in graphics memory, which on some systems might let an attacker break out of the browser's protection.

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.