Use after free in Enterprise (CVE-2026-17886)
A use-after-free vulnerability exists in DesktopDataControlsDialog::Show on macOS, where exiting HTML fullscreen during dialog creation can spin a nested run loop that destroys the dialog before the Show method resumes, leading to unprotected writes and reads from freed memory. An attacker could potentially exploit this to cause memory corruption, though the report is based on static analysis and no actual exploitation is demonstrated.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 46 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 (write and read) vulnerability exists in DesktopDataControlsDialog::Show on macOS. Exiting HTML fullscreen mode during dialog creation can spin a nested run loop, allowing queued tasks to run and synchronously destroy the dialog before the Show method resumes execution. This results in an unprotected UAF when writing and reading from freed member variables.
Affected files:
chrome/browser/enterprise/data_controls/desktop_data_controls_dialog.ccchrome/browser/enterprise/data_controls/desktop_data_controls_dialog.h
Estimated timestamp from git blame: 2025-05-27
Technical Analysis
In DesktopDataControlsDialog::Show (located in chrome/browser/enterprise/data_controls/desktop_data_controls_dialog.cc), the browser attempts to display a modal dialog:
widget_ = constrained_window::ShowWebModalDialogViewsOwned(
dialog_delegate_.get(), top_web_contents,
views::Widget::InitParams::CLIENT_OWNS_WIDGET);
widget_->MakeCloseSynchronous(base::BindOnce(
&DesktopDataControlsDialog::CloseDialog, base::Unretained(this)));
- Reentrant Nested Loop:
ShowWebModalDialogViewsOwnedtriggersBrowserWindowModalDialogDelegate::SetWebContentsBlocked, which forces the tab to drop HTML fullscreen viaweb_contents->ExitFullscreen(true)to present the modal dialog safely. - Mac-specific Loop Spinning: On macOS, exiting fullscreen mode calls down to AppKit (
-[NSWindow toggleFullScreen:]), which spins a nested Cocoa run loop to run window transition animations. - Synchronous Self-Deletion: While the nested run loop is spinning, queued tasks (such as a tab close or navigation) can run synchronously. If a tab close runs, it destroys the underlying
WebContents, which notifiesDesktopDataControlsDialog::WebContentsDestroyed(). This synchronously invokesCloseDialog()and executesdelete this;. - Use-After-Free: At the time of self-deletion,
this->widget_is stillnullptrbecause the assignment ofconstrained_window::ShowWebModalDialogViewsOwnedhas not completed yet. Consequently, theviews::Widgetremains alive. Once the nested loop exits and the stack unwinds back toShow(), it move-assigns the returnedstd::unique_ptr<views::Widget>tothis->widget_(a UAF write into deallocated memory). It then reads the corrupted member to callwidget_->MakeCloseSynchronous(...)(a UAF read) and binds the already deallocatedthispointer to the close callback.
Because widget_ is a std::unique_ptr and this is accessed directly from the stack, MiraclePtr does not protect against this vulnerability.
Suggested Steps to Trigger the Potential Vulnerability
Note: Since our tooling agent does not have the ability to run code, these are potential steps derived from static analysis.
- Configure an active Enterprise/MDM profile with a
DataControlsRulespolicy that yields aWarnorBlockclipboard action on the attacker's origin. - On macOS, open a new window or tab via
window.open(). - Obtain user activation to request HTML fullscreen via
element.requestFullscreen(). - Queue a tab-close action using
setTimeout(() => { window.close(); }, 0). - Immediately invoke a clipboard read or paste action via
navigator.clipboard.readText(). - This synchronously invokes
DesktopDataControlsDialog::Show(). When the window transitions out of fullscreen, the queued tab-close runs, destroying the dialog. WhenShow()resumes, it encounters the UAF.
Suggested Fix
Introduce a base::WeakPtrFactory<DesktopDataControlsDialog> in DesktopDataControlsDialog to verify self-liveness before assigning and dereferencing the widget:
In chrome/browser/enterprise/data_controls/desktop_data_controls_dialog.h:
private:
...
base::WeakPtrFactory<DesktopDataControlsDialog> weak_ptr_factory_{this};
In chrome/browser/enterprise/data_controls/desktop_data_controls_dialog.cc:
void DesktopDataControlsDialog::Show(base::OnceClosure on_destructed) {
...
base::WeakPtr<DesktopDataControlsDialog> weak_this = weak_ptr_factory_.GetWeakPtr();
auto widget = constrained_window::ShowWebModalDialogViewsOwned(
dialog_delegate_.get(), top_web_contents,
views::Widget::InitParams::CLIENT_OWNS_WIDGET);
if (!weak_this) {
return;
}
widget_ = std::move(widget);
widget_->MakeCloseSynchronous(base::BindOnce(
&DesktopDataControlsDialog::CloseDialog, base::Unretained(this)));
}
Evaluated with Chrome root at commit: b9a7cc5bde906eb50612d7bc368108eea0476cfb
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.
Raised in root component due to access or custom field issues on 1208119
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 Show method does not check whether the dialog object is still alive after a nested run loop (triggered by exiting fullscreen) may have destroyed it, leading to use-after-free on member variables.
Impact
An attacker could potentially exploit this use-after-free to cause memory corruption, though the report is based on static analysis and no actual exploitation is demonstrated.
What the attacker needed
MacOS; Enterprise/MDM profile with DataControlsRules policy; User activation for fullscreen; Attacker-controlled web page
The fix
The suggested fix is to introduce a base::WeakPtrFactory in DesktopDataControlsDialog to verify self-liveness before assigning and dereferencing the widget.
How it was found
- Configure an active Enterprise/MDM profile with a DataControlsRules policy that yields a Warn or Block clipboard action on the attacker's origin.
- On macOS, open a new window or tab via window.open().
- Obtain user activation to request HTML fullscreen via element.requestFullscreen().
- Queue a tab-close action using setTimeout(() => { window.close(); }, 0).
- Immediately invoke a clipboard read or paste action via navigator.clipboard.readText().
- This synchronously invokes DesktopDataControlsDialog::Show(); when the window transitions out of fullscreen, the queued tab-close runs, destroying the dialog, and when Show() resumes, it encounters the UAF.
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 is a type of memory bug where a program keeps using memory after it has been freed, which can lead to crashes or worse. Here, a dialog box in the Chrome browser on macOS can be destroyed while it is still being set up, because a fullscreen animation lets other tasks run in the middle of the setup. This means the program later writes to and reads from memory that no longer belongs to it.
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.