Skip to content
Memory corruption Advisory Advanced CVE-2026-121074

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.cc
  • gpu/command_buffer/service/texture_manager.cc
  • ui/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:

  1. Initial Setup: The attacker sets the active texture unit to 5 using gl.activeTexture(gl.TEXTURE5) and binds an attacker-controlled texture A to it. The decoder updates its tracking state (state_.active_texture_unit = 5).
  2. Tracking Size: The attacker issues gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 4, 4, ...) to allocate texture A as a 4x4 texture. The driver allocates it, and the decoder accurately tracks texture A as 4x4.
  3. Malicious Draw State Setup: The attacker compiles and uses a shader program containing two sampler2D uniforms, s0 and s1. They bind these samplers to texture units 0 and 1, respectively.
  4. Trigger Condition 1 (Incomplete Texture): The attacker calls gl.activeTexture(gl.TEXTURE0) and binds texture B, which is intentionally made incomplete (e.g., setting TEXTURE_MIN_FILTER=NEAREST_MIPMAP_LINEAR without supplying mipmaps).
  5. Trigger Condition 2 (Feedback Loop): The attacker calls gl.activeTexture(gl.TEXTURE1) and binds texture D. They also attach texture D as the gl.DEPTH_ATTACHMENT for the currently bound framebuffer, ensuring a color renderbuffer is also attached so the FBO is complete.
  6. Heal Active Unit: The attacker calls gl.activeTexture(gl.TEXTURE5). The decoder updates state_.active_texture_unit to 5 and issues glActiveTextureFn(GL_TEXTURE5) to the driver. At this point, both the decoder and the driver agree that unit 5 is active.
  7. Draw Call Initiation: The attacker issues gl.drawArrays(gl.TRIANGLES, 0, 3). The decoder handles this via GLES2DecoderImpl::HandleDrawArrays, which delegates to DoMultiDrawArrays (gpu/command_buffer/service/gles2_cmd_decoder.cc:9626).
  8. Iterating Samplers (First Sampler): Within DoMultiDrawArrays, the code calls PrepareTexturesForRender(&textures_set, function_name) (gles2_cmd_decoder.cc:9695), which iterates through the active program's samplers (s0 and s1).
  9. Mutating Driver State: For s0 (unit 0), the decoder checks if texture B is renderable via CanRenderWithSampler. Since texture B is incomplete, this returns false. At gles2_cmd_decoder.cc:9254-9257, the decoder sets *textures_set = true, explicitly invokes api()->glActiveTextureFn(GL_TEXTURE0 + 0), and binds a fallback 1x1 black texture via api()->glBindTextureFn(..., black_texture_id(...)).
  10. Desynchronization Established: The driver's active texture state is now GL_TEXTURE0, but the decoder's state_.active_texture_unit remains 5.
  11. Early Return Triggered: The loop continues to s1 (unit 1). The decoder checks for feedback loops using CheckDrawingFeedbackLoopsHelper. Since texture D is bound to both unit 1 and the framebuffer's depth attachment, this helper returns true. Consequently, PrepareTexturesForRender executes an early return (return false; at gles2_cmd_decoder.cc:9238).
  12. Skipping Restoration: Back in DoMultiDrawArrays, because PrepareTexturesForRender returned false, the decoder early-returns error::kNoError (gles2_cmd_decoder.cc:9696). The success-path block containing if (textures_set) { RestoreStateForTextures(); } (gles2_cmd_decoder.cc:9736) is skipped entirely, leaving the driver permanently desynchronized from the decoder.
  13. Decoder State Update: The attacker issues gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 512, 512, ...). The decoder calls TextureManager::GetTextureInfoForTarget, which checks state_.active_texture_unit (still 5), yielding texture A.
  14. Driver State Hijack: The decoder directly calls api()->glTexImage2DFn(..., 512, 512, ...) without first asserting glActiveTexture (texture_manager.cc:3389). Because the driver's active texture is still GL_TEXTURE0 (from step 10), the driver applies the 512x512 size to the 1x1 black texture bound at unit 0.
  15. Desync Amplification: The decoder updates its internal tracking structure via TextureManager::SetLevelInfo, making it believe texture A (unit 5) is 512x512, while on the physical driver, texture A is still 4x4.
  16. Healing Driver State: The attacker issues gl.activeTexture(gl.TEXTURE5). DoActiveTexture unconditionally calls api()->glActiveTextureFn(GL_TEXTURE5) (gles2_cmd_decoder.cc:4995), resynchronizing the driver to unit 5 (where texture A, still 4x4, is bound).
  17. Bounds Check Bypass: The attacker issues gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 512, 512). In GLES2DecoderImpl::DoCopyTexSubImage2D, the decoder queries texture A's size (tracked as 512x512) and passes ValidForTexture bounds checks (gles2_cmd_decoder.cc:13870).
  18. OOB Vulnerability Triggered: The decoder issues api()->glCopyTexSubImage2DFn(..., width=512, height=512) (gles2_cmd_decoder.cc:13967). This reaches the native driver for texture A, which is only 4x4 on the driver side. Passing width=512 exceeds the native texture dimension w_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:

C++
    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. PrepareTexturesForRender modifies the driver's GL_ACTIVE_TEXTURE and binds the 1x1 black_texture_id for unrenderable samplers. If it subsequently fails (e.g., due to a feedback loop), or if ValidateAndAdjustDrawBuffers fails, DoMultiDrawArrays/DoMultiDrawElements return early without calling RestoreStateForTextures. This leaves the driver's state desynced from the decoder's state_.active_texture_unit and state_.texture_units. A subsequent glTexImage2D updates the decoder's tracking size but the GL command modifies black_texture_id on the driver. A later glCopyTexSubImage2D validates 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) per kPassthroughCommandDecoderBlockListByModel in ui/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_VALUE for 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

  1. HandleDrawArrays execution tracing: GLES2DecoderImpl::HandleDrawArrays (gles2_cmd_decoder.cc:9750-9759) successfully passes execution to DoMultiDrawArrays<DrawArraysOption::Default> (9626-9748), exposing the early-return paths.
  2. CheckDrawingFeedbackLoopsHelper: Traced logic in gles2_cmd_decoder.cc:8645-8656. If attachment is valid and attachment->IsTexture(texture_ref) returns true, the function logs GL_INVALID_OPERATION and returns true, triggering the PrepareTexturesForRender abort.
  3. TexImage2D no-rebind check: Confirmed that GLES2DecoderImpl::HandleTexImage2D and TextureManager::DoTexImage (texture_manager.cc:3348-3415) retrieve texture resolution directly from state->texture_units[state->active_texture_unit] and immediately dispatch api()->glTexImage2DFn without asserting glActiveTexture or glBindTexture.
  4. SetLevelInfo tracking desync check: Traced TextureManager::SetLevelInfo (texture_manager.cc:2115-2131) into Texture::SetLevelInfo and UpdateMipCleared (1012-1027), confirming that decoder-side LevelInfo records width and height exactly as parsed from the malicious command despite the native GL call landing on the wrong texture unit.
  5. Target Device Constraint (Android OEM Driver): Investigated ui/gl/init/gl_factory_android.cc:76-86. When UsePassthroughCommandDecoder() is false (as forced by the blocklist in ui/gl/gl_features.cc:57-61), GetAllowedGLImplementations() unambiguously selects kGLImplementationEGLGLES2. This bypasses ANGLE, ensuring that the driver directly receiving the out-of-bounds glCopyTexSubImage2D is 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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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

  1. Set active texture unit to 5 and bind a 4x4 texture A.
  2. Use a shader with two sampler uniforms bound to units 0 and 1.
  3. Bind an incomplete texture B to unit 0 and a texture D to unit 1, also attaching D as the framebuffer depth attachment.
  4. Set active texture unit back to 5 and issue a draw call.
  5. 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.
  6. 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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.