Use after free in Browser (CVE-2026-12464)
A use-after-free vulnerability exists in the browser process during custom protocol handler registration. An attacker could potentially exploit this to achieve control-flow hijacking or heap corruption.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 14 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 Use-After-Free (UAF) vulnerability exists in the browser process during custom protocol handler registration. When Browser::RegisterProtocolHandler calls ForSecurityDropFullscreen, synchronous destruction of the target WebContents can occur. A logic gap in ForSecurityDropFullscreen allows it to return a valid blocker instead of std::nullopt after destruction, resulting in a UAF when dereferencing the freed PermissionRequestManager and RenderFrameHost pointers.
Affected files:
chrome/browser/ui/browser.cccontent/browser/web_contents/web_contents_impl.cc
Estimated timestamp from git blame: 2026-05-07
Detailed Analysis of the Potential Vulnerability
In chrome/browser/ui/browser.cc:2461-2475, Browser::RegisterProtocolHandler captures raw, bare (non-raw_ptr) pointers to permissions::PermissionRequestManager and content::RenderFrameHost on the stack and then makes a synchronous call to ForSecurityDropFullscreen:
// chrome/browser/ui/browser.cc:2461-2475
permissions::PermissionRequestManager* permission_request_manager = // bare T*, not raw_ptr<>
permissions::PermissionRequestManager::FromWebContents(web_contents);
if (permission_request_manager) {
auto blocker = web_contents->ForSecurityDropFullscreen(
/*display_id=*/display::kInvalidDisplayId);
if (!blocker) { // ← Gap: can return non-nullopt after free
return;
}
permission_request_manager->AddRequest( // ← UAF: member call on freed WebContentsUserData
requesting_frame, // ← UAF: bare RenderFrameHost* parameter
std::make_unique<
custom_handlers::RegisterProtocolHandlerPermissionRequest>(
registry, handler, url, std::move(*blocker)));
}
Root Cause in ForSecurityDropFullscreen
In WebContentsImpl::ForSecurityDropFullscreen (content/browser/web_contents/web_contents_impl.cc:7544-7576), the code iterates through all opener WebContents to exit fullscreen. Within this loop, calling opener->ExitFullscreen(true) can trigger a synchronous platform-specific window-state change (e.g., via Win32 ::SetWindowPos or macOS [NSWindow toggleFullScreen:]). These synchronous OS calls are documented to spin a nested message loop and run arbitrary pending tasks on the UI thread.
If the target WebContents (which requested the protocol registration) has queued a close operation (such as via a script-initiated window.close()), the nested loop can process this close task and synchronously destroy both the WebContents, its associated PermissionRequestManager (which is a WebContentsUserData), and the RenderFrameHostImpl.
While ForSecurityDropFullscreen has a weak_this check at the beginning of each loop iteration, it completely lacks a weak_this check at the end of the second loop. If destruction of this occurs during the last iteration of the loop, the loop completes, and the function falls through and returns a valid base::ScopedClosureRunner instead of std::nullopt:
// content/browser/web_contents/web_contents_impl.cc:7564-7576
}
// BUG: Missing check for !weak_this here
return base::ScopedClosureRunner(base::BindOnce(
[](std::vector<base::WeakPtr<WebContentsImpl>> blocked_contents_list) {
...
},
std::move(blocked_contents_list)));
}
This defeats the if (!blocker) check in Browser::RegisterProtocolHandler. The code proceeds to invoke permission_request_manager->AddRequest on the freed objects. This results in:
- A virtual function call (
source_frame->IsInactiveAndDisallowActivation()) on a freedRenderFrameHostImplobject, which is a control-flow hijack primitive. - Member writes to the freed
PermissionRequestManager's pending request lists, which is a heap corruption primitive.
Potential Step-by-Step Scenario to Trigger the Vulnerability
Please note: These are theoretical/potential steps; our tooling does not currently have the capability to run code to confirm them.
- A user visits an attacker-controlled page (Origin A) which opens a same-origin popup (B).
- Origin A requests and enters content fullscreen via a user gesture.
- Popup B queues a window close via
window.close(). - A compromised renderer process bypasses Blink-side restrictions and directly issues the
blink::mojom::LocalFrameHost::RegisterProtocolHandlerMojo IPC from Popup B, settinguser_gesture = true(trusted by the browser with no independent verification). - In
Browser::RegisterProtocolHandler, the browser captures raw pointers to B'sPermissionRequestManagerand its main frameRenderFrameHostand then callsForSecurityDropFullscreen. - While iterating over openers in
ForSecurityDropFullscreen, B exits fullscreen on A. This synchronous call spins a nested loop during window-repositioning, executing B's queued window close and synchronously destroying B. - Since A was the last opener in the set, the loop terminates and falls through to return a valid blocker closure.
- The
!blockerguard is bypassed, leading to a UAF call topermission_request_manager->AddRequest(requesting_frame, ...), executing a virtual call on the freedRenderFrameHostand corrupting heap memory.
Suggested Fix
Add a weak_this check at the end of WebContentsImpl::ForSecurityDropFullscreen right before returning the ScopedClosureRunner:
if (!weak_this) {
return std::nullopt;
}
return base::ScopedClosureRunner(base::BindOnce(
[](std::vector<base::WeakPtr<WebContentsImpl>> blocked_contents_list) {
...
},
std::move(blocked_contents_list)));
Evaluated with Chrome root at commit: 87214e6721f6c34afd9181b80769a24c0c601c50
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
Likely, the function ForSecurityDropFullscreen lacks a weak pointer check after a loop that can synchronously destroy the WebContents, allowing it to return a valid blocker instead of nullopt, leading to use of freed pointers.
Impact
This could lead to a virtual function call on a freed object, which is a control-flow hijack primitive, and member writes to freed memory, which is a heap corruption primitive.
What the attacker needed
Compromised renderer process; user visits attacker page; user gesture for fullscreen
The fix
Add a weak_this check at the end of WebContentsImpl::ForSecurityDropFullscreen right before returning the ScopedClosureRunner.
How it was found
- A user visits an attacker-controlled page (Origin A) which opens a same-origin popup (B).
- Origin A requests and enters content fullscreen via a user gesture.
- Popup B queues a window close via window.close().
- A compromised renderer process bypasses Blink-side restrictions and directly issues the blink::mojom::LocalFrameHost::RegisterProtocolHandler Mojo IPC from Popup B, setting user_gesture = true.
- In Browser::RegisterProtocolHandler, the browser captures raw pointers to B's PermissionRequestManager and its main frame RenderFrameHost and then calls ForSecurityDropFullscreen.
- While iterating over openers in ForSecurityDropFullscreen, B exits fullscreen on A. This synchronous call spins a nested loop during window-repositioning, executing B's queued window close and synchronously destroying B.
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 using memory after it has been freed. Here, the browser frees some objects but then calls a function on them, which could let an attacker run malicious code or corrupt memory.
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.