Uninitialized Use in Skia (CVE-2026-17757)
A logic flaw in Skia's Ganesh backend allows an OpsTask to attach and store uninitialized stencil buffer contents if a subsequent task enables stencil usage on a shared proxy. On tile-based Vulkan GPUs, this causes the task to write undefined tile memory residue back into the stencil buffer, which a subsequent task can read, leading to a potential cross-origin GPU memory leak observable via canvas readback.
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 without the Chrome Security team.
Overview: A logic flaw in Skia's Ganesh backend allows an OpsTask to attach and store uninitialized stencil buffer contents if a subsequent task enables stencil usage on a shared proxy. On tile-based Vulkan GPUs, this causes the task to write undefined tile memory residue back into the stencil buffer. A subsequent task can then read this uninitialized data, leading to a potential cross-origin GPU memory leak observable via canvas readback.
Affected files:
third_party/skia/src/gpu/ganesh/ops/OpsTask.cppthird_party/skia/src/gpu/ganesh/SurfaceDrawContext.cppthird_party/skia/src/gpu/ganesh/ops/OpsTask.hgpu/command_buffer/service/shared_context_state.cc
Estimated timestamp from git blame: 2021-05-03
Summary
There is a potential information disclosure vulnerability in Skia's Ganesh rendering backend. The issue stems from a synchronization failure between the GrRenderTargetProxy's stencil flag and the individual OpsTask initialization states. When a stencil-requiring operation is recorded, it retroactively enables the stencil flag for the entire proxy, causing previously recorded tasks to attach the stencil buffer without properly initializing it. On tile-based Vulkan GPUs (primarily Android), this results in uninitialized tile memory residue being written to main memory and subsequently read by the attacker.
Technical Details
By reviewing the Skia source code, the vulnerability unfolds through the following mechanism:
- Task 0 (T0) Creation: A basic draw operation (no stencil required) is recorded into
OpsTaskT0. ItsfInitialStencilContentdefaults toStencilContent::kDontCare. The canvas'sSurfaceDrawContextcurrently hasfNeedsStencil = false. - Task Split: The task is split (e.g., due to an operation requiring a destination read).
SurfaceDrawContext::willReplaceOpsTaskis called. BecausefNeedsStencilis false, it does not flag T0 to preserve the stencil (fMustPreserveStencilremains false). - Task 1 (T1) Creation: A stencil-requiring operation is recorded into the new task T1.
SurfaceDrawContext::setNeedsStencil()setsfNeedsStencil = true, updates T1's state tokUserBitsCleared, and crucially, setsneedsStencil = trueon the sharedGrRenderTargetProxy. - T0 Execution (The Leak): During flush,
OpsTask::onExecuteruns for T0. It seesproxy->needsStencil() == trueand attaches the stencil buffer. Because its state iskDontCare, it sets the load op toGrLoadOp::kDiscard(mapping toVK_ATTACHMENT_LOAD_OP_DONT_CARE). However,caps.discardStencilValuesAfterRenderPass()is hardcoded tofalsein Skia (due to bug b/160958008), andfMustPreserveStencilis false, so the store op becomesGrStoreOp::kStore. On tile-based Vulkan GPUs, this combination writes uninitialized on-chip tile memory (containing residue from prior cross-origin GPU passes) back to the stencil attachment in main memory. - T1 Execution (The Read): T1 executes with
kUserBitsCleared. If the attachment was cleared in a previous flush,stencil->hasPerformedInitialClear()is true. The code falls through toGrLoadOp::kLoad, causing T1 to load the uninitialized data stored by T0. The leaked bits dictate clipping, which can be read out as pixel colors.
Note: Chrome's gpu/command_buffer/service/shared_context_state.cc disables fReduceOpsTaskSplitting, preserving task boundaries and preventing merge-time corrections of this state.
Potential Attacker Steps
Please note: These are suggested steps based on static code analysis. Our tooling agent does not yet have the ability to run code to produce a working Proof of Concept.
- Execute a WebGL or Canvas2D draw that requires a stencil, then force a flush (e.g., via
getImageData()). This creates the stencil attachment and sets its sticky "cleared" bit to true. - Draw a non-stencil primitive (creating T0).
- Execute an operation that forces a task split, such as drawing the canvas onto itself with a complex blend mode (triggering a destination read barrier).
- Draw a stencil-requiring primitive (creating T1).
- Force a flush by calling
getImageData()and read the pixel values. The drawn pixels will reveal the leaked stencil residue bits from the uninitialized GPU tile memory.
Suggested Fix
There are two primary ways to address this state mismatch:
- Fix in OpsTask Execution: In
OpsTask::onExecute(), iffInitialStencilContentiskDontCare, the rendering pass should explicitly avoid storing the stencil buffer unless it was the task that actively requested it. ForcingstencilStoreOp = GrStoreOp::kDiscardforkDontCaretasks would prevent the uninitialized tile memory from being written back to the attachment. - Fix in Proxy State Propagation: Alternatively, when
SurfaceDrawContext::setNeedsStencil()is called, it could iterate through all existing closed tasks that share the currentGrRenderTargetProxyand update theirfMustPreserveStencilorfInitialStencilContentstates, rather than just updating the activeOpsTask.
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
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
Likely a synchronization failure between the shared render target proxy's stencil flag and individual OpsTask initialization states, causing a task that did not request stencil to store uninitialized stencil contents.
Impact
On tile-based Vulkan GPUs (primarily Android), this could lead to a cross-origin GPU memory leak observable via canvas readback, though the report is based on static analysis and no working exploit was demonstrated.
What the attacker needed
Tile-based Vulkan GPU (primarily Android); ability to run WebGL or Canvas2D; no working exploit demonstrated
The fix
The report suggests either forcing stencilStoreOp to discard for tasks with kDontCare initial stencil content, or updating all existing closed tasks when setNeedsStencil is called; it does not state that a fix was applied.
How it was found
- Execute a WebGL or Canvas2D draw that requires a stencil, then force a flush (e.g., via getImageData()) to create the stencil attachment and set its sticky 'cleared' bit to true.
- Draw a non-stencil primitive (creating T0).
- Execute an operation that forces a task split, such as drawing the canvas onto itself with a complex blend mode (triggering a destination read barrier).
- Draw a stencil-requiring primitive (creating T1).
- Force a flush by calling getImageData() and read the pixel values to reveal the leaked stencil residue bits.
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.
This report describes a bug in Skia, the graphics library used by Chrome, that could let a malicious website read leftover data from other websites through the GPU. The bug happens because a drawing task can accidentally save uninitialized memory from the GPU's stencil buffer, which is used for clipping, and then another task can read that memory and turn it into visible pixels. The report is based on code review, not a working exploit.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.