Uninitialized Use in Skia (CVE-2026-19160)
Skia's SurfaceContext::internalWritePixels() ignores the return value of flushSurface(), so a failed flush silently drops a queued pixel-upload task while still reporting success. A compromised renderer could then sample stale, un-cleared GPU scratch texture memory containing prior cross-origin data into an attacker-readable SharedImage.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 21 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: An unchecked return value of flushSurface() in Skia's SurfaceContext can potentially allow a compromised renderer to leak stale GPU texture memory. If a forced flush fails during a staging pixel upload, the upload task is silently dropped while the function still reports success. This results in subsequent draw operations sampling stale, un-overwritten pixels from a recycled scratch texture into an attacker-readable SharedImage.
Affected files:
third_party/skia/src/gpu/ganesh/SurfaceContext.cpp
Estimated timestamp from git blame: 2021-02-11
Summary
There is a potential information disclosure vulnerability in Skia's Ganesh rendering backend. Specifically, SurfaceContext::internalWritePixels() does not check the return value of flushSurface(). Under conditions where a flush fails (such as GPU memory exhaustion or drawing manager task errors), a queued pixel-upload task can be silently discarded while the function still reports success. This can allow a compromised renderer to read back uninitialized or stale GPU scratch textures containing prior cross-origin data.
Root Cause Analysis
In third_party/skia/src/gpu/ganesh/SurfaceContext.cpp, the canvas2DFastPath branch handles unpremultiplied source pixels by staging them into a temporary proxy (tempProxy) and then drawing that proxy into the destination with a premultiplication shader.
The inner staging upload is performed via a recursive writePixels() call, which reaches the following logic:
// third_party/skia/src/gpu/ganesh/SurfaceContext.cpp:600-605
if (!ownAllStorage) {
// If any pixmap doesn't own its pixels then we must flush so that the pixels are pushed to
// the GPU before we return.
dContext->priv().flushSurface(dstProxy); // <--- Return value is discarded
}
return true; // <--- Unconditional success returned
If the drawing manager's flush fails (for example, due to resource allocator failures or on-flush callback errors), GrDrawingManager::flush() silently clears the DAG via removeRenderTasks() and returns false. However, because the return value at line 603 is discarded, the staging context reports that the upload succeeded.
This behavior contrasts with the hardened read-path counterpart in the same file, which correctly validates the flush outcome:
// third_party/skia/src/gpu/ganesh/SurfaceContext.cpp:295-300
bool hasPendingTasks =
dContext->priv().drawingManager()->getLastRenderTask(srcProxy.get()) != nullptr;
GrSemaphoresSubmitted flushResult = dContext->priv().flushSurface(srcProxy.get());
if (flushResult == GrSemaphoresSubmitted::kNo && hasPendingTasks) {
return false;
}
Potential Attack Scenario
An attacker controlling a compromised renderer might attempt to exploit this logic through the following potential steps:
- Context Sharing: Establish two independent raster interfaces sharing a single
GrDirectContexton the GPU thread. - Target Setup: Create a destination renderable SharedImage with premultiplied alpha.
- Priming a Failure: On the secondary interface, queue tasks into the shared drawing manager DAG that are guaranteed to fail during a flush. Examples include:
- Registering a Skia Promise Image with a corrupted lazy fulfillment callback designed to return
nullptr. - Queueing extremely large offscreen layers that force a failure in the resource allocator (
failedInstantiation) under simulated GPU memory pressure.
- Registering a Skia Promise Image with a corrupted lazy fulfillment callback designed to return
- Triggering the Fast Path: Issue a
WritePixelscommand on the primary interface using an unpremultiplied source alpha type. This mismatch bypasses direct texture upload and triggers thecanvas2DFastPathstaging logic. - Scratch Recycling: Skia allocates
tempProxywith an approximate fit (SkBackingFit::kApprox). This retrieves a recycled scratch texture fromGrResourceCachethat has not been cleared and still contains prior cross-origin data. - Silent Task Discard: The recursive staging upload queues a
GrWritePixelsTaskand forces a flush because the source pixmap does not own its storage. The flush fails due to the failing tasks primed in Step 3. The entire DAG (including the staging upload task) is silently cleared duringremoveRenderTasks(), but the failure is ignored. - Sampling Stale Pixels: The outer fast path completes by executing a draw from
tempProxy(which still holds the un-cleared, stale GPU memory) into the destination SharedImage. - Data Disclosure: The attacker marks the SharedImage cleared and reads it back via
ReadbackARGBImagePixelsINTERNAL, obtaining the leaked cross-origin pixels.
Note: These steps represent a potential attack flow based on static analysis of the codebase. Our tooling does not currently have the capability to run or verify functional exploit code.
Suggested Fix
Modify SurfaceContext::internalWritePixels() to check the return value of flushSurface(). If the flush fails and there are pending write tasks, the function should abort and return false, matching the defensive design of the sibling readPixels() implementation:
if (!ownAllStorage) {
bool hasPendingTasks =
dContext->priv().drawingManager()->getLastRenderTask(dstProxy) != nullptr;
GrSemaphoresSubmitted flushResult = dContext->priv().flushSurface(dstProxy);
if (flushResult == GrSemaphoresSubmitted::kNo && hasPendingTasks) {
return false;
}
}
Evaluated with Chrome root at commit: bf775e5d75cb9e1767e2cd02cc93efa0077d14a5
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 return value of flushSurface() is discarded in the staging upload path, so a failed flush that clears the queued upload task is not detected and success is reported unconditionally.
Impact
A compromised renderer could potentially leak stale GPU texture memory containing prior cross-origin data; the report notes the attack flow is based on static analysis and was not verified with working exploit code.
What the attacker needed
Compromised renderer; shared GrDirectContext across interfaces; ability to force a flush failure
The fix
The function should check the return value of flushSurface() and return false when the flush fails and pending write tasks exist, matching the readPixels() implementation.
How it was found
- Set up two raster interfaces sharing one GrDirectContext on the GPU thread.
- Create a destination renderable SharedImage with premultiplied alpha.
- On the secondary interface, queue tasks that will fail during a flush.
- Issue a WritePixels on the primary interface with an unpremultiplied source alpha type to trigger the fast path.
- The staging upload's forced flush fails, the task is silently discarded, and the draw samples stale scratch texture memory.
- Mark the SharedImage cleared and read it back to obtain the leaked pixels.
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 copies image data to the graphics card, it sometimes has to wait for the graphics card to finish earlier work first. If that wait fails, the code here still says 'all good' and carries on, so the copy never happens and the program reads whatever old data was left in that bit of graphics memory. That leftover data could belong to another website, which is why it matters.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.