Uninitialized Use in WebGL (CVE-2026-9921)
A logic error in WebGL texture handling marks a texture as cleared before a copy operation succeeds. If the copy fails due to induced GPU out-of-memory, the texture remains uninitialized but is treated as safe to read, allowing an attacker to leak stale VRAM that may contain cross-origin data.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 51 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 without the security team.
Overview: GLES2DecoderImpl::DoCopyTexSubImage2D updates a texture's cleared state before ensuring the copy operation succeeds. If the copy fails (e.g., due to an induced GPU out-of-memory error), the texture remains uninitialized but is marked as cleared, allowing an attacker to read stale, potentially cross-origin VRAM.
Affected files:
gpu/command_buffer/service/gles2_cmd_decoder.ccgpu/command_buffer/service/gles2_cmd_copy_tex_image.cc
Estimated timestamp from git blame: 2016-10-12
Description
There is a logic error in GLES2DecoderImpl::DoCopyTexSubImage2D where the 'cleared' state of a destination texture is updated prematurely. The function updates the cleared_rect (via SetLevelCleared or SetLevelClearedRect) before performing the actual copy operation.
If the subsequent setup for the copy or the copy itself fails, the function exits early without rolling back the cleared state. Because WebGL contexts are created with lose_context_when_out_of_memory set to false, an attacker can survive an induced Out-Of-Memory (OOM) error and subsequently sample from the uninitialized texture, leading to a cross-origin leakage of GPU memory.
Potential Trigger Steps
- Initialize Context: The attacker creates a WebGL context. By default,
lose_context_when_out_of_memoryisfalsefor WebGL contexts (gpu/ipc/common/gpu_channel.mojom), allowing the context to survive aGL_OUT_OF_MEMORYevent. - Induce Memory Pressure: The attacker aggressively allocates large WebGL textures to push the GPU driver close to its memory limit.
- Allocate Target Texture: The attacker calls
gl.texImage2D(..., null)with a format likeGL_LUMINANCE(which requires blit emulation on GLES3 devices).TextureManager::DoTexImageallocates VRAM but correctly leaves itscleared_rectempty, marking it uncleared. - Execute Copy: The attacker calls
gl.copyTexSubImage2Dwith dimensions that exactly cover the full size of the destination texture level. - Premature State Change: In
GLES2DecoderImpl::DoCopyTexSubImage2D, the code evaluates the bounds (destX == 0 && destY == 0 && src.width() == level_width && src.height() == level_height) and immediately executestexture_manager()->SetLevelCleared(..., true). The texture is now formally considered initialized and safe to read from. - OOM Failure: Because
GL_LUMINANCErequires a blit, the code callsInitializeCopyTexImageBlitter. InsideCopyTexImageResourceManager::Initialize, GL resource allocations (e.g., shaders, framebuffers) fail due to the induced memory pressure, triggering aGL_OUT_OF_MEMORYerror. - Early Exit:
InitializeCopyTexImageBlitterdetects the error viaLOCAL_PEEK_GL_ERRORand returnsfalse.DoCopyTexSubImage2Dthen immediately exits via an earlyreturn;. - VRAM Leak: The actual copy is skipped. The texture remains physically uninitialized in VRAM but is tracked as cleared. The attacker binds the texture and reads its contents (e.g., via
glReadPixels), successfully leaking cross-origin VRAM.
Suggested Fix
Defer the state updates to the Texture's cleared state until after the copy operation has been successfully executed. Specifically, move the calls to texture_manager()->SetLevelCleared and texture_manager()->SetLevelClearedRect to occur only after InitializeCopyTexImageBlitter (if applicable) and the subsequent copy commands (DoCopyTexSubImageToLUMACompatibilityTexture or glCopyTexSubImage2DFn) have completed without critical errors. This aligns the logic with GLES2DecoderImpl::DoCopyTexImage2D, which safely sets the cleared state only after verifying GL_NO_ERROR.
Evaluated with Chrome root at commit: f200f57a19490707ff8bc7aa5de3cbc443a3afad
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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
The function updates the texture's cleared state before performing the copy, and does not roll back that state if the copy fails.
Impact
An attacker could leak stale VRAM that may contain cross-origin data, but the exploit requires inducing a GPU out-of-memory condition and the text does not demonstrate a working exploit.
What the attacker needed
WebGL support; ability to induce GPU out-of-memory; no user interaction required
The fix
The cleared state should be updated only after the copy operation succeeds, matching the logic in DoCopyTexImage2D.
How it was found
- Create a WebGL context that survives out-of-memory errors.
- Allocate many large textures to exhaust GPU memory.
- Allocate a target texture with a format that requires blit emulation.
- Call copyTexSubImage2D to cover the full destination texture.
- The copy setup fails with an out-of-memory error and the function exits early.
- Read back the texture contents to leak uninitialized VRAM.
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 program creates a new texture in graphics memory, it should be empty or zeroed. This bug marks a texture as 'ready to use' before the copy that fills it actually happens. If that copy fails, the texture still contains old data from other programs, and the attacker can read it.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.