Use after free in Skia (CVE-2026-13885)
A shared reader lock was used around a cache lookup that also reorders an internal linked list, so concurrent font lookups from multiple threads could corrupt list pointers. An attacker could then trigger cache eviction to cause a use-after-free and potentially achieve code execution in the renderer sandbox.
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: A data race in the Android NDK font manager's TypefaceCache leads to internal linked list corruption and a Use-After-Free. The cache incorrectly uses a shared reader lock for an operation that mutates an LRU list. Concurrent font requests from Web Workers can corrupt the list pointers, enabling arbitrary memory corruption.
Affected files:
third_party/skia/src/ports/SkFontMgr_android_ndk.cppthird_party/skia/src/core/SkLRUCache.hthird_party/skia/src/base/SkTInternalLList.hthird_party/skia/src/base/SkSharedMutex.cpp
Estimated timestamp from git blame: 2025-08-22
Summary
A race condition exists in the TypefaceCache used by SkFontMgr_AndroidNDK (third_party/skia/src/ports/SkFontMgr_android_ndk.cpp). The find() methods in TypefaceCache acquire a shared (reader) lock (SkAutoSharedMutexShared) before calling SkLRUCache::find(). However, SkLRUCache::find() is a mutating operation: upon a cache hit, it moves the accessed entry to the head of its internal doubly linked list (SkTInternalLList) to maintain LRU ordering.
Because multiple threads can acquire the shared lock simultaneously, concurrent font lookups result in unsynchronized modifications to the fPrev and fNext pointers of the list's nodes. This breaks the linked list invariants. When the cache subsequently exceeds its capacity and evicts old entries, the unlinking logic relies on these corrupted pointers, leading to a Write-After-Free or Use-After-Free.
Because Skia uses raw C++ pointers for its internal lists (Entry* instead of base::raw_ptr), this vulnerability is not mitigated by MiraclePtr (BackupRefPtr) and presents a primitive for Remote Code Execution (RCE) in the renderer sandbox.
Prerequisites
- Target running Android 16 (API level 36) or higher.
- The
kUseAndroidNDKFontAPIfeature flag must be enabled.
Potential Steps to Trigger
(Note: These are suggested steps to reproduce the issue. Our AI tooling does not currently have the ability to run code to verify a working Proof-of-Concept.)
- Prime the Cache: Using JavaScript, request a few distinct font styles (e.g., variable fonts with different weights) on an
OffscreenCanvasto populate theTypefaceCache. - Setup Concurrency: Spawn a Web Worker that also has access to an
OffscreenCanvas. Blink'sFontCacheis thread-local, meaning font lookups on the worker do not acquire cross-thread Blink locks before calling down to Skia's singleton font manager. - Trigger the Race Condition: Coordinate the main thread and the Web Worker to render text using the previously cached fonts at the exact same time. Both threads enter
SkLRUCache::find(), read the same nodes, and concurrently executefLRU.remove(entry)andfLRU.addToHead(entry). This silently corrupts the list'sfPrevandfNextpointers. - Force Cache Eviction: Flood the
TypefaceCachewith more than 64 new, unique font style requests. This exceeds the LRU cache capacity and triggers a background eviction loop. - Exploit Write-After-Free: During eviction,
SkLRUCache::remove()attempts to unlink nodes using the corrupted pointers. This causes the program to dereference dangling pointers and write heap pointers into previously freed memory, which an attacker can reclaim and control via heap spraying.
Suggested Fix
In third_party/skia/src/ports/SkFontMgr_android_ndk.cpp, change the locking mechanism in both TypefaceCache::find(const Request& request) and TypefaceCache::find(const Match& match) from a shared lock to an exclusive lock, as the underlying cache lookup mutates the state:
// Change this:
// SkAutoSharedMutexShared lock(fMutex);
// To this:
SkAutoSharedMutexExclusive lock(fMutex);
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 used a shared (reader) lock for a cache lookup that mutates the LRU list, allowing concurrent unsynchronised modifications to the list pointers.
Impact
An attacker could corrupt memory and potentially achieve remote code execution in the renderer sandbox, though the report notes the steps are suggested and not verified with a working proof-of-concept.
What the attacker needed
Android 16 (API level 36) or higher; kUseAndroidNDKFontAPI feature flag enabled
The fix
The locking in both TypefaceCache::find methods should be changed from a shared lock to an exclusive lock, because the lookup mutates the cache state.
How it was found
- Request several distinct font styles on an OffscreenCanvas to populate the TypefaceCache.
- Spawn a Web Worker with access to an OffscreenCanvas so font lookups bypass cross-thread Blink locks.
- Coordinate the main thread and worker to render text with the cached fonts at the same time, causing concurrent list mutations.
- Flood the cache with more than 64 new unique font style requests to trigger eviction.
- During eviction, corrupted pointers are used to unlink nodes, leading to a write-after-free that can be exploited via heap spraying.
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 cache is a fast storage area that keeps frequently used items. This cache used a lock that lets several threads read at the same time, but the read operation also quietly changed the order of items in a list. When two threads did this at once, the list got tangled, and later cleanup could touch memory that was already freed, which is dangerous.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.