Use after free in Views (CVE-2026-11637)
A use-after-free vulnerability exists in Chrome's macOS browser process during fullscreen transitions. When a modal sheet animation runs a nested run-loop, a window close task can destroy the bridge object, leading to a use-after-free when the original function resumes.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 13 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 macOS browser process of Google Chrome during fullscreen transitions. When NativeWidgetNSWindowBridge::FullscreenControllerTransitionComplete() invokes OrderChildren(), it can synchronously run a modal sheet animation that enters a nested AppKit run-loop. If a window close task is processed during this nested loop, the bridge is synchronously destroyed, causing a use-after-free when control returns to the caller.
Affected files:
components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
Estimated timestamp from git blame: 2022-03-15
Summary
A potential Use-After-Free (UAF) vulnerability exists in the macOS browser process of Google Chrome inside the NativeWidgetNSWindowBridge class during fullscreen transitions. The issue arises because FullscreenControllerTransitionComplete() calls OrderChildren(), which can synchronously run a modal sheet animation that enters a nested AppKit run-loop. If the window is closed while this nested loop is running, the bridge is synchronously destroyed, causing a UAF when the stack unwinds and accesses fields of the freed bridge.
Vulnerability Analysis
In components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm, the method FullscreenControllerTransitionComplete() is defined as:
void NativeWidgetNSWindowBridge::FullscreenControllerTransitionComplete(
bool is_fullscreen) {
DCHECK(!fullscreen_controller_.IsInFullscreenTransition());
UpdateWindowGeometry();
UpdateWindowDisplay();
// Add any children that were skipped during the fullscreen transition.
OrderChildren(); // <--- Can spin nested run-loop
host_->OnWindowFullscreenTransitionComplete(is_fullscreen); // <--- UAF on return if destroyed
if (is_fullscreen && immersive_mode_controller_) { // <--- UAF
immersive_mode_controller_->FullscreenTransitionCompleted();
}
}
When OrderChildren() executes, if there is a window-modal sheet child (where modal_type_ == ui::mojom::ModalType::kWindow) that wants to be visible but is not yet shown, it calls child->ShowAsModalSheet().
For an in-process bridge (browser-process path), MustPostTaskToRunModalSheetAnimation() returns false (defined in ui/views/cocoa/native_widget_mac_ns_window_host.mm). Therefore, begin_sheet_closure is executed synchronously, invoking AppKit's -[NSWindow beginSheet:completionHandler:] on-stack:
void NativeWidgetNSWindowBridge::ShowAsModalSheet() {
...
if (host_helper_->MustPostTaskToRunModalSheetAnimation()) { ... }
else {
std::move(begin_sheet_closure).Run(); // Synchronous beginSheet:
}
}
As AppKit's beginSheet: executes, it spins a nested run-loop to run the sheet presentation animation, which continues to pump the main thread's message loop.
Bridge Destruction Inside the Nested Run-Loop
While this nested run-loop is running, if a window close request occurs, CloseWindow() is called. Since the window state is kFullscreen, the close is not deferred by the fullscreen controller. A window close task is posted to the current thread's runner:
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindOnce(^{ [window close]; }));
This task is processed and executed immediately inside the active nested run-loop.
The execution of [window close] invokes the delegate's callback:
-[ViewsNSWindowDelegate windowWillClose:] -> OnWindowWillClose() -> host_->OnWindowHasClosed() -> native_widget_mac_->WindowDestroyed() -> ns_window_host_.reset()
This synchronously destroys the NativeWidgetMacNSWindowHost and its owned NativeWidgetNSWindowBridge instance whose FullscreenControllerTransitionComplete() frame is still active on the call stack.
Upon exiting the nested run-loop, OrderChildren() returns. The subsequent lines in FullscreenControllerTransitionComplete() access this->host_ and this->immersive_mode_controller_ on the freed bridge allocation, causing a Use-After-Free (UAF).
Suggested Trigger Scenario
Note: These are potential steps. Our security review tooling does not have the ability to run code, and we do not have a functional proof-of-concept exploit.
- A page opens a popup hosting an in-process
NativeWidgetNSWindowBridge. - A window-modal sheet child is created and deferred (e.g. while the popup is hidden/inactive).
- The page requests fullscreen (
element.requestFullscreen()). - During the fullscreen transition, AppKit triggers
windowDidEnterFullScreen:->OnWindowDidEnterFullscreen()->FullscreenControllerTransitionComplete()->OrderChildren(). OrderChildren()callsShowAsModalSheet(), starting the synchronousbeginSheet:nested loop.- While the nested loop is running, the page calls
window.close(), which posts a[window close]task that runs immediately, destroying the bridge. - The nested loop finishes, and the bridge is dereferenced during the return of
FullscreenControllerTransitionComplete(), triggering a UAF.
Proposed Fix
Use a base::WeakPtr to verify if the bridge has been destroyed during the nested run-loop before continuing execution inside FullscreenControllerTransitionComplete():
void NativeWidgetNSWindowBridge::FullscreenControllerTransitionComplete(
bool is_fullscreen) {
DCHECK(!fullscreen_controller_.IsInFullscreenTransition());
UpdateWindowGeometry();
UpdateWindowDisplay();
// Add any children that were skipped during the fullscreen transition.
auto weak_ptr = factory_.GetWeakPtr();
OrderChildren();
if (!weak_ptr) {
return;
}
host_->OnWindowFullscreenTransitionComplete(is_fullscreen);
if (is_fullscreen && immersive_mode_controller_) {
immersive_mode_controller_->FullscreenTransitionCompleted();
}
}
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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 code calls a function that can run a nested event loop, and during that loop the object can be destroyed, but the code does not check for destruction before accessing members.
Impact
An attacker could potentially crash the browser or execute arbitrary code in the browser process, though the report notes this is a potential issue and no proof-of-concept was developed.
What the attacker needed
MacOS Chrome browser; page can open popup and request fullscreen; window-modal sheet child deferred; page can call window.close()
The fix
The fix should use a base::WeakPtr to check if the bridge has been destroyed during the nested run-loop before continuing execution.
How it was found
- A page opens a popup hosting an in-process NativeWidgetNSWindowBridge.
- A window-modal sheet child is created and deferred (e.g. while the popup is hidden/inactive).
- The page requests fullscreen (element.requestFullscreen()).
- During the fullscreen transition, AppKit triggers windowDidEnterFullScreen: -> OnWindowDidEnterFullscreen() -> FullscreenControllerTransitionComplete() -> OrderChildren().
- OrderChildren() calls ShowAsModalSheet(), starting the synchronous beginSheet: nested loop.
- While the nested loop is running, the page calls window.close(), which posts a [window close] task that runs immediately, destroying the bridge.
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 frees an object's memory but then keeps using it, like deleting a file and then trying to open it. Here, during a fullscreen change, a popup window can be closed while an animation is running, which frees the object that the fullscreen code still needs. This could let an attacker crash the browser or possibly run malicious 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.