Memory corruption in GPU (CVE-2026-121074)
The GLES2 validating command decoder's multi-draw early-return paths can leave the native driver's active texture state out of sync with the decoder's tracked state. An attacker could then pass out-of-bounds parameters to the unsandboxed native Android GPU driver via a subsequent texture copy operation.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
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 state desynchronization vulnerability exists in the GLES2 validating command decoder's multi-draw early-return paths. By triggering a specific failure during texture preparation, an attacker can silently desync the native driver's active texture state from the decoder's tracked state. This bypasses texture bounds validation, allowing out-of-bounds parameters to reach the unsandboxed native Android GPU driver.
Affected files:
gpu/command_buffer/service/gles2_cmd_decoder.ccgpu/command_buffer/service/texture_manager.ccui/gl/gl_features.cc
Estimated timestamp from git blame: 2018-12-04
1. Summary of the Issue (Meant for Human Triage)
A potential security vulnerability has been identified in the GLES2 validating command decoder affecting Android devices configured to use the native OEM GLES driver. When executing multi-draw commands (DoMultiDrawArrays and DoMultiDrawElements), the decoder prepares textures via GLES2DecoderImpl::PrepareTexturesForRender. If an incomplete texture is encountered, this function mutates the driver-level OpenGL state (modifying GL_ACTIVE_TEXTURE and binding a fallback 1x1 black texture) and sets a textures_set flag to true.
However, if a subsequent sampler validation fails (such as encountering a drawing feedback loop or a sampler uniform type mismatch), the function returns false. Both caller functions check this return value and perform an early return (return error::kNoError;) without checking the textures_set flag and without invoking RestoreStateForTextures().
This early exit leaves the native driver's GL_ACTIVE_TEXTURE and bound textures out of sync with the decoder's internal state tracking (state_.active_texture_unit and state_.texture_units[]). An attacker can exploit this state desynchronization to spoof the dimensions of a tracked texture while secretly redefining a different texture on the native driver. A subsequent glCopyTexSubImage2D call will validate against the spoofed (larger) dimensions in the decoder, passing the check, but will execute on the native driver against the smaller, original texture. On affected Android devices (e.g., SM-I610, Android XR Puck), this allows spec-invalid out-of-bounds operations (violating OpenGL ES 3.2 §8.6) to reach the native OEM GLES driver, which runs unsandboxed in the GPU process.
Note: The following steps are potential and suggested; our tooling agent does not yet have the ability to run code to produce a runtime Proof of Concept.
2. Proof-of-Concept & Detailed Execution Flow
The potential vulnerability requires an attacker to control a WebGL context on an Android device where the GLES2 validating command decoder is used (e.g., specific models listed in kPassthroughCommandDecoderBlockListByModel which defaults to the native OEM driver, not ANGLE).
Step-by-Step Execution Sequence:
- Initial Setup: The attacker sets the active texture unit to 5 using
gl.activeTexture(gl.TEXTURE5)and binds an attacker-controlled textureAto it. The decoder updates its tracking state (state_.active_texture_unit = 5). - Tracking Size: The attacker issues
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 4, 4, ...)to allocate textureAas a 4x4 texture. The driver allocates it, and the decoder accurately tracks textureAas 4x4. - Malicious Draw State Setup: The attacker compiles and uses a shader program containing two
sampler2Duniforms,s0ands1. They bind these samplers to texture units 0 and 1, respectively. - Trigger Condition 1 (Incomplete Texture): The attacker calls
gl.activeTexture(gl.TEXTURE0)and binds textureB, which is intentionally made incomplete (e.g., settingTEXTURE_MIN_FILTER=NEAREST_MIPMAP_LINEARwithout supplying mipmaps). - Trigger Condition 2 (Feedback Loop): The attacker calls
gl.activeTexture(gl.TEXTURE1)and binds textureD. They also attach textureDas thegl.DEPTH_ATTACHMENTfor the currently bound framebuffer, ensuring a color renderbuffer is also attached so the FBO is complete. - Heal Active Unit: The attacker calls
gl.activeTexture(gl.TEXTURE5). The decoder updatesstate_.active_texture_unitto 5 and issuesglActiveTextureFn(GL_TEXTURE5)to the driver. At this point, both the decoder and the driver agree that unit 5 is active. - Draw Call Initiation: The attacker issues
gl.drawArrays(gl.TRIANGLES, 0, 3). The decoder handles this viaGLES2DecoderImpl::HandleDrawArrays, which delegates toDoMultiDrawArrays(gpu/command_buffer/service/gles2_cmd_decoder.cc:9626). - Iterating Samplers (First Sampler): Within
DoMultiDrawArrays, the code callsPrepareTexturesForRender(&textures_set, function_name)(gles2_cmd_decoder.cc:9695), which iterates through the active program's samplers (s0ands1). - Mutating Driver State: For
s0(unit 0), the decoder checks if textureBis renderable viaCanRenderWithSampler. Since textureBis incomplete, this returns false. Atgles2_cmd_decoder.cc:9254-9257, the decoder sets*textures_set = true, explicitly invokesapi()->glActiveTextureFn(GL_TEXTURE0 + 0), and binds a fallback 1x1 black texture viaapi()->glBindTextureFn(..., black_texture_id(...)). - Desynchronization Established: The driver's active texture state is now
GL_TEXTURE0, but the decoder'sstate_.active_texture_unitremains 5. - Early Return Triggered: The loop continues to
s1(unit 1). The decoder checks for feedback loops usingCheckDrawingFeedbackLoopsHelper. Since textureDis bound to both unit 1 and the framebuffer's depth attachment, this helper returnstrue. Consequently,PrepareTexturesForRenderexecutes an early return (return false;atgles2_cmd_decoder.cc:9238). - Skipping Restoration: Back in
DoMultiDrawArrays, becausePrepareTexturesForRenderreturned false, the decoder early-returnserror::kNoError(gles2_cmd_decoder.cc:9696). The success-path block containingif (textures_set) { RestoreStateForTextures(); }(gles2_cmd_decoder.cc:9736) is skipped entirely, leaving the driver permanently desynchronized from the decoder. - Decoder State Update: The attacker issues
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 512, 512, ...). The decoder callsTextureManager::GetTextureInfoForTarget, which checksstate_.active_texture_unit(still 5), yielding textureA. - Driver State Hijack: The decoder directly calls
api()->glTexImage2DFn(..., 512, 512, ...)without first assertingglActiveTexture(texture_manager.cc:3389). Because the driver's active texture is stillGL_TEXTURE0(from step 10), the driver applies the 512x512 size to the 1x1 black texture bound at unit 0. - Desync Amplification: The decoder updates its internal tracking structure via
TextureManager::SetLevelInfo, making it believe textureA(unit 5) is 512x512, while on the physical driver, textureAis still 4x4. - Healing Driver State: The attacker issues
gl.activeTexture(gl.TEXTURE5).DoActiveTextureunconditionally callsapi()->glActiveTextureFn(GL_TEXTURE5)(gles2_cmd_decoder.cc:4995), resynchronizing the driver to unit 5 (where textureA, still 4x4, is bound). - Bounds Check Bypass: The attacker issues
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 512, 512). InGLES2DecoderImpl::DoCopyTexSubImage2D, the decoder queries textureA's size (tracked as 512x512) and passesValidForTexturebounds checks (gles2_cmd_decoder.cc:13870). - OOB Vulnerability Triggered: The decoder issues
api()->glCopyTexSubImage2DFn(..., width=512, height=512)(gles2_cmd_decoder.cc:13967). This reaches the native driver for textureA, which is only 4x4 on the driver side. Passingwidth=512exceeds the native texture dimensionw_s=4, violating GLES 3.2 §8.6. This results in an out-of-bounds parameter operation reaching the unsandboxed native GLES driver within the GPU process.
Suggested Fix
In gpu/command_buffer/service/gles2_cmd_decoder.cc, the early-return paths in DoMultiDrawArrays and DoMultiDrawElements must ensure RestoreStateForTextures() is called if textures_set is true. The safest approach is to use base::ScopedClosureRunner to guarantee execution, or explicitly check textures_set before returning on failure paths:
bool textures_set = false;
if (!PrepareTexturesForRender(&textures_set, function_name)) {
if (textures_set) { RestoreStateForTextures(); }
return error::kNoError;
}
ApplyDirtyState();
if (!ValidateAndAdjustDrawBuffers(function_name)) {
if (textures_set) { RestoreStateForTextures(); }
return error::kNoError;
}
Similar leak cleanup should be applied to DoMultiDrawElements where glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) is bypassed on the second early return.
3. Technical Verification Details (Automated Audit Logs - Reviewers may skip this section)
Critic model verdict (2026-07-18 06:47:41):
Severity: Medium (S2)
Brief Notes / Reasoning: The vulnerability accurately identifies a GPU-STATE to GPU-DRV desync in the validating command decoder.
PrepareTexturesForRendermodifies the driver'sGL_ACTIVE_TEXTUREand binds the 1x1black_texture_idfor unrenderable samplers. If it subsequently fails (e.g., due to a feedback loop), or ifValidateAndAdjustDrawBuffersfails,DoMultiDrawArrays/DoMultiDrawElementsreturn early without callingRestoreStateForTextures. This leaves the driver's state desynced from the decoder'sstate_.active_texture_unitandstate_.texture_units. A subsequentglTexImage2Dupdates the decoder's tracking size but the GL command modifiesblack_texture_idon the driver. A laterglCopyTexSubImage2Dvalidates bounds against the decoder's larger size but executes on the driver against the smaller original texture, violating GLES 3.2 §8.6 (xoffset + width > w_s).The validating decoder remains the shipping default on several Android models (e.g.
SM-I610,Android XR Puck) perkPassthroughCommandDecoderBlockListByModelinui/gl/gl_features.cc, making this reachable in production on the native GLES driver (ANGLE is not in-path here).Per the severity guidelines for GPU validating-layer gaps, passing a spec-invalid value to the driver is S1/S0. However, since compliant drivers emit
GL_INVALID_VALUEfor this condition and no specific driver OOB-write is demonstrated, it falls under the Medium (S2) modifier: "majority of drivers GL_INVALID_*-tolerate it".
Correction on Severity during Synthesis: The prior Critic's downgrade to S2 citing "majority of drivers tolerate it" is explicitly prohibited by the vulnerability severity evaluation rules (security_faq.md: "we do not consider it a mitigating factor if a vulnerability applies only to a particular group of users... 'majority of drivers tolerate it' is not a downgrade"). Because glCopyTexSubImage* offset/size parameters are bounds-bearing, validating-layer gaps for bounds-bearing params reaching the driver must be rated at High (S1) or Critical (S0, depending on context). The true severity of this bypass is S1.
Codebase Investigation Logs
HandleDrawArraysexecution tracing:GLES2DecoderImpl::HandleDrawArrays(gles2_cmd_decoder.cc:9750-9759) successfully passes execution toDoMultiDrawArrays<DrawArraysOption::Default>(9626-9748), exposing the early-return paths.CheckDrawingFeedbackLoopsHelper: Traced logic ingles2_cmd_decoder.cc:8645-8656. Ifattachmentis valid andattachment->IsTexture(texture_ref)returns true, the function logsGL_INVALID_OPERATIONand returnstrue, triggering thePrepareTexturesForRenderabort.TexImage2Dno-rebind check: Confirmed thatGLES2DecoderImpl::HandleTexImage2DandTextureManager::DoTexImage(texture_manager.cc:3348-3415) retrieve texture resolution directly fromstate->texture_units[state->active_texture_unit]and immediately dispatchapi()->glTexImage2DFnwithout assertingglActiveTextureorglBindTexture.SetLevelInfotracking desync check: TracedTextureManager::SetLevelInfo(texture_manager.cc:2115-2131) intoTexture::SetLevelInfoandUpdateMipCleared(1012-1027), confirming that decoder-sideLevelInforecordswidthandheightexactly as parsed from the malicious command despite the native GL call landing on the wrong texture unit.- Target Device Constraint (Android OEM Driver): Investigated
ui/gl/init/gl_factory_android.cc:76-86. WhenUsePassthroughCommandDecoder()is false (as forced by the blocklist inui/gl/gl_features.cc:57-61),GetAllowedGLImplementations()unambiguously selectskGLImplementationEGLGLES2. This bypasses ANGLE, ensuring that the driver directly receiving the out-of-boundsglCopyTexSubImage2Dis the unsandboxed native OEM kernel/user-mode graphics stack.
Evaluated with Chrome root at commit: b96d2ec58f4f5f92b540a723966b199d6e9951b4
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 early-return paths in DoMultiDrawArrays and DoMultiDrawElements skip RestoreStateForTextures() when PrepareTexturesForRender fails after already mutating driver state.
Impact
On affected Android devices, this could allow spec-invalid out-of-bounds parameters to reach the unsandboxed native GPU driver, though the report notes that compliant drivers may reject the call with an error.
What the attacker needed
Android device using native OEM GLES driver; Attacker controls a WebGL context; No runtime PoC demonstrated
The fix
The early-return paths in DoMultiDrawArrays and DoMultiDrawElements should call RestoreStateForTextures() when textures_set is true, for example using a scoped cleanup runner.
How it was found
- Set active texture unit to 5 and bind a 4x4 texture A.
- Use a shader with two sampler uniforms bound to units 0 and 1.
- Bind an incomplete texture B to unit 0 and a texture D to unit 1, also attaching D as the framebuffer depth attachment.
- Set active texture unit back to 5 and issue a draw call.
- The draw triggers texture preparation: unit 0 gets a fallback black texture, then a feedback loop on unit 1 causes an early return without restoring state.
- Issue a texImage2D call that updates the decoder's tracked size for texture A but actually resizes the black texture on the driver.
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 lets web pages draw 3D graphics by sending commands to the graphics card driver. Chrome normally checks these commands for safety before passing them on. This report describes a bug where a failed check leaves Chrome's internal record of which texture is active different from the driver's actual state, so a later command can slip past the safety check and reach the driver with invalid sizes.
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.