Use after free in Skia (CVE-2026-9923)
A use-after-free race condition exists in Skia's GlobalCache::findGraphicsPipeline where a raw pointer to a cache entry is dereferenced after the protecting spinlock is released. An attacker could potentially exploit this to achieve an arbitrary 64-bit atomic increment, leading to remote code execution in the unsandboxed GPU process.
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: A race condition exists in GlobalCache::findGraphicsPipeline where a stack-local raw pointer to a cache entry is dereferenced after its protecting spinlock is released. This can result in a Use-After-Free if another thread evicts the entry from the LRU cache during the window between lock release and dereference. An attacker could potentially use this to execute an arbitrary 64-bit atomic increment, leading to RCE in the unsandboxed GPU process.
Affected files:
third_party/skia/src/gpu/graphite/GlobalCache.cpp
Estimated timestamp from git blame: 2025-10-29
Description
A potential Use-After-Free (UAF) vulnerability exists in the Graphite backend of Skia, specifically within GlobalCache::findGraphicsPipeline. The function retrieves a raw pointer to an entry in fGraphicsPipelineCache (an SkLRUCache) while holding fSpinLock. However, it releases the lock before dereferencing this pointer.
In third_party/skia/src/gpu/graphite/GlobalCache.cpp:
188: sk_sp<GraphicsPipeline>* entry = nullptr;
189: {
190: SkAutoSpinlock lock{fSpinLock};
191:
192: entry = fGraphicsPipelineCache.find(key);
... // Bookkeeping performed under lock
242: }
243: } // fSpinLock is released here
244:
245: if (entry) {
246: this->invokePipelineCallback(ContextOptions::PipelineCacheOp::kPipelineFound, entry->get());
247: return *entry;
248: }
SkLRUCache::find() returns a raw pointer to the fValue field within a heap-allocated Entry node. Because fSpinLock is released at line 243, a concurrent thread can acquire the lock and perform operations that evict or remove the entry from the cache. For example, a concurrent call to addGraphicsPipeline calls fGraphicsPipelineCache.insert(), which evicts the LRU tail if the cache size limit (default 256) is exceeded. Eviction results in the heap memory backing the Entry being deleted, leaving entry as a dangling pointer.
Impact & Exploitability
In Chromium's GPU process, GlobalCache is shared across multiple threads (e.g., Viz compositor thread and GPU main thread). This provides a mechanism for concurrent access where one thread can trigger an eviction while another is returning a pipeline from the cache.
This issue is not protected by MiraclePtr/BRP because entry is a stack-local raw pointer within Skia code, which is currently excluded from the MiraclePtr rewriter. Furthermore, because there are no raw_ptr references to the cache entry memory, PartitionAlloc does not quarantine the memory upon deletion, making it immediately available for reallocation.
When a race occurs, the dereference at line 247 (return *entry;) accesses freed memory. This invokes the copy constructor for sk_sp<GraphicsPipeline>.
The following steps suggest how an attacker could potentially exploit this:
- The attacker creates 256 unique graphics pipelines to fill the LRU cache to its limit.
- The attacker triggers
findGraphicsPipelineon Thread 1 for an existing pipeline (Pipeline A), pausing execution immediately after thefSpinLockis released. - Concurrently on Thread 2, the attacker triggers the creation of 256 new unique pipelines via
addGraphicsPipeline. This evicts Pipeline A from the cache and deletes itsEntrynode. - The attacker sprays the GPU process heap to reclaim the freed
Entrychunk, placing a fake 64-bit pointer (P) at the exact memory offset corresponding to the formerfValuefield. - Thread 1 resumes and executes
return *entry;. - The
sk_spcopy constructor reads the attacker-controlled pointerPand callsSkSafeRef(P). SkSafeRefexecutesP->ref(). Crucially,ref()inskgpu::graphite::Resource(the base class ofGraphicsPipeline) is a non-virtual inline method. This means the compiler emits a direct static function call, completely bypassing the need for the fake object to have a valid vtable.Resource::ref()executes an atomic 64-bit addition:fRefs.fetch_add((uint64_t)1 << 2, std::memory_order_relaxed);at offset +8 fromP.
The attacker has achieved a pristine, highly reliable arbitrary 64-bit atomic increment primitive. By setting P+8 to the address of an array bound, string length, or index within a critical GPU process object, the attacker can surgically inflate the bound by 4. This provides out-of-bounds read and write capabilities, allowing them to bypass ASLR and hijack control flow. Because the Chromium GPU process is unsandboxed and has elevated privileges, achieving RCE within it constitutes a full sandbox escape (Severity 0).
Recommendation
The implementation should copy the sk_sp<GraphicsPipeline> value into a local variable while the lock is still held, and then use that local variable outside the lock scope. This is already the pattern used correctly in GlobalCache::findComputePipeline in the same file.
sk_sp<GraphicsPipeline> pipeline;
{
SkAutoSpinlock lock{fSpinLock};
if (auto* entry = fGraphicsPipelineCache.find(key)) {
// ... bookkeeping ...
pipeline = *entry;
} else {
// ... cache miss logic ...
}
}
if (pipeline) {
this->invokePipelineCallback(ContextOptions::PipelineCacheOp::kPipelineFound, pipeline.get());
return pipeline;
}
return nullptr;
Evaluated with Chrome root at commit: 137d451a126685dd5010e6609db9f6d4a78d8234
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 code releases the spinlock before dereferencing a raw pointer returned by the cache, allowing another thread to evict and free the entry, resulting in a dangling pointer.
Impact
An attacker could potentially achieve an arbitrary 64-bit atomic increment, leading to out-of-bounds read/write and remote code execution in the unsandboxed GPU process, constituting a full sandbox escape.
What the attacker needed
Ability to create graphics pipelines; concurrent access to GPU process threads; heap spray capability
The fix
The implementation should copy the sk_sp<GraphicsPipeline> value into a local variable while the lock is still held, and then use that local variable outside the lock scope.
How it was found
- Fill the LRU cache to its limit with 256 unique graphics pipelines.
- Trigger findGraphicsPipeline on Thread 1 for an existing pipeline and pause after the spinlock is released.
- On Thread 2, create 256 new unique pipelines to evict the target pipeline and free its entry.
- Spray the GPU process heap to reclaim the freed entry with a fake pointer at the fValue offset.
- Resume Thread 1 so it dereferences the dangling pointer, causing an atomic increment on attacker-controlled memory.
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 use-after-free happens when a program keeps a pointer to memory after that memory has been freed and possibly reused. Here, a cache lookup returns a pointer to an entry, but the lock protecting the cache is released before the pointer is used, so another thread can delete the entry in the meantime. If an attacker can control what gets placed in that freed memory, they might trick the program into treating attacker data as a real object, potentially leading to code execution.
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.