Use after free in Extensions (CVE-2026-13774)
A use-after-free exists in the browser process when the chrome.management.installReplacementWebApp API interacts with PWA Navigation Capturing. An attacker could potentially achieve arbitrary code execution in the unsandboxed browser process.
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 Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential use-after-free exists in the browser process when the chrome.management.installReplacementWebApp API interacts with PWA Navigation Capturing. If the navigation is captured by an existing PWA window, the newly created WebContents is destroyed, but a stack-allocated raw pointer is still used to make a virtual method call. This could potentially allow an attacker to achieve arbitrary code execution in the unsandboxed browser process.
Affected files:
chrome/browser/extensions/api/management/chrome_management_api_delegate_non_android.ccchrome/browser/ui/browser_tabstrip.ccchrome/browser/ui/browser_navigator.ccchrome/browser/ui/web_applications/web_app_dialog_utils.ccchrome/browser/web_applications/web_app_provider.cc
Estimated timestamp from git blame: 2023-10-26
Description
A Use-After-Free (UAF) vulnerability exists in the browser process within OnWebAppInstallabilityChecked (located in chrome/browser/extensions/api/management/chrome_management_api_delegate_non_android.cc). The issue occurs when the chrome.management.installReplacementWebApp extension API is used to install an app whose URL is subsequently intercepted by the PWA Navigation Capturing logic.
When OnWebAppInstallabilityChecked is called, it saves a raw pointer to a newly created WebContents onto the stack:
content::WebContents* containing_contents = web_contents.get();
Because this is a stack-local raw pointer, it is not protected by MiraclePtr (BackupRefPtr).
Ownership of the WebContents is then transferred to chrome::AddWebContents:
chrome::AddWebContents(displayer.browser(), nullptr, std::move(web_contents), ...);
Inside AddWebContents, the WebContents is moved into a NavigateParams object, and Navigate(¶ms) is called. During navigation, if the URL matches an installed PWA configured with navigation capturing (e.g., client_mode: focus-existing), web_app::NavigationCapturingProcess intercepts it and sets params.browser to the existing PWA window, returning a valid singleton_index for the existing tab.
Because singleton_index != -1, Navigate skips the block that inserts the newly created WebContents into the TabStripModel. When Navigate and AddWebContents return, the NavigateParams object goes out of scope, which synchronously destroys the newly created WebContents.
Execution then continues in OnWebAppInstallabilityChecked, where the dangling containing_contents pointer is passed to web_app::CreateWebAppFromManifest. This function calls WebAppProvider::GetForWebContents(web_contents), which immediately performs a virtual method call on the freed object:
Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext());
Because WebContentsImpl is a large object, PartitionAlloc frees it directly to the central allocator rather than the thread-local cache. This makes the memory immediately available for concurrent threads (such as the Mojo IPC thread) to reclaim and populate with attacker-controlled data, allowing hijacking of the virtual call.
Potential Steps to Reproduce
Note: These are suggested/potential steps based on static analysis, as our tooling agent does not yet have the ability to run code to verify a full exploit chain.
- An attacker publishes a malicious Chrome Web Store extension that requests the
managementpermission and sets thereplacement_web_appmanifest key to an attacker-controlled URL. - The attacker hosts a malicious PWA at that URL, configured with a
launch_handlerusingclient_mode: focus-existingornavigate-existing. - The victim is convinced to install both the extension and the PWA.
- The victim has the malicious PWA open in a browser window.
- The malicious extension calls
chrome.management.installReplacementWebApp(). - The browser process creates an empty
WebContentsand performs the installability check. - When
chrome::AddWebContentsis called, the navigation is captured by the already-open PWA window, causing the newWebContentsto be destroyed. - Concurrently, the attacker uses the compromised renderer (e.g., via high-volume Mojo IPC messages) to spray the central allocator with objects matching the size class of
WebContentsImpl, reclaiming the freed memory and placing a fake vtable pointer at offset 0. - The UI thread dereferences the fake vtable during the
GetBrowserContext()call, resulting in arbitrary code execution in the browser process.
Suggested Fix
Do not rely on a raw pointer that bypasses lifetime management. Instead of saving a raw content::WebContents*, capture a base::WeakPtr<content::WebContents> before moving the unique pointer:
base::WeakPtr<content::WebContents> weak_contents = web_contents->GetWeakPtr();
chrome::AddWebContents(...);
if (!weak_contents) {
// The WebContents was destroyed during navigation (e.g., captured by an existing PWA).
std::move(callback).Run(InstallOrLaunchWebAppResult::kUnknownError);
return;
}
web_app::CreateWebAppFromManifest(
weak_contents.get(), webapps::WebappInstallSource::MANAGEMENT_API,
base::BindOnce(&OnWebAppInstallCompleted, std::move(callback)));
Alternatively, chrome::AddWebContents returns a pointer to the navigated or inserted WebContents. OnWebAppInstallabilityChecked could verify that the returned pointer matches the original WebContents before proceeding.
Evaluated with Chrome root at commit: a1e33f5848218e21d4a16ae2c1bc94e815c30c7f
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
Likely a stack-local raw pointer to a WebContents is used after the object is destroyed during navigation capturing.
Impact
This could potentially allow an attacker to achieve arbitrary code execution in the unsandboxed browser process.
What the attacker needed
Victim installs malicious extension; victim installs malicious PWA; victim opens malicious PWA; attacker can spray memory
The fix
The fix should use a weak pointer or check the returned pointer to avoid using a dangling raw pointer.
How it was found
- An attacker publishes a malicious Chrome Web Store extension that requests the management permission and sets the replacement_web_app manifest key to an attacker-controlled URL.
- The attacker hosts a malicious PWA at that URL, configured with a launch_handler using client_mode: focus-existing or navigate-existing.
- The victim is convinced to install both the extension and the PWA.
- The victim has the malicious PWA open in a browser window.
- The malicious extension calls chrome.management.installReplacementWebApp().
- The browser process creates an empty WebContents and performs the installability check.
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 it has been freed, and then uses it again. Here, the browser frees a web page object but still tries to call a function on it, which could let an attacker run their own code.
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.