Out of bounds write in ANGLE (CVE-2026-79019)
ANGLE's HLSL translator decorates global and local variable names in a way that can collide, letting a local array shadow a global array of the same decorated name. The bounds check is then computed from the global array's size but applied to the smaller local array, so an attacker-controlled index can cause out-of-bounds reads and writes on the GPU.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
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 deterministic identifier collision in ANGLE's HLSL translator allows local variables to shadow global variables in the generated HLSL code. This shadowing causes AST-based array bounds checks to be applied to the wrong variable, potentially leading to out-of-bounds reads and writes on the GPU stack.
Affected files:
third_party/angle/src/compiler/translator/hlsl/UtilsHLSL.cpp
Estimated timestamp from git blame: 2019-02-04
Background
When ANGLE translates GLSL to HLSL for the Direct3D backend, it decorates identifiers to avoid name collisions. This logic is implemented in DecorateVariableIfNeeded within third_party/angle/src/compiler/translator/hlsl/UtilsHLSL.cpp.
Global variables are decorated by prepending an underscore _. For example, a global variable named a3005 becomes _a3005.
Local variables (which receive the EvqTemporary qualifier) are decorated by prepending _ and appending the variable's internal sequential uniqueId. For example, a local variable named a that is assigned a uniqueId of 3005 also becomes _a3005.
Vulnerability Details
Because TSymbolTable resets its mUniqueIdCounter to kFirstUserDefinedSymbolId (3000) at the start of every shader compilation, unique IDs are assigned deterministically. An attacker can control a local variable's ID by declaring a specific number of dummy variables prior to it.
This predictable assignment allows a local variable to intentionally collide with the decorated name of a global variable. When the HLSL is generated, standard scoping rules apply, and the local declaration within the function shadows the global declaration.
This shadowing bypasses ANGLE's array bounds checking pass, ClampIndirectIndices. The pass inserts a clamp() operation based on the size of the array in the Abstract Syntax Tree (AST). If the AST correctly points to a large global array, a large clamp bound is generated. However, the underlying HLSL compiler will execute this clamped access against the shadowed, smaller local array, resulting in out-of-bounds memory access.
Potential Attacker Steps
An attacker could potentially trigger this by supplying the following WebGL shader:
- Declare a large global array:
float a3005[100];. - Declare dummy variables to increment the internal symbol ID counter to exactly 3004.
- Inside a function, declare a small local array:
float a[1];. This variable receivesuniqueId3005. - Access the global array using an attacker-controlled index:
a3005[index];.
During compilation:
ClampIndirectIndicesanalyzes the AST, sees the access to the globala3005of size 100, and emits:clamp(index, 0, 99).OutputHLSLgenerates the global variable:static float _a3005[100];.OutputHLSLgenerates the local variable, creating a name collision:float _a3005[1];.OutputHLSLgenerates the array access:_a3005[clamp(index, 0, 99)].
When the HLSL executes, _a3005 resolves to the local array of size 1. An attacker supplying an index of 50 will read/write memory far past the end of the local array on the GPU's stack or registers.
(Note: These are potential steps based on code analysis; our tooling agent does not yet have the ability to run code to confirm a live exploit.)
Impact
Out-of-bounds reads and writes on the GPU can lead to arbitrary code execution within the GPU process. On platforms where HLSL is used (primarily Windows), this constitutes a sandbox escape from the highly restricted WebGL renderer process into the GPU process.
Suggested Fix
The decoration scheme for temporary variables should use a separator that cannot be part of a user-defined GLSL identifier. Since WebGL shaders are restricted from using double underscores __ or starting identifiers with certain characters, using a safer decoration pattern would prevent these collisions.
For example, in third_party/angle/src/compiler/translator/hlsl/UtilsHLSL.cpp:
return Decorate(variable.name()) + "__" + str(variable.uniqueId().get());
Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff
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 identifier decoration scheme for temporary variables can produce the same name as a decorated global variable, so the generated HLSL shadows the global and the AST-based clamp bound no longer matches the array actually accessed.
Impact
Out-of-bounds reads and writes on the GPU could lead to arbitrary code execution in the GPU process, which on Windows may constitute a sandbox escape from the WebGL renderer; the report notes the steps are based on code analysis and were not confirmed with a live exploit.
What the attacker needed
Ability to supply a WebGL shader; HLSL/Direct3D backend (mainly Windows)
The fix
The decoration for temporary variables should use a separator that cannot appear in a user-defined GLSL identifier, such as a double underscore, so collisions cannot occur.
How it was found
- Declare a large global array in the shader.
- Declare dummy variables so the internal symbol ID counter reaches the value needed for the collision.
- Declare a small local array inside a function so it receives the colliding unique ID.
- Access the global array with an attacker-controlled index, which is clamped to the global size but applied to the shadowed local array.
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.
When a browser runs a WebGL shader, it translates the shader code into another language (HLSL) for the graphics driver. To keep names unique, the translator renames variables, but two different variables can end up with the same new name. The safety check that keeps array indexes in range then uses the wrong array's size, so a crafted shader can read or write past the end of a small array in graphics memory.
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.