Uninitialized resource in ANGLE (CVE-2026-79118)
ANGLE's OpenGL backend can clear only the depth aspect of a packed depth-stencil resource while marking the whole shared resource as initialised, so the stencil aspect keeps uninitialised GPU memory. An attacker could then read that memory back through stencil-tested draws and readPixels, potentially leaking data belonging to other tabs.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 41 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 issue in ANGLE's OpenGL backend may allow uninitialized GPU memory to be disclosed to web content. When robust resource initialization is enabled, FramebufferGL can take a fast path that clears only one aspect of a packed depth-stencil resource. This falsely marks the entire resource as initialized, potentially allowing the uncleared aspect containing uninitialized VRAM to be read back.
Affected files:
third_party/angle/src/libANGLE/renderer/gl/FramebufferGL.cppthird_party/angle/src/libANGLE/Framebuffer.cppthird_party/angle/src/libANGLE/renderer/gl/BlitGL.cppthird_party/angle/src/libANGLE/Renderbuffer.cpp
Estimated timestamp from git blame: 2024-04-29
Potential robust resource init bypass via FramebufferGL per-aspect clear on packed depth-stencil
Root Cause Analysis
When robust resource initialization is enabled, the front-end tracks depth and stencil initialization needs separately in mState.mResourceNeedsInit. However, the underlying resource (such as a Renderbuffer) uses a single shared mInitState across all aspects.
During a partial clear of a packed depth-stencil attachment (such as clearing only the depth aspect via glClearBufferfv(GL_DEPTH)), the frontend calls Framebuffer::ensureClearBufferAttachmentsInitialized. Since only the depth aspect is requested, it forwards clearDepth = true and clearStencil = false to the backend:
// third_party/angle/src/libANGLE/Framebuffer.cpp
ANGLE_TRY(mImpl->ensureAttachmentsInitialized(context, clearColorAttachments, clearDepth,
clearStencil)); // clearDepth=true, clearStencil=false
On most backends, this delegates to FramebufferImpl::ensureAttachmentsInitialized, which initializes the entire packed resource. However, FramebufferGL overrides this method. When there are no color attachments on the FBO (such as on a depth-stencil-only FBO), the fast-path condition is met:
// third_party/angle/src/libANGLE/renderer/gl/FramebufferGL.cpp
if (colorAttachments != getState().getEnabledDrawBuffers()) { ... }
This routes the call directly to BlitGL::clearFramebuffer, which performs a per-aspect native clear. Consequently, only GL_DEPTH_BUFFER_BIT is cleared in the native GL driver, leaving the stencil aspect containing uninitialized native GL VRAM:
// third_party/angle/src/libANGLE/renderer/gl/BlitGL.cpp
if (clearMask != 0)
{
ANGLE_GL_TRY(context, mFunctions->clear(clearMask)); // GL_DEPTH_BUFFER_BIT only
}
Immediately following this clear, the frontend calls markAttachmentsInitialized(..., true, false), which marks the depth attachment as initialized:
// third_party/angle/src/libANGLE/Framebuffer.cpp
mState.mDepthAttachment.setInitState(InitState::Initialized);
Because the depth and stencil attachments point to the same packed Renderbuffer, this sets the shared Renderbuffer::mState.mInitState to InitState::Initialized.
When the subsequent safety-net sync (syncStateForClear) attempts to initialize the still-dirty stencil aspect, it calls ensureDrawAttachmentsInitialized, which invokes BlitGL::clearFramebuffer with depth = false and stencil = true.
Inside BlitGL::clearFramebuffer, CheckIfAttachmentNeedsClearing is called on the stencil attachment:
// third_party/angle/src/libANGLE/renderer/gl/BlitGL.cpp
if (attachment->initState() == gl::InitState::Initialized)
{
*needsClearInit = false;
return angle::Result::Continue;
}
Because the shared mInitState was already poisoned to Initialized during the depth clear, this check returns false. The stencil aspect is never cleared natively, but the frontend resets its tracking bit anyway.
As a result, the stencil aspect of the packed depth-stencil resource is left uninitialized, while ANGLE's tracking state incorrectly reports that the resource is fully initialized.
Potential Reproduction Steps
Note: These are potential steps. Our tooling does not currently have the capability to execute code or run a live proof of concept.
-
Create a packed depth-stencil Renderbuffer:
JavaScript const rb = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, rb); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH24_STENCIL8, 512, 512); -
Attach it to a fresh FBO with no color attachments:
JavaScript const fb = gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER, fb); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, rb); -
Perform a partial clear of only the depth component:
JavaScript gl.clearBufferfv(gl.DEPTH, 0, new Float32Array([1.0]));At this point, the native depth aspect is cleared, but the native stencil aspect remains uninitialized VRAM, and ANGLE's tracking incorrectly marks both aspects as initialized.
-
Bind
rbto a second FBO with an active color attachment. -
Perform stencil-tested draws for each reference value
0..255to write corresponding mapped colors to the color buffer. -
Use
gl.readPixels()to extract the uninitialized native stencil values, which may leak cross-origin GPU memory (such as texture data or pixels belonging to other browser tabs).
Suggested Fix
To address this issue, FramebufferGL::ensureAttachmentsInitialized should fall back to the safe base implementation (or BlitGL::clearFramebuffer must promote the clear mask to clear both aspects) if a partial clear of a packed depth-stencil resource is requested. Alternatively, ANGLE could track the initialization state of packed depth-stencil resources per-aspect, rather than sharing a single InitState on the underlying Renderbuffer object.
Evaluated with Chrome root at commit: b5b015ea5f690560237d1f0cff1405844cd12b8d
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 front-end tracks depth and stencil initialisation separately but the underlying renderbuffer shares one init state, so a depth-only clear marks the packed resource initialised and the later stencil clear is skipped.
Impact
Uninitialised GPU memory could be disclosed to web content, potentially leaking cross-origin data such as texture data or pixels from other browser tabs; the report notes the steps are potential and were not executed.
What the attacker needed
Robust resource init enabled; attacker-controlled WebGL content
The fix
FramebufferGL should fall back to the safe base implementation or promote the clear to both aspects, or ANGLE should track initialisation per aspect.
How it was found
- Create a packed depth-stencil renderbuffer and attach it to a framebuffer with no colour attachments.
- Clear only the depth component, leaving the stencil aspect uncleared.
- Bind the renderbuffer to a second framebuffer that has an active colour attachment.
- Run stencil-tested draws across reference values to map stencil contents into colours.
- Read the colour buffer back to recover the uninitialised stencil values.
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.
Graphics code often reuses memory buffers, and a browser is supposed to wipe them before handing them to a web page so old data cannot leak. Here the wiping step only cleaned half of a combined depth-and-stencil buffer but recorded the whole thing as clean. A web page could then read the leftover contents of graphics memory, which might include pixels from other sites.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.