Out of bounds write in ANGLE (CVE-2026-16413)
A validation flaw in ANGLE's fragment shader output variable linking lets a shader output array exceed the maximum draw buffers limit when per-element bindings are used. This can cause out-of-bounds heap and stack writes in the Vulkan pipeline cache warm-up path, potentially allowing arbitrary code execution in the GPU process from a compromised renderer.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 55 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: A potential validation logic error in ANGLE's fragment shader output variable linking allows output arrays to exceed the maximum draw buffers limit. When certain per-element bindings are used, this bypasses validation and triggers out-of-bounds stack and heap writes in the Vulkan pipeline cache warm-up path. This could potentially allow arbitrary code execution in the GPU process from a compromised renderer.
Affected files:
third_party/angle/src/libANGLE/ProgramExecutable.cppthird_party/angle/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cppthird_party/angle/src/libANGLE/renderer/vulkan/vk_cache_utils.cppthird_party/angle/src/libANGLE/Program.hthird_party/angle/src/libANGLE/renderer/vulkan/vk_cache_utils.hthird_party/angle/src/common/FixedVector.h
Estimated timestamp from git blame: 2021-10-28
Summary
A potential logic flaw in ANGLE's output variable validation allows a fragment shader output array to span past IMPLEMENTATION_MAX_DRAW_BUFFERS (which is 8) when per-element API bindings are used via glBindFragDataLocationEXT. This validation bypass subsequently triggers out-of-bounds (OOB) writes on both the heap and stack within the Vulkan backend during pipeline cache warm-up, presenting a potential path to arbitrary code execution (RCE) in the GPU process.
Vulnerability Analysis
In ProgramExecutable::linkValidateOutputVariables (third_party/angle/src/libANGLE/ProgramExecutable.cpp), ANGLE processes per-element API bindings of the form name[k] (where k >= 1). It records VariableLocation(arrayIndex=k, varIdx) in reservedLocations and validates that they are under maxDrawBuffers. The base location is then assigned, and a guard calls FindUsedOutputLocation(outputLocations, maxLocation, baseLocation + elementCount - maxLocation, reservedLocations, idx) to detect if any indices exceed maxLocation.
There are two potential bypasses for this validation:
-
Bypass A (Aliasing in
FindUsedOutputLocation): WithinFindUsedOutputLocation, a queryVariableLocation(elementIndex, variableIndex)is constructed, whereelementIndexis calculated as the offset from the passedbaseLocationparameter (which ismaxLocationwhen called by the over-max guard). However,VariableLocation::operator==(third_party/angle/src/libANGLE/Program.h) only compares{arrayIndex, index}. Thus, if an attacker has reserved a location forname[L - maxLocation](registering aVariableLocationwitharrayIndex = L - maxLocation), a query checking a truly used slot at locationLwill incorrectly match this reserved location. The guard is misled into treating a used slot as reserved, causing it to returnfalseand allowing the link to succeed. -
Bypass B (Redirected Elements): If the attacker binds all array elements except element 0 to low, valid locations, then no slots at or above
maxLocationare occupied inoutputLocations. Consequently, the guard legitimately passes. However, downstream code ingatherOutputTypesand the Vulkan/Metal backends computes location contiguously aspod.location + elementIndexfor all elements, completely ignoring the per-element redirects. WithmaxDrawBuffers = 8and an array size of 8, the contiguous locations reach up to index 14 (i.e.,7 + 8 - 1).
Downstream Impact (Vulkan Backend)
When linking a program with the Vulkan backend feature warmUpPipelineCacheAtLink enabled, ANGLE calls SetupDefaultPipelineState in ProgramExecutableVk.cpp. This triggers potential memory corruption:
-
Intra-object Heap/Stack Overflow: The loop over
arrayIndex(0 to 7) callssetRenderPassColorAttachmentFormat(pod.location + arrayIndex, ...)which invokesRenderPassDesc::packColorAttachmentinvk_cache_utils.cpp. This writes tomAttachmentFormatson astd::array<uint8_t, 9>. For indexes 9 to 14, this results in an intra-object overflow past the array boundary into adjacent fields ofmWarmUpGraphicsPipelineDesc, while settingmColorAttachmentRangeto 15. -
Stack Buffer Overflow in
MakeRenderPass: When!preferDynamicRenderingis true,RenderPassCache::MakeRenderPassloops up tocolorAttachmentRange(15). Since the OOB-written formats at indices 9..14 are non-zero,isColorAttachmentEnabledreturns true, causingcolorAttachmentRefs.push_back(...)to execute 15 times on a stack-allocatedFixedVector<VkAttachmentReference2, 8>. BecauseFixedVector::push_backlacks runtime bounds checks in release builds, this overwrites 7 elements (~224 bytes) of stack data withVkAttachmentReference2structures.
Suggested / Potential Reproduction Steps
Note: These are potential steps as our tooling does not have the ability to execute code.
-
Establish a compromised renderer process driving the passthrough GLES2 decoder with an ANGLE ES3 context supporting
EXT_blend_func_extendedand a Vulkan backend withwarmUpPipelineCacheAtLinkenabled. -
Create a GL program
p, attach a vertex shader and a fragment shader containing:GLSL #version 300 es precision mediump float; out vec4 fragData[8]; void main() { for(int i = 0; i < 8; ++i) fragData[i] = vec4(1); } -
Issue the following explicit GLES2 command buffer bindings:
BindFragDataLocationEXTBucket(p, 7, "fragData"); BindFragDataLocationEXTBucket(p, 0, "fragData[1]"); BindFragDataLocationEXTBucket(p, 1, "fragData[2]"); BindFragDataLocationEXTBucket(p, 2, "fragData[3]"); BindFragDataLocationEXTBucket(p, 3, "fragData[4]"); BindFragDataLocationEXTBucket(p, 4, "fragData[5]"); BindFragDataLocationEXTBucket(p, 5, "fragData[6]"); BindFragDataLocationEXTBucket(p, 6, "fragData[7]"); -
Trigger the Vulkan OOB write by calling
LinkProgram(p)on the program.
Suggested Fix
- Modify
FindUsedOutputLocationso that it uses the correct corresponding array index offset when constructingVariableLocationfor verification, or enforce strict bounds checks on the total potential location span (baseLocation + elementCount) directly againstmaxDrawBuffersregardless of explicit bindings during the initial link validation stage. - Add hardening checks in
RenderPassDesc::packColorAttachmentto explicitly drop or error on any attachment indices exceedingkMaxFramebufferNonResolveAttachmentsinstead of relying on debug-onlyASSERTstatements.
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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 reserved-location comparison ignores the base offset, and downstream code computes locations contiguously while ignoring per-element redirects, so the bounds guard is bypassed.
Impact
This could potentially allow arbitrary code execution in the GPU process, though only from an already compromised renderer and only when the Vulkan backend with pipeline cache warm-up is in use.
What the attacker needed
Compromised renderer process; ANGLE ES3 context with EXT_blend_func_extended; Vulkan backend; warmUpPipelineCacheAtLink enabled
The fix
The validation should use the correct array index offset and enforce strict bounds on the total location span, with hardening checks in the attachment packing code; the text does not say it was fixed.
How it was found
- Set up a compromised renderer with the passthrough GLES2 decoder, an ANGLE ES3 context supporting EXT_blend_func_extended, and a Vulkan backend with warmUpPipelineCacheAtLink enabled.
- Create a program with a fragment shader declaring an output array of eight vec4 elements.
- Bind the array base to a high location and each remaining element to low locations via the per-element bind commands.
- Link the program to trigger the out-of-bounds write in the Vulkan path.
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 shader is a small program that runs on the graphics card. ANGLE is the layer that translates web graphics calls into the graphics driver's own language. A check meant to stop a shader from writing to more output slots than exist could be fooled, so the program writes past the end of a fixed-size list in memory, which can crash or corrupt the graphics process.
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.