Use after free in ServiceWorker (CVE-2026-11656)
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 25 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 re-entrancy vulnerability in ServiceWorkerContextCore::RemoveLiveVersion allows observers to re-acquire a reference to a ServiceWorkerVersion object currently undergoing destruction. This can lead to a double-free and use-after-free (UAF) in the browser process, potentially resulting in memory corruption.
Affected files:
content/browser/service_worker/service_worker_context_core.cccontent/browser/service_worker/service_worker_version.cccontent/browser/service_worker/service_worker_context_wrapper.ccextensions/browser/service_worker/service_worker_state.ccextensions/browser/service_worker/service_worker_task_queue.ccextensions/browser/process_manager.ccextensions/browser/event_router.ccextensions/browser/events/event_ack_data.cc
Estimated timestamp from git blame: 2025-09-25
Description
A potential memory safety vulnerability exists in the Chromium browser process due to the way ServiceWorkerVersion objects are removed from ServiceWorkerContextCore during their destruction. The issue stems from notifying synchronous observers while the object is still present in the context's internal tracking map.
Root Cause Analysis
When a ServiceWorkerVersion's reference count reaches zero, its destructor ~ServiceWorkerVersion() is invoked. This destructor calls ServiceWorkerContextCore::RemoveLiveVersion(version_id_) to remove the version from the live_versions_ map.
Inside RemoveLiveVersion(), if the worker is not in the kStopped state, the code notifies synchronous observers via OnStoppedSync. Crucially, the version is not yet removed from the live_versions_ map during this notification.
// content/browser/service_worker/service_worker_context_core.cc
void ServiceWorkerContextCore::RemoveLiveVersion(int64_t id) {
auto it = live_versions_.find(id);
CHECK(it != live_versions_.end());
ServiceWorkerVersion* version = it->second;
if (version->running_status() != blink::EmbeddedWorkerStatus::kStopped) {
for (auto& observer : sync_observer_list_->observers) {
observer.OnStoppedSync(id, version->scope(),
*version->start_worker_token());
}
}
// ...
live_versions_.erase(it);
}
In the extensions system, extensions::ServiceWorkerState::OnStoppedSync initiates a synchronous call chain: ServiceWorkerState::HandleStop -> ServiceWorkerTaskQueue::OnWorkerStop -> ProcessManager::StopTrackingServiceWorkerRunningInstance -> EventRouter::OnStoppedTrackingServiceWorkerInstance -> EventAckData::ClearUnackedEventsForWorker -> ServiceWorkerContextWrapper::FinishedExternalRequest.
FinishedExternalRequest calls context()->GetLiveVersion(service_worker_version_id). Since the entry has not yet been erased from the map, it retrieves a raw pointer to the object being destroyed. It then wraps this pointer in a scoped_refptr<ServiceWorkerVersion>.
In release builds, base::RefCounted::AddRef() does not check if the object is being destroyed (the in_dtor_ check is a DCHECK). The reference count increments from 0 to 1. When the scoped_refptr goes out of scope at the end of the function, the count returns to zero, and a second delete this is executed on the same memory.
Potential Consequences
- Double Destruction: The
ServiceWorkerVersiondestructor runs twice, leading to a double-free of its member objects (e.g.,EmbeddedWorkerInstance). - Re-entrant Map Erasure: The inner (re-entrant)
RemoveLiveVersioncall erases the entry fromlive_versions_. When the outer call resumes, its iteratoritis invalidated, and the subsequentlive_versions_.erase(it)causes undefined behavior/heap corruption. - Use-After-Free: After the notification loop, the outer
RemoveLiveVersionaccesses the now-deleted object viaversion->reporting_source(), leading to a UAF read.
Potential Steps to Reproduce
An attacker controlling an extension renderer might trigger this via the following potential steps:
- Ensure the extension has a background service worker and an active "unacked event" (e.g., by sending a message that hasn't been acknowledged).
- Trigger the destruction of the
ServiceWorkerVersion(for example, by causing the worker to fail during startup or by reloading the extension). - The synchronous notification chain triggered during destruction will reach
FinishedExternalRequest, causing the resurrection and subsequent double-free of theServiceWorkerVersionobject.
Suggested Fix
Remove the ServiceWorkerVersion from the live_versions_ map before notifying synchronous observers in ServiceWorkerContextCore::RemoveLiveVersion. This ensures that any re-entrant calls to GetLiveVersion will fail to find the object being destroyed.
Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e
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.
What is known
A high-severity memory corruption bug in ServiceWorker (Google Chrome). Chrome VRP made it public on 8 June 2026 as CVE-2026-11656. Fixed in version 149.0.7827.102.
About 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.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.