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

Insufficient validation of untrusted input in ANGLE (CVE-2026-17847)

ANGLE's sequence (comma) operator accepted a struct containing only samplers as an operand, bypassing the AST rewrite that strips such uniforms. This left a dangling symbol reference that produced malformed SPIR-V with an invalid built-in decoration, which was passed to the Vulkan driver in the GPU process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 2 months

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 validation bypass in ANGLE's sequence operator allows structures containing only samplers to be accepted as operands. This bypasses AST transformations, generating malformed SPIR-V containing invalid built-in decorations that is passed directly to the Vulkan driver in the GPU process.

Affected files:

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

Estimated timestamp from git blame: 2024-07-30

Root Cause

In TParseContext::addComma (third_party/angle/src/compiler/translator/ParseContext.cpp), the parser performs no opaque-type or struct-containing-sampler validation on either operand. Its only type guard is the WebGL2 array/void/struct-containing-arrays restriction:

C++
TIntermTyped *TParseContext::addComma(TIntermTyped *left,
                                      TIntermTyped *right,
                                      const TSourceLoc &loc)
{
    if (mShaderSpec == SH_WEBGL2_SPEC &&
        (left->isArray() || left->getBasicType() == EbtVoid ||
         left->getType().isStructureContainingArrays() || right->isArray() ||
         right->getBasicType() == EbtVoid || right->getType().isStructureContainingArrays()))
    {
        error(...);
    }
    ...
    TIntermBinary *commaNode = TIntermBinary::CreateComma(left, right, mShaderVersion);
    markStaticUseIfSymbol(left);
    ...
}

For a struct containing only samplers (e.g., struct S { sampler2D s; }; uniform S u;), the sequence operator expression (u, 1.0) successfully parses on all ESSL versions, producing an EOpComma whose child is the symbol u. Contrast this with addTernarySelection, which explicitly rejects isStructureContainingSamplers() operands.

Potential Trigger Path

Note: The following steps are potential/suggested steps to trigger the bug. Our tooling agent does not currently have the ability to execute code and verify runtime behavior.

  1. Parser Bypass: An attacker supplies a WebGL shader that nests a side-effecting assignment alongside the sampler struct inside a sequence operator (to prevent aggressive optimization/folding, which would otherwise strip the expression):

    GLSL
    #version 300 es
    precision mediump float;
    struct S { sampler2D s; };
    uniform S u;
    out vec4 c;
    void main() { float x = 0.0; c = vec4(((x = 1.0, u), 1.0)); }
    
  2. Folding and Pruning Defeated: Because the left operand of the inner sequence operator (x = 1.0) contains side effects (hasSideEffects() == true), the expression cannot be folded by FoldExpressions. Since the sequence operator is nested inside a constructor assignment rather than being a block-level statement, PruneNoOps leaves the comma nodes untouched.

  3. RewriteStructSamplers Desynced: During the RewriteStructSamplers pass, the sampler-only structure uniform is stripped. Since it contains only samplers, its replacement struct is empty, which causes the pass to delete its declaration without updating mStructureUniformMap. However, the traverser does not descend into EOpComma operands to rewrite symbols; hence, the bare symbol reference u survives as a dangling pointer in the AST.

  4. Malformed SPIR-V Code Generation: In OutputSPIRV::visitSymbol (third_party/angle/src/compiler/translator/spirv/OutputSPIRV.cpp), the compiler attempts to process the unresolved symbol u:

    • It determines the storage class is StorageClassUniform based on the symbol's qualifier.
    • Since the declaration was removed, the symbol is not in mSymbolIdMap. The compiler enters the default case of the built-in lookup switch, executing UNREACHABLE() which is a no-op in production release builds.
    • Execution falls through to declare the variable with an uninitialized built-in decoration value (spv::BuiltInMax, or 0x7FFFFFFF).
    • This results in emitting OpDecorate %v BuiltIn 2147483647 on a Uniform storage class variable containing OpTypeSampledImage without proper block decorations.
  5. Submission to Vulkan Driver: In production Chrome, AST validation is disabled. The malformed SPIR-V is passed directly to the GPU driver via vkCreateShaderModule within the GPU process (which is unsandboxed on Android).

Potential Security Impact

ANGLE is designed to be the security boundary between untrusted WebGL code and the underlying graphics driver. This issue allows WebGL shaders to bypass ANGLE's AST verification and inject malformed SPIR-V directly into the GPU driver. Depending on how the specific Vulkan driver parses invalid built-in decorations or handles storage class mismatches, this could trigger out-of-bounds memory access or execution flow hijack within the GPU process.

Suggested Fix

Tighten validation in TParseContext::addComma to explicitly reject operands of opaque types or structures containing samplers, matching the logic in ternary operators:

C++
if (IsOpaqueType(left->getBasicType()) || left->getType().isStructureContainingSamplers() ||
    IsOpaqueType(right->getBasicType()) || right->getType().isStructureContainingSamplers())
{
    error(loc, "sequence operator is not allowed for opaque types or structures containing samplers", ",");
}

Evaluated with Chrome root at commit: 208ca3371d87589335b108c431b95a36d768dc47


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 comma operator's parser routine never rejected opaque types or structs containing samplers, unlike the ternary operator, so a sampler-only struct survived into later passes that assumed it had been removed.

Impact

Depending on the driver, malformed SPIR-V could cause out-of-bounds memory access or execution flow hijack in the GPU process, which is unsandboxed on Android; the report notes the trigger path was not executed or verified.

What the attacker needed

Victim loads a crafted WebGL page; Vulkan backend in use; driver mishandles invalid SPIR-V

The fix

The parser's comma handling should reject opaque types and structs containing samplers, matching the ternary operator's check.

How it was found

  1. Supply a WebGL shader that puts a sampler-only struct uniform inside a sequence operator, with a side-effecting assignment to stop folding.
  2. The side effect prevents the expression from being folded and pruned, so the comma nodes remain.
  3. The struct sampler rewrite pass deletes the uniform declaration but does not rewrite the symbol inside the comma expression.
  4. SPIR-V output hits the unresolved symbol, falls through the built-in lookup and emits an invalid built-in decoration.
  5. The malformed SPIR-V is handed to the Vulkan driver in the GPU process.

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 run small graphics programs on the graphics card. ANGLE is the layer that checks those programs before they reach the graphics driver, which is trusted code. Here a checking gap let a malformed program slip through to the driver, and the report suggests a bad driver reaction could crash or corrupt the GPU process, though this was not demonstrated.

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.