Integer overflow in Skia (CVE-2026-14387)
Skia Graphite uses a 32-bit atomic counter for resource IDs, and if it wraps around, a new texture can reuse the ID of a destroyed texture, causing a stale bind group to be retrieved from cache. Because Chromium disables Dawn validation in release builds, this could lead to a use-after-free at the GPU driver level, potentially allowing cross-origin GPU memory reads.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 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 security team.
Overview: Skia Graphite uses a 32-bit atomic counter to assign IDs to resources, which serve as keys for Dawn bind group caches. An attacker can force this counter to wrap around, causing a cache collision that retrieves a stale bind group pointing to a destroyed texture view. Because Chromium disables Dawn validation in release builds, this causes a potential Use-After-Free at the GPU driver level.
Affected files:
third_party/skia/src/gpu/graphite/Resource.cppthird_party/skia/src/gpu/graphite/dawn/DawnResourceProvider.cppthird_party/skia/src/gpu/graphite/dawn/DawnTexture.cppthird_party/skia/src/gpu/graphite/dawn/DawnBuffer.cpp
Estimated timestamp from git blame: 2024-08-05
Vulnerability Details
In Skia Graphite, skgpu::graphite::Resource assigns a uniqueID to each resource upon construction using a global 32-bit atomic counter (std::atomic<uint32_t> nextID). The Dawn backend relies on these IDs to cache wgpu::BindGroup objects. For example, DawnResourceProvider::findOrCreateSingleTextureSamplerBindGroup derives its cache key directly from the uniqueID of the provided sampler and texture.
When a DawnTexture is destroyed, its underlying wgpu::Texture and associated views (e.g., VkImageView in the Vulkan backend) are explicitly destroyed. However, the wgpu::BindGroup referencing those destroyed views remains alive in Skia's fSingleTextureSamplerBindGroups cache. This cache is typically only cleared during OS memory pressure or when the GPU has been entirely idle for >1 second.
If the 32-bit uniqueID counter wraps around, a newly allocated texture can receive an ID identical to a previously destroyed texture. If sampled with the same sampler, Skia's cache lookup will succeed, and the stale wgpu::BindGroup will be retrieved and bound to the command buffer.
Crucially, Chromium's integration of Skia Graphite defaults to skipping Dawn's frontend validation in Release builds (kSkiaGraphiteDawnSkipValidation is true). Consequently, Dawn's QueueBase::SubmitInternal bypasses the checks that would normally detect a destroyed resource. The command buffer is passed directly to the backend (e.g., Vulkan), where the driver will dereference the freed VkImageView handle, resulting in a Use-After-Free.
Potential Steps to Trigger
Note: These are suggested steps to theoretically trigger the vulnerability; a fully working proof-of-concept has not yet been executed by our tooling.
- Initialize & Cache: Using JavaScript (
Canvas2DorWebGL), an attacker allocates a texture and a sampler, then performs a draw call to force Skia to generate and cache awgpu::BindGroup. - Destroy Texture: The attacker drops all references to the texture in JavaScript. Once Skia's pending commands complete, the underlying Dawn texture and Vulkan handles are destroyed, but the bind group remains in Skia's cache.
- Spin the Counter: The attacker executes a tight JavaScript loop to rapidly allocate ~4.29 billion resources, forcing the 32-bit counter to wrap around.
- To do this without causing an Out-Of-Memory (OOM) crash, the attacker can repeatedly call
putImageData()with varying sizes slightly above 64KB. This routes toUploadBufferManager, which allocates non-shareableDawnBufferresources. - Varying the sizes ensures cache misses (creating new
uniqueIDs), while Skia's internalResourceCacheautomatically purges older buffers to stay under budget. - Occasional small draw calls are interleaved to prevent the GPU from entering the 1-second idle state, avoiding a cache reset.
- To do this without causing an Out-Of-Memory (OOM) crash, the attacker can repeatedly call
- Trigger Collision: Once the counter wraps to the original texture's ID, the attacker allocates a new target texture. It receives the colliding
uniqueID. - Execute UAF: The attacker issues a draw call using the original sampler and the new texture. Skia fetches the stale
wgpu::BindGroupand submits it. Due to validation being disabled, the GPU driver executes the command using the freed handle, potentially allowing the attacker to read cross-origin GPU memory if they successfully reallocated the freed view descriptor over sensitive data.
Suggested Fix
- Widen the Counter: The most robust fix is to upgrade
skgpu::graphite::Resource::nextIDand theUniqueIDclass to use a 64-bit integer (uint64_t). This makes wraparound practically impossible during the lifetime of an application. - Explicit Invalidation: Alternatively,
DawnResourceProvidershould be notified when aDawnTextureorDawnBufferis destroyed so it can proactively remove any dependentwgpu::BindGroups fromfSingleTextureSamplerBindGroupsandfUniformBufferBindGroupCache.
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
Likely the use of a 32-bit atomic counter for resource IDs that can wrap around, combined with a cache that retains bind groups referencing destroyed resources and disabled validation in release builds.
Impact
This could allow the attacker to read cross-origin GPU memory if they successfully reallocate the freed view descriptor over sensitive data, but the report notes that a fully working proof-of-concept has not yet been executed.
What the attacker needed
Victim visits a malicious page; JavaScript enabled; Chromium release build
The fix
The counter should be widened to 64 bits, or the resource provider should be notified on destruction to remove dependent bind groups from caches.
How it was found
- Allocate a texture and sampler via JavaScript, then draw to force Skia to cache a bind group.
- Drop all references to the texture so the underlying Dawn texture and Vulkan handles are destroyed, but the bind group remains cached.
- Execute a tight JavaScript loop to rapidly allocate about 4.29 billion resources, forcing the 32-bit counter to wrap around, while avoiding OOM and cache resets.
- Allocate a new texture that receives the colliding uniqueID.
- Issue a draw call using the original sampler and the new texture, causing Skia to fetch the stale bind group and submit it, leading to a use-after-free.
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.
A counter that gives each graphics resource a unique number can run out of numbers and start again from zero. If that happens, a new resource might get the same number as an old, deleted one, and the system could mistakenly reuse old references to the deleted resource. This can cause the graphics driver to access memory that has already been freed, which is dangerous.
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.