Out of bounds read and write in ANGLE (CVE-2026-16419)
ANGLE's GLSL translator hashes user-defined identifiers with a non-cryptographic 64-bit hash and does not check whether two different names produce the same hashed identifier. An attacker who finds a collision could make the emitted GLSL resolve an access to a small inner array while the bounds clamp was computed for a large outer array, leading to out-of-bounds GPU memory reads and writes.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 39 days
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 potential vulnerability exists in ANGLE's GLSL translator where identifier hash collisions allow for out-of-bounds GPU memory access. When CityHash64 generates identical hashes for different user-defined variable names, the emitted GLSL assigns them the same identifier, causing scope resolution confusion. This allows attackers to bypass AST-based bounds clamping and execute OOB reads/writes in the GPU process.
Affected files:
third_party/angle/src/compiler/translator/HashNames.cppgpu/command_buffer/service/gles2_cmd_decoder.cc
Estimated timestamp from git blame: Unknown (Google3 checkout)
Summary
A potential vulnerability in ANGLE's GLSL translator allows for out-of-bounds (OOB) memory access on the GPU. The issue arises because Chromium configures ANGLE to use a non-cryptographic 64-bit hash function (base::legacy::CityHash64) for WebGL identifier obfuscation, without checking if the resulting hashed identifier collides with previously generated hashes. This allows an attacker to craft shader identifiers that collide, causing "Scope Resolution Confusion" and neutralizing bounds checks in the final translated GLSL output.
Root Cause Analysis
In third_party/angle/src/compiler/translator/HashNames.cpp, ANGLE hashes user-defined identifier names (e.g., variables, functions) to obfuscate source code and prevent clashes with built-ins. In Chromium's WebGL implementation, this feature is enabled by default and utilizes base::legacy::CityHash64.
Because CityHash64 is an unseeded, non-cryptographic hash function, an attacker can feasibly compute a 64-bit collision offline in roughly $2^{32}$ operations. When hashing is enabled, sh::HashName computes the hash of the identifier and prefixes it (e.g., webgl_0123456789ABCDEF).
The vulnerability exists in how ANGLE caches these hashes in AddToNameMapIfNotMapped:
void AddToNameMapIfNotMapped(const ImmutableString &name,
const ImmutableString &hashedName,
NameMap *nameMap)
{
if (nameMap)
{
NameMap::const_iterator it = nameMap->find(name.data());
if (it != nameMap->end())
{
return;
}
(*nameMap)[name.data()] = hashedName.data();
}
}
The implementation successfully checks if the original identifier string (name) already exists in the map. However, it fails to verify if the generated hashedName has already been assigned to a completely different original identifier. Consequently, two distinct AST symbols are mapped to the exact same string in the emitted GLSL.
Potential Exploitation Scenario
Note: These steps outline a potential theoretical attack path, as we do not currently have the capability to execute a working Proof of Concept.
- Collision Generation: The attacker computes two distinct strings,
N_1andN_2, that produce aCityHash64collision. - Shader Construction: In a malicious WebGL shader, the attacker declares
N_1as a large array (e.g.,float N_1[16384]) in the global scope, andN_2as a small array (e.g.,float N_2[1]) in a nested inner scope. - AST Construction: ANGLE parses the shader. Because
N_1andN_2are different strings, they are tracked as distinctTVariables in the symbol table across overlapping scopes. AccessingN_1[index]inside the inner scope correctly resolves to the large outer array. - Bounds Clamping: ANGLE applies security transformations. The
ClampIndirectIndicespass inspectsN_1[index], notes the size is 16384, and transforms the index toclamp(index, 0, 16383). - Code Emission: During GLSL emission (
TOutputGLSLBase), both variables are passed toHashName. Due to the collision, they both yield the exact same identifier (e.g.,webgl_DEADBEEF). - Driver Compilation: The browser sends the emitted GLSL to the underlying native GPU driver. The driver parses:
- Global:
float webgl_DEADBEEF[16384]; - Inner:
float webgl_DEADBEEF[1]; - Access:
webgl_DEADBEEF[clamp(index, 0, 16383)];
- Global:
- OOB Access: Following standard GLSL scoping rules, the native driver resolves the access to the inner, size-1 array. However, the clamped index permits bounds up to 16383. When executed on the GPU, this results in out-of-bounds local memory access.
Impact
This vulnerability provides a primitive for out-of-bounds GPU memory reads and writes from a WebGL shader. Local memory on GPUs typically maps to registers or thread-local scratch memory. Accessing this memory out-of-bounds allows an attacker to corrupt GPU thread control flow, leading to arbitrary code execution within the GPU process. On platforms where the GPU process is unsandboxed (e.g., Android), this equates to a full system compromise.
Suggested Fix
There are multiple ways to address this:
- Add Collision Detection: Modify
AddToNameMapIfNotMappedto also check the values inmNameMapto ensure the generatedhashedNameis not already in use. If a collision is detected, append a counter or re-hash. - Seed the Hash Function: Seed
CityHash64with a high-entropy random value generated per-context or per-compilation, making offline collision generation impossible. - Use an Incrementing ID: Instead of a hash, simply assign an incrementing integer ID to variables as they are encountered (e.g.,
webgl_var_1,webgl_var_2), completely eliminating the possibility of collisions.
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
Likely the name-hashing cache checks only whether the original identifier was already mapped, not whether the generated hashed identifier is already in use by a different original identifier.
Impact
This could provide a primitive for out-of-bounds GPU memory reads and writes, potentially leading to arbitrary code execution in the GPU process and, on platforms where that process is unsandboxed, full system compromise; the report notes no working proof of concept exists.
What the attacker needed
Ability to run a WebGL shader; offline computation of a 64-bit hash collision; no working proof of concept exists
The fix
The report suggests adding collision detection to the name map, seeding the hash per context, or using an incrementing identifier instead of a hash; it does not say the issue was fixed.
How it was found
- Compute two different identifier strings that produce the same CityHash64 value.
- Declare one colliding name as a large global array and the other as a small array in an inner scope in a WebGL shader.
- Let ANGLE parse the shader so the two names are tracked as separate variables in overlapping scopes.
- Observe that the bounds-clamping pass uses the large array's size for the index expression.
- Observe that GLSL emission gives both variables the same hashed identifier.
- The native GPU driver then resolves the access to the small inner array while the clamped index still allows the large range, causing an out-of-bounds 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.
WebGL shaders are small programs sent to the graphics card. Before sending them, the browser renames the programmer's variables to avoid clashes with built-in names, using a hash (a short fingerprint of the name). If two different names get the same fingerprint, the graphics driver can confuse them and read or write outside the intended array, which is dangerous.
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.