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

Inappropriate implementation in Tint (CVE-2026-7346)

Tint's LoopAnalysis misclassifies certain infinite loops as finite when they use degenerate bounds, bypassing the PreventInfiniteLoops transform. An attacker could craft a WGSL shader that triggers undefined behaviour optimisations in downstream driver compilers, potentially stripping security-critical bounds checks and leading to out-of-bounds memory access on the GPU.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 16 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: Tint's LoopAnalysis misidentifies certain dynamically infinite loops as finite when they use degenerate bounds (e.g., i < 0u). This bypasses the PreventInfiniteLoops transform, allowing an attacker to trigger Undefined Behavior optimizations in downstream driver compilers that strip security-critical memory bounds checks.

Affected files:

  • third_party/dawn/src/tint/lang/core/ir/analysis/loop_analysis.cc

Estimated timestamp from git blame: 2025-07-21

Summary

Tint's LoopAnalysis, which determines if a loop is finite for the PreventInfiniteLoops security transform, contains a logic flaw that misclassifies certain infinite loops as finite. This occurs when a loop exit condition uses a strict inequality comparison (< or >) with a degenerate bound (e.g., idx < 0u for an unsigned index) and fails to verify if the exit branch is actually reachable. This flaw allows an attacker to bypass the mandatory 2^64-iteration cap injection, which in turn allows them to leverage Undefined Behavior (UB) optimizations in downstream driver compilers to bypass Robustness bounds checks.

Root Cause

The vulnerability arises from two interacting gaps in third_party/dawn/src/tint/lang/core/ir/analysis/loop_analysis.cc:

  1. Missing Degenerate-Bound Checks for < and > (lines 243-247): The is_capable_binary_for_loop_exit function accepts kLessThan and kGreaterThan operators if one operand is the loop index and the other is an immutable value. Unlike the implementation for <= and >=, it does not check if the bound value makes the comparison always false (e.g., index < 0u is always false for a u32 index).

  2. Uncorrelated Exit Branch Polarity (line 313): The logic at line 313 considers a loop finite if either the True or False branch of an if instruction leads to an ExitLoop: return is_simple_loop_exit(i->True()) || is_simple_loop_exit(i->False()); This does not account for the condition's polarity. Thus, an if (idx < 0u) { break; } statement is treated as a valid termination even though the break (the True branch) is never reachable.

Potential Attack Vector

An attacker can construct a WGSL shader that exploits this flaw to achieve out-of-bounds (OOB) memory access on the GPU. The following steps outline the theoretical attack mechanism:

  1. Attacker Input: The attacker provides a WGSL shader similar to the following:
    WGSL
    var my_idx = user_provided_index;
    if (my_idx >= array_size) {
        // Syntactically "finite" but dynamically infinite loop
        for (var i: u32 = 1u; ; i = i + 1u) { 
            if (i < 0u) { break; } 
        }
    }
    // Access array
    my_array[my_idx] = 1;
    
  2. Robustness Transform: Tint's Robustness transform executes and replaces my_array[my_idx] with clamped indexing: my_array[min(my_idx, array_size - 1)].
  3. PreventInfiniteLoops Bypass: LoopAnalysis misclassifies the inner loop as finite. Consequently, the PreventInfiniteLoops transform is bypassed, and no iteration cap is injected into the loop.
  4. Driver Compiler UB Optimization: The emitted shader is handed to the downstream driver compiler (e.g., an LLVM-based compiler like Apple's Metal compiler or DXC). The driver compiler statically determines that the inner loop is infinite and has no side effects.
  5. Bounds Check Stripping: Under C++/LLVM semantics, an infinite loop without side effects is Undefined Behavior. The compiler assumes the program will never enter this UB state, marking the if (my_idx >= array_size) branch as unreachable. It then propagates the inverse constraint (my_idx < array_size) globally. When evaluating the robustness check min(my_idx, array_size - 1), it determines the min operation is redundant and optimizes it away to just my_idx.
  6. OOB Execution: The compiler removes the unreachable infinite loop. At runtime, if the attacker provides a my_idx greater than or equal to array_size, execution falls through to the array access. Because the min clamping was stripped, the array access is performed out-of-bounds.

Proposed Fix

Update is_capable_binary_for_loop_exit in loop_analysis.cc to correctly reject degenerate bounds for kLessThan and kGreaterThan operations, similar to the existing logic for kLessThanEqual and kGreaterThanEqual. Additionally, IsBreakIfOnIndex should verify that the ExitLoop resides in the branch that corresponds to the index actually reaching the bound.

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 loop analysis fails to reject degenerate bounds for strict inequality comparisons and does not verify that the exit branch is actually reachable, so loops with conditions like `i < 0u` are incorrectly considered finite.

Impact

An attacker could achieve out-of-bounds memory access on the GPU, potentially leading to memory corruption or information disclosure, though the report notes this is a theoretical attack mechanism.

What the attacker needed

Ability to supply a WGSL shader; downstream driver compiler with UB optimisations

The fix

The fix should update `is_capable_binary_for_loop_exit` to reject degenerate bounds for strict inequalities and ensure `IsBreakIfOnIndex` verifies the exit branch is reachable.

How it was found

  1. Attacker provides a WGSL shader with a loop that has a degenerate bound, such as `if (i < 0u) { break; }`.
  2. Tint's Robustness transform replaces array accesses with clamped indexing.
  3. LoopAnalysis misclassifies the loop as finite, so PreventInfiniteLoops does not inject an iteration cap.
  4. The downstream driver compiler treats the infinite loop as undefined behaviour and may remove the robustness bounds check.
  5. At runtime, an out-of-bounds array access occurs if the attacker supplies an index beyond the array size.

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.

Tint is a compiler that translates shader code (WGSL) into a form that GPU drivers can understand. It has a safety feature that adds a limit to loops to prevent them from running forever, but a bug in how it checks loop conditions means some infinite loops are missed. If an infinite loop is not caught, the GPU driver's own compiler might make unsafe assumptions and remove important memory safety checks, potentially allowing out-of-bounds memory access.

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.