Use after free in FileSystem (CVE-2026-13027)
A data race exists on a shared map of file-change observers in the browser process, because the UI thread writes to it while the IO thread reads it without synchronisation. An attacker-controlled renderer could trigger this race, potentially corrupting the map and crashing the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 19 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: A potential data race in the browser process occurs on SandboxFileSystemBackendDelegate::change_observers_ due to unsynchronized access between the UI and IO threads. Specifically, FileSystemAccessBucketPathWatcher::Initialize() modifies the map on the UI thread, while concurrent file operations on the IO thread read it. This race condition can result in undefined behavior, map corruption, or potential browser process crashes.
Affected files:
storage/browser/file_system/sandbox_file_system_backend_delegate.ccstorage/browser/file_system/sandbox_file_system_backend_delegate.hcontent/browser/file_system_access/file_system_access_bucket_path_watcher.cc
Estimated timestamp from git blame: 2023-09-29
Description
A potential data race exists in the Browser process on the std::map<FileSystemType, ChangeObserverList> change_observers_ member of storage::SandboxFileSystemBackendDelegate (storage/browser/file_system/sandbox_file_system_backend_delegate.h, line 293).
When a renderer has opened the Origin Private File System (OPFS), concurrent file operations read the map on the IO thread. At the same time, starting a new observation via the FileSystemObserver API mutates the same map on the UI thread without synchronization.
In production (Release) builds, DCHECK macros are disabled, allowing the unsynchronized concurrent read/write to execute, resulting in undefined behavior on the underlying std::map (such as Red-Black Tree node pointer corruption or a torn ChangeObserverList copy).
Affected Locations
storage/browser/file_system/sandbox_file_system_backend_delegate.cc:437-446(AddFileChangeObserver- Writer on UI Thread)storage/browser/file_system/sandbox_file_system_backend_delegate.cc:467-473(GetChangeObservers- Reader on IO Thread)content/browser/file_system_access/file_system_access_bucket_path_watcher.cc:54-73(Initialize- Triggering Call on UI Thread)
Potential Step-by-Step Sequence to Reproduce
Note: These are potential steps. Our security review tools currently lack the capability to run or compile functional proof-of-concept exploits.
-
From an attacker-controlled renderer, obtain a handle to the Origin Private File System:
JavaScript const opfsRoot = await navigator.storage.getDirectory(); -
Start a continuous stream of file operations (such as repeatedly creating and deleting files) from the renderer to ensure constant file IO activity on the Browser's IO thread. This keeps the browser executing
SandboxFileSystemBackendDelegate::CreateFileSystemOperationContext(), which callsGetChangeObservers()and reads thechange_observers_map. -
Concurrently, register a file system observer from the renderer:
JavaScript const observer = new FileSystemObserver(() => {}); await observer.observe(opfsRoot); -
This invokes
FileSystemAccessBucketPathWatcher::Initialize()in the Browser process on the UI thread, which triggersAddFileChangeObserver()and mutates thechange_observers_map. -
The unsynchronized read on the IO thread and write on the UI thread race, causing
std::maptree corruption and leading to a Browser process crash (Denial of Service) or potential use-after-free/wild virtual call scenario.
Suggested Fix
To resolve this issue, all modifications to the observer lists in SandboxFileSystemBackendDelegate must be synchronized or sequence-bound. Since filesystem operations and context creation occur on the IO thread, registration should be dispatched to the IO thread.
In content/browser/file_system_access/file_system_access_bucket_path_watcher.cc, modify Initialize to post the registration task to the IO thread task runner instead of invoking it directly on the UI sequence:
// Suggested fix sketch in FileSystemAccessBucketPathWatcher::Initialize:
content::GetIOThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&storage::SandboxFileSystemBackendDelegate::AddFileChangeObserver,
base::Unretained(sandbox_delegate),
storage::FileSystemType::kFileSystemTypeTemporary,
base::RetainedRef(this),
base::RetainedRef(base::SequencedTaskRunner::GetCurrentDefault())));
Evaluated with Chrome root at commit: e9507a33bb4148ee071aaaf8a7e9ad68770359bf
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
The change_observers_ map is mutated on the UI thread and read on the IO thread without any synchronisation or sequence binding.
Impact
The race could corrupt the map and crash the browser process (denial of service), or potentially lead to a use-after-free or wild virtual call.
What the attacker needed
Attacker-controlled renderer; renderer can open the Origin Private File System; renderer can use the FileSystemObserver API
The fix
The registration should be posted to the IO thread task runner instead of being invoked directly on the UI sequence, so all access to the observer lists is sequence-bound.
How it was found
- From an attacker-controlled renderer, obtain a handle to the Origin Private File System.
- Start a continuous stream of file operations to keep the browser's IO thread reading the observer map.
- Concurrently register a file system observer from the renderer.
- This invokes Initialize on the UI thread, which adds an observer and mutates the map.
- The unsynchronised read and write race, corrupting the map and crashing the browser process.
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 browser has several threads that run at the same time. Two of them were using the same list of file watchers without taking turns, so one could change the list while the other was reading it. That can corrupt the list and crash the browser.
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.