Use after free in Base (CVE-2026-11071)
A data race in the Linux MIME type cache allows a use-after-free when one thread clears the map while another holds an iterator. An attacker with renderer code execution could potentially leak browser process memory and bypass ASLR.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 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 base::nix::GetFileMimeType on Linux can lead to a Use-After-Free (UAF) read of a std::map node. Concurrent Mojo requests from compromised renderers can trigger a map reload while an iterator is actively being accessed outside the lock. An attacker could potentially exploit this to leak arbitrary browser process memory and bypass ASLR.
Affected files:
base/nix/mime_util_xdg.cccontent/browser/mime_registry_impl.ccnet/base/platform_mime_util_linux.cc
Estimated timestamp from git blame: 2023-11-02
Summary
There is a potential data race and Use-After-Free (UAF) vulnerability in the Linux implementation of base::nix::GetFileMimeType. The function caches MIME types in a static std::map, protected by a lock during periodic reloads. However, the lock is released immediately before searching the map and dereferencing the returned iterator. If one thread accesses the iterator while another thread concurrently clears the map, a UAF occurs.
Vulnerability Details
In base/nix/mime_util_xdg.cc, the GetFileMimeType function uses an AutoLock to check if ~/.local/share/mime/ cache files have changed (checked at most every 5 seconds). If they have, it calls mime_type_map->clear() to reload the cache.
{
AutoLock scoped_lock(*lock);
// ... 5-second check and modification time check ...
if (files_changed) {
mime_type_map->clear();
// ... reload ...
}
} // Lock released
auto it = mime_type_map->find(ext.substr(1));
return it != mime_type_map->end() ? it->second.mime_type : std::string();
The lock scope ends before mime_type_map->find() and before the returned iterator it is dereferenced.
Because content::MimeRegistryImpl::Create provisions a new SequencedTaskRunner per RenderProcessHost, Mojo calls to MimeRegistry::GetMimeTypeFromExtension from different renderer processes will execute concurrently in the browser process's ThreadPool.
Potential Exploitation Steps
An attacker with code execution in a sandboxed renderer could potentially exploit this to read arbitrary browser process memory (an ASLR bypass) through the following steps:
- The attacker compromises two separate renderer processes (e.g., via iframes forcing Site Isolation to different origins) to gain concurrent execution threads in the browser process.
- The attacker triggers a modification to the XDG mime cache files. This can be done without user interaction by performing a silent manifest update on a previously installed Progressive Web App (PWA) to add new file handlers, which invokes
xdg-mime install. - The attacker spams synchronous
MimeRegistry::GetMimeTypeFromExtensionMojo messages from both renderers. - Thread A enters
GetFileMimeType, observes the cache is up-to-date, exits the lock, and callsmime_type_map->find(), obtaining a valid iterator. Thread A is then preempted. - Thread B enters
GetFileMimeType, observes the 5-second boundary and file modifications, and callsmime_type_map->clear(). This immediately destructs and frees allstd::_Rb_tree_nodes in the map back to the PartitionAlloc Main Partition. - The attacker rapidly sprays the browser process heap via Mojo string allocations. By sending exactly 88-byte strings, they can reclaim the freed
std::_Rb_tree_node(which houses a 24-bytestd::stringand a 32-byteWeightedMimepayload on 64-bit libc++). - The payload is crafted to forge the internal pointer and size fields of the
std::stringinside theWeightedMimestruct, pointing it to an arbitrary target address in the browser heap. - Thread A resumes and executes
return it->second.mime_type. Thestd::stringcopy constructor is invoked on the forged string. - Note on MiraclePtr: MiraclePtr (BRP) does not prevent this because the internal pointers of libc++ standard library containers (
std::mapnodes andstd::stringbuffers) use rawT*pointers, notbase::raw_ptr<T>. - The copy constructor reads the targeted memory, and the resulting string is returned to the renderer via the Mojo callback, successfully leaking the data.
(Note: These are suggested steps for exploitation; a working proof-of-concept has not been fully verified by our tooling yet.)
Suggested Fix
The lock scope must be extended to cover both the map lookup and the extraction of the value. A local std::string can be used to hold the result before returning:
std::string result;
{
AutoLock scoped_lock(*lock);
Time now = Time::Now();
// ... cache invalidation logic ...
auto it = mime_type_map->find(ext.substr(1));
if (it != mime_type_map->end()) {
result = it->second.mime_type;
}
}
return result;
This ensures the iterator and the underlying node cannot be invalidated by another thread before the string is safely copied.
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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 lock protecting the MIME type map is released before the map lookup and iterator dereference, so another thread can clear the map in between.
Impact
An attacker with code execution in a sandboxed renderer could potentially leak arbitrary browser process memory and bypass ASLR; a working proof-of-concept has not been fully verified.
What the attacker needed
Code execution in two renderer processes; ability to modify XDG mime cache files; no user interaction needed for cache change
The fix
The lock scope should be extended to cover both the map lookup and the extraction of the value into a local string before returning.
How it was found
- Compromise two separate renderer processes to get concurrent execution in the browser process.
- Trigger a modification to the XDG mime cache files, for example via a silent PWA manifest update that invokes xdg-mime install.
- Spam synchronous MimeRegistry::GetMimeTypeFromExtension Mojo messages from both renderers.
- Thread A enters GetFileMimeType, exits the lock, calls find() and obtains a valid iterator, then is preempted.
- Thread B enters GetFileMimeType, sees the cache is stale, and calls clear(), freeing the map nodes.
- The attacker sprays the browser heap with 88-byte Mojo strings to reclaim the freed node, forges the string fields, and Thread A resumes to copy and return the leaked data.
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 freeing it, then reads or writes through that pointer. Here, two threads share a map of file types; one thread can free the map's contents while the other is still reading from it. This could let an attacker read memory they should not see, which helps defeat a common defence called ASLR that randomises memory addresses.
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.