Inappropriate implementation in Tint (CVE-2026-18015)
The MSL backend in Tint only applied the volatile_zero workaround for u32 division and modulo to scalar types, not vector types, so vector operations could be miscompiled by a known Metal compiler bug. An attacker could craft a WebGPU shader that triggers this miscompilation, potentially bypassing robustness clamps and causing out-of-bounds GPU memory access.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 47 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: The MSL backend in Tint fails to apply the volatile_zero workaround for u32 division and modulo operations when performed on vector types. This allows vector operations to be miscompiled by a known Apple Silicon Metal compiler bug, potentially bypassing WebGPU robustness bounds checks and leading to arbitrary out-of-bounds GPU memory access.
Affected files:
third_party/dawn/src/tint/lang/msl/writer/raise/binary_polyfill.cc
Estimated timestamp from git blame: Unknown (Google3 checkout)
Description
Dawn enables a workaround toggle (MetalFixU32DivMod) on Apple Silicon devices to mitigate a known Metal compiler miscompilation affecting u32 division and modulo operations. This workaround, implemented in the MSL backend's BinaryPolyfill transform, injects a volatile_zero to prevent the compiler from incorrectly optimizing these operations.
However, the implementation in third_party/dawn/src/tint/lang/msl/writer/raise/binary_polyfill.cc only applies this workaround to scalar u32 types:
} else if ((op == core::BinaryOp::kModulo || op == core::BinaryOp::kDivide) &&
lhs_type->Is<core::type::U32>()) {
if (config.fix_u32_div_mod) {
umod_worklist.Push(binary);
}
}
The check lhs_type->Is<core::type::U32>() strictly matches scalar types and returns false for core::type::Vector types (e.g., vec3<u32>).
When Tint's core IR BinaryPolyfill transform processes a vector modulo operation, it moves it into a helper function (e.g., tint_mod_v3u32) that implements modulo manually using a vector division instruction (kDivide): result = lhs - ((lhs / rhs_or_one) * rhs_or_one). Because the MSL-specific transform ignores vectors, the vector division instruction inside this helper function is emitted as raw MSL without the critical volatile_zero protection.
Impact and Exploitation
This oversight potentially allows an attacker to trigger the underlying Metal compiler miscompilation from standard WebGPU content, leading to arbitrary memory access within the GPU process.
Potential Attack Steps: Note: These are suggested steps based on source code analysis; our tooling agent cannot execute code to provide a working PoC.
- Craft a Malicious Shader: An attacker writes a WGSL shader that performs a vector modulo operation where the right-hand side is derived from a buffer's length (e.g.,
let index = (a % vec3<u32>(arrayLength(&my_buffer))).x;). - Access Memory: The shader uses this
indexto read or write tomy_buffer[index]. - BCE Eliminates Clamps: Tint's core
Robustnesstransform inserts a safety clamp (e.g.,min(index, length - 1)). However, when Apple's Metal compiler processes the generated MSL, its optimizer recognizes thelhs - ((lhs / rhs) * rhs)pattern as a modulo. The Bounds Check Elimination (BCE) pass incorrectly assumes the modulo result is strictly less than the array length, and strips the WebGPU-insertedmin()clamp, treating it as redundant. - Miscompilation Triggers OOB: Because the
volatile_zeroworkaround was omitted for the vector type, the Metal backend miscompiles the raw 32-bit vector division. This produces a massive, incorrect integer value. Because the safety clamp was removed by BCE, this massive value is used directly for raw pointer arithmetic, leading to out-of-bounds reads or writes in the shared GPU virtual address space.
This could allow an attacker to compromise the sandboxed GPU process by overwriting internal structures or reading sensitive textures/buffers belonging to other origins.
Recommended Fix
- In
third_party/dawn/src/tint/lang/msl/writer/raise/binary_polyfill.cc, update the check to match both scalars and vectors:C++ } else if ((op == core::BinaryOp::kModulo || op == core::BinaryOp::kDivide) && lhs_type->IsUnsignedIntegerScalarOrVector()) { - Update the
UModhelper method within the same file to properly construct avolatile_zerothat matches the width of the target operand (i.e., splatting the scalar zero into a vector iflhsis a vector type).
Evaluated with Chrome root at commit: 65b3256311f3ab6fb9870eaa522de7e6dd2663bb
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.
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
The type check in the BinaryPolyfill transform matched only scalar u32 types, so vector division and modulo operations were emitted without the volatile_zero workaround.
Impact
This could allow an attacker to compromise the sandboxed GPU process by overwriting internal structures or reading sensitive textures or buffers belonging to other origins; the report notes no working proof of concept was executed.
What the attacker needed
Ability to submit WebGPU shader content; Apple Silicon device with the Metal workaround enabled
The fix
The check should be widened to match unsigned integer scalars and vectors, and the helper should build a volatile_zero matching the operand width; the text does not say it was fixed.
How it was found
- Write a shader that performs a vector modulo where the right-hand side comes from a buffer length.
- Use the resulting index to read or write the buffer.
- The Metal compiler's bounds check elimination removes the safety clamp, and the missing workaround causes a miscompiled division producing a huge value.
- The huge value is used for pointer arithmetic, causing out-of-bounds GPU memory access.
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.
A graphics shader is a small program that runs on the graphics card (GPU). The software that translates these programs into the GPU's own language had a safety workaround for a known bug in Apple's GPU compiler, but it only covered simple single-number maths and not lists of numbers (vectors). Because of that gap, a crafted shader could make the GPU read or write memory it should not, which could affect other users' data.
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.