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

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

A name collision in ANGLE's RewriteStructSamplers pass is only guarded by a debug-only assertion, so in release builds one extracted sampler can silently overwrite another in the compiler's map. This lets a crafted WebGL shader produce an out-of-bounds OpAccessChain index in the emitted SPIR-V, which reaches the Vulkan driver unvalidated and could cause an out-of-bounds descriptor read in the GPU process.

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

Overview: A name collision in ANGLE's RewriteStructSamplers pass can silently overwrite extracted samplers in release builds due to a debug-only ASSERT. This allows an attacker to bypass AST bounds checks, emitting an out-of-bounds OpAccessChain index into the SPIR-V module. The invalid SPIR-V reaches the Vulkan driver unvalidated, potentially causing out-of-bounds descriptor reads and memory corruption in the GPU process.

Affected files:

  • third_party/angle/src/compiler/translator/tree_ops/RewriteStructSamplers.cpp
  • third_party/angle/src/compiler/translator/spirv/OutputSPIRV.cpp

Estimated timestamp from git blame: 2021-01-14

1. Summary of the Issue (Meant for Human Triage)

The ANGLE compiler contains a logic flaw in the RewriteStructSamplers tree-op pass, which is responsible for extracting nested samplers from ESSL 1.00 structures and rewriting them as individual globally defined sampler uniforms. When generating names for these extracted samplers, the compiler concatenates the parent uniform's name with the nested field-name path. Distinct uniform structures with varying array sizes and sampler types can legally produce the exact same concatenated identifier.

To prevent these name collisions, ANGLE relies on a debug-only ASSERT(). In release builds (where NDEBUG is defined and ANGLE_ENABLE_ASSERTS is unset), this assertion evaluates to a no-op, causing the compiler to silently overwrite previously defined variables in its mExtractedSamplers hash map.

Consequently, during the AST traversal phase, the compiler may substitute a smaller array variable into an index operation originally intended for a larger array. Because ANGLE does not perform boundary checks on direct constant indices when reconstructing the AST binary nodes, this out-of-bounds index is directly translated into the final SPIR-V module as an invalid OpAccessChain instruction. Because downstream SPIR-V validation calls are also wrapped in debug-only ASSERTs, the spec-invalid SPIR-V blob (violating VUID-RuntimeSpirv-None-09403) is passed directly to the host driver via vkCreateShaderModule. Vulkan's robustBufferAccess and robustImageAccess protections do not cover out-of-bounds indexing of descriptor arrays, meaning the GPU driver will fetch a descriptor from an out-of-bounds memory location. This is reachable from unprivileged WebGL content and results in a potential High severity memory corruption (OOB descriptor read) within the Vulkan backend, which runs in the unsandboxed GPU process on Android.

2. Proof-of-Concept & Detailed Execution Flow

Note: The following steps describe a potential attack sequence and execution flow. Our tooling agent has statically traced this path from source but does not currently run the code dynamically.

Step 1: Shader Parsing and Prefix Construction A malicious web page creates a WebGL 1 context and calls gl.shaderSource() with an ESSL 1.00 shader containing two structures:

  • struct A { sampler2D b_t; }; uniform A a[10];
  • struct B { sampler2D t; }; uniform B a_b[2];

The shader references the arrays, e.g., texture2D(a[7].b_t, v). The RewriteStructSamplersTraverser executes a pre-order traversal (RewriteStructSamplers.cpp:282), processing the declarations. In extractFieldSamplers, it concatenates the uniform prefix with the field name: std::string newPrefix = prefix + "_" + field->name().data(); (RewriteStructSamplers.cpp:535). For a and b_t, this yields "a_b_t".

Step 2: Silent Map Overwrite in Release Builds extractSampler generates a sampler2D[10] TVariable and stores it at mExtractedSamplers["a_b_t"]. It uses a debug-only assertion to check for collisions: ASSERT(mExtractedSamplers.find(newName) == mExtractedSamplers.end()); (RewriteStructSamplers.cpp:600).

The traverser then processes uniform B a_b[2]. It similarly constructs the string "a_b_t" (from "a_b" + "_" + "t") and generates a sampler2D[2] variable. Because ANGLE_ENABLE_ASSERTS is unset in release builds, the ASSERT at line 600 evaluates to a no-op (third_party/angle/src/common/log_utils.h:209-211). The map silently overwrites the entry: mExtractedSamplers["a_b_t"] = newVariable; (RewriteStructSamplers.cpp:601), replacing sampler2D[10] with sampler2D[2].

Step 3: AST Expression Corruption The traverser descends into the main() function and visits the AST node a[7].b_t. RewriteModifiedStructFieldSelectionExpression intercepts this expression, rebuilding the string "a_b_t" (RewriteStructSamplers.cpp:209-217). It performs a map lookup: rewritten = new TIntermSymbol(extractedSamplers.at(samplerName)); (RewriteStructSamplers.cpp:229). Due to the silent overwrite, rewritten now references sampler2D[2].

The AST expression is rebuilt using the original, un-clamped index: rewritten = new TIntermBinary(EOpIndexDirect, rewritten, indexNode->getRight()); (RewriteStructSamplers.cpp:254), where indexNode->getRight() is the constant 7.

Step 4: Absence of Index Bounds Validation The TIntermBinary constructor calls promote(). For arrays, promote() calls mType.toArrayElementType() which strips one array dimension but performs absolutely no index-vs-bounds validation (IntermNode.cpp:1900-1918). The ClampIndirectIndices pass explicitly ignores EOpIndexDirect (ClampIndirectIndices.cpp:38), meaning the constant [7] is left un-clamped.

Step 5: OOB SPIR-V OpAccessChain Emission OutputSPIRVTraverser intercepts the invalid EOpIndexDirect node (OutputSPIRV.cpp:5204). It extracts the constant index 7 and pushes it directly into the access chain: accessChainPushLiteral(&mNodeData.back(), spirv::LiteralInteger(index), typeId); (OutputSPIRV.cpp:5212). This function unconditionally appends the index to data->idList (OutputSPIRV.cpp:857).

OutputSPIRVTraverser::accessChainCollapse resolves the expression, triggering spirv::WriteAccessChain (OutputSPIRV.cpp:970-974). An OpAccessChain is emitted using the constant index %int_7 into a variable declared as OpTypeArray %simg 2.

Step 6: Driver-Level Unvalidated Execution At the end of translation, SPIR-V validation is skipped because it is wrapped in ASSERT(spirv::Validate(result)); (OutputSPIRV.cpp:6702). The Vulkan backend retrieves the SPIR-V blob during program linking and runs it through transformations (ProgramExecutableVk.cpp:631), followed by another skipped debug-only validation ASSERT(spirv::Validate(*spirvBlobOut)); (spv_utils.cpp:6201).

The unverified blob is passed directly to the host driver via vkCreateShaderModule (vk_wrapper.h:1927). Vulkan's robustBufferAccess and robustImageAccess do not protect descriptor array indices. When executed, the GPU driver will perform an out-of-bounds read at descriptor array element 7 of the 2-element UniformConstant array, fetching an arbitrary memory location to use as a texture descriptor.

Suggested Fix: Instead of generating names using standard string concatenation based on ESSL identifiers (newName = prefix + "_" + field->name().data();), ANGLE should assign unique, collision-proof internal identifiers or suffixes (e.g., using a monotonically increasing counter or angle::Compiler's internal symbol ID generator). The TODO at RewriteStructSamplers.cpp:596 explicitly states: "Use a temp name instead of generating a name as currently done. There is no guarantee that these generated names cannot clash." Resolving this TODO will prevent the silent map overwrite entirely.

3. Technical Verification Details (Automated Audit Logs - Reviewers may skip this section)

Verbatim Critic Model Verdict (2026-07-18 04:42:22) Probability assessment: 100% probability the vulnerability is real and the details are correct. The code at HEAD in RewriteStructSamplers.cpp:600-601 contains the unmitigated map overwrite in release builds (only protected by a debug-only ASSERT). The steps to produce a spec-invalid SPIR-V module are accurately traced to OutputSPIRV.cpp where array bounds are not checked for EOpIndexDirect, resulting in an OOB OpAccessChain. The probability of exploitation by an adversary to achieve driver-level UB or memory corruption via out-of-bounds descriptor reads is very high (95%+).

Severity Justification: S1 (High)

  1. Direct Match with S1 Guidelines: The vulnerability directly matches the S1 indicator: 'ANGLE shader translator emits SPIR-V/HLSL with an OOB OpAccessChain / array index from attacker GLSL... The emitted IR reaches vkCreateShaderModule... in the GPU process. This is web-content-reachable'.
  2. GPU Process & Sandbox Environment: The vulnerability is web-content-reachable (A-SERVER) without requiring a compromised renderer. The Vulkan backend is the default on Android, where the GPU process is completely unsandboxed.
  3. Validating-Layer Gap & Spec Invalidity: The ANGLE validating-layer fails to reject the OOB index because ClampIndirectIndices only applies to EOpIndexIndirect, and AST/SPIR-V validation passes are ASSERT-wrapped (debug-only). The resulting SPIR-V module fails Vulkan Validation Layers due to the OOB OpAccessChain index, proving it is spec-invalid (violating SPIR-V and Vulkan VUIDs) and is passed to the driver's vkCreateShaderModule.
  4. Read vs Write Primitive: The resulting primitive is an OpImageSampleImplicitLod from an out-of-bounds descriptor. Because a clear write primitive is not demonstrated in the report, it is capped at High (S1) and does not escalate to Critical (S0) per the 'Read primitive / requires renderer compromise → S1' ceiling.
  5. Why not S2?: The S2 downgrade for 'GPU-memory-resident OOB read only' does not apply. An OOB descriptor read is fundamentally different from a GPU-memory-resident read (like sampling OOB pixels); it causes the driver to misinterpret arbitrary memory as a descriptor, which can lead to arbitrary memory access or driver crashes, not just limited metadata disclosure. Furthermore, the explicit S1 rule for SPIR-V/HLSL OOB OpAccessChain overrides this. The S2 downgrade for Metal-only output also does not apply since this targets the Vulkan backend (SPIR-V).
  6. MiraclePtr / Hardening: MiraclePtr (BRP) does not apply because the ANGLE AST uses a pool allocator (arena), not raw_ptr managed heap memory. There are no other downstream release-build defenses that catch this.

Additional Verification Log (Codebase Investigator):

  • ASSERT Definition (third_party/angle/src/common/log_utils.h:209-211): Confirmed ASSERT evaluates to ANGLE_EAT_STREAM_PARAMETERS << !(condition) using a ternary operator when ANGLE_ENABLE_ASSERTS is disabled (release mode), short-circuiting and bypassing the evaluation entirely.
  • ValidateAST bypass (third_party/angle/src/libANGLE/Shader.cpp:669-671): options.validateAST = true; is #if defined(ANGLE_ENABLE_ASSERTS) gated, skipping AST verification in release builds.
  • Vulkan Validation Layer Compliance (VUID-RuntimeSpirv-None-09403): Confirmed that OpAccessChain indices explicitly exceeding OpTypeArray bounds violates this spec constraint.
  • Robustness Limitations: Confirmed third_party/vulkan-validation-layers/src/docs/gpu_av_descriptor_indexing.md documents that robustBufferAccess and robustImageAccess do NOT protect out-of-bounds descriptor array access, ensuring the malicious OpImageSampleImplicitLod executes unmitigated.
  • Execution trace mapping: Confirmed OutputSPIRVTraverser::createImageTextureBuiltIn (OutputSPIRV.cpp:3444) fetches spv::Dim via getImageTypeParameters, ultimately mapped down to an OpImageSampleImplicitLod read primitive driven by the corrupted OOB variable.

Evaluated with Chrome root at commit: b96d2ec58f4f5f92b540a723966b199d6e9951b4


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 extracted sampler names are built by plain string concatenation, and the only collision check is a debug-only ASSERT that is compiled out in release builds, so the map entry is silently overwritten.

Impact

The invalid SPIR-V could cause an out-of-bounds descriptor read in the unsandboxed GPU process on Android, potentially leading to memory corruption; the report notes the path was traced statically and not run dynamically, and that the primitive demonstrated is a read rather than a write.

What the attacker needed

Victim loads a malicious web page; WebGL 1 support in the browser; Vulkan backend (default on Android); release build without asserts

The fix

The report suggests generating unique, collision-proof internal identifiers instead of concatenated names, resolving the existing TODO about temporary names.

How it was found

  1. Create a WebGL 1 context and supply an ESSL 1.00 shader with two uniform structures whose concatenated sampler names collide.
  2. The traverser extracts the first sampler and stores it under the joined name.
  3. The second structure produces the same joined name and overwrites the first entry in release builds.
  4. The shader references an index valid for the larger array but out of range for the smaller one that replaced it.
  5. The index is emitted unchanged into an OpAccessChain in the SPIR-V module.
  6. SPIR-V validation is skipped in release builds and the blob is passed to the driver via vkCreateShaderModule.

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 shaders are compiled by a component called ANGLE before they reach the graphics driver. ANGLE gives each sampler (a handle used to read a texture) a name built by joining strings, and two different shaders can end up with the same name; a safety check for this only runs in debug builds, so in normal builds one entry quietly replaces another. The result is a shader that asks for an array slot that does not exist, and the graphics driver may then read memory it should not.

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.