Use after free in GTK (CVE-2026-8555)
A use-after-free vulnerability exists in the GTK UI backend on Linux/Wayland when setting a transient parent for dialogs. An attacker could trick a user into opening a file chooser dialog and then removing the iframe, causing the dialog to be freed while an asynchronous callback still holds a pointer, potentially leading to browser-process remote code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 37 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 without the security team.
Overview: A potential Use-After-Free (UAF) exists when setting a Wayland transient parent for GTK dialogs. If an attacker opens a dialog and immediately destroys the requesting iframe, the GTK dialog is freed while an asynchronous callback holds a raw pointer to it. When the Wayland compositor responds, the callback accesses the freed widget.
Affected files:
ui/gtk/wayland/gtk_ui_platform_wayland.ccui/ozone/platform/wayland/host/xdg_foreign_wrapper.ccui/gtk/printing/print_dialog_gtk.ccui/gtk/select_file_dialog_linux_gtk.cccontent/browser/file_system_access/file_system_chooser.ccui/gtk/gtk_util.ccui/shell_dialogs/select_file_dialog_linux_portal.cc
Estimated timestamp from git blame: 2025-11-11
Summary
A potential Use-After-Free (UAF) vulnerability exists in the browser process on Linux/Wayland when using the GTK UI backend. The issue stems from GtkUiPlatformWayland::SetGtkWidgetTransientFor, which binds a raw GtkWidget* into an asynchronous Wayland callback. If the dialog is closed before the callback executes, the GtkWidget is destroyed. When the Wayland compositor eventually responds, the callback dereferences the freed widget, leading to a UAF.
Potential Attacker Steps
Note: These are suggested/potential steps based on code analysis; our tooling has not executed a live proof-of-concept.
- An attacker hosts a malicious page with a cross-origin
<iframe>. - The attacker tricks the user into a gesture (e.g., a click) inside the iframe.
- The iframe uses the File System Access API (
showOpenFilePicker()) to request a file chooser dialog. - In the browser process,
FileSystemChoosercreates a native GTK dialog (SelectFileDialogLinuxGtk). - Chrome attempts to set the transient parent for the dialog. On Wayland, this requires an asynchronous roundtrip to the compositor to export the parent window handle. The raw
GtkWidget*is bound to thebase::BindOncecallback for this response. - While the Wayland request is pending, the parent page removes the
<iframe>from the DOM. - This destroys the
RenderFrameHost, causing theWebContentsBasedCancellerto cancel the file selection and destroy theFileSystemChooser. - The
SelectFileDialogLinuxGtkis destroyed, callinggtk_window_destroy(widget)and freeing theGtkWidget. - The Wayland compositor replies with the exported handle. Chrome executes the pending callback, calling
GtkUiPlatformWayland::OnHandleSetTransientwith the danglingGtkWidget*pointer. - The dangling pointer is passed to
gtk_widget_get_native(widget), triggering a virtual function call on attacker-controlled memory and potentially achieving browser-process Remote Code Execution (RCE).
MiraclePtr (BRP) Bypass
Chromium's BackupRefPtr (MiraclePtr) mechanism usually protects raw pointers bound in callbacks. However, GtkWidget objects are allocated by GLib. On older GLib versions (e.g., GLib < 2.76, default on Ubuntu 20.04/22.04), memory is managed by the g_slice sub-allocator. g_slice maintains its own freelist and does not immediately return memory via free(). Because PartitionAlloc's free() hook is bypassed, MiraclePtr is unaware that the object was destroyed. As a result, the dangling pointer detection in UnretainedWrapper fails to trigger, making the UAF fully exploitable.
Suggested Fix
Avoid binding a raw GtkWidget* to the asynchronous Wayland callback. Because GtkWidget is a GObject and does not support base::WeakPtr directly, a safe approach is to use g_object_weak_ref to track the widget's lifetime, or pass a base::WeakPtr to the C++ wrapper class (e.g., SelectFileDialogLinuxGtk) that manages the dialog.
Alternatively, GtkUiPlatformWayland could store a mapping of active requests and provide a method to explicitly cancel the pending Wayland handle export when the caller destroys the GTK dialog.
Evaluated with Chrome root at commit: f200f57a19490707ff8bc7aa5de3cbc443a3afad
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
The code binds a raw pointer to a GTK widget into an asynchronous Wayland callback without ensuring the widget stays alive until the callback runs.
Impact
The dangling pointer is passed to gtk_widget_get_native, triggering a virtual function call on attacker-controlled memory and potentially achieving browser-process Remote Code Execution (RCE).
What the attacker needed
Linux with Wayland; GTK UI backend; victim clicks inside iframe; GLib < 2.76 for MiraclePtr bypass
The fix
Avoid binding a raw GtkWidget* to the asynchronous Wayland callback by using g_object_weak_ref or a base::WeakPtr to the C++ wrapper class, or by explicitly cancelling pending requests when the dialog is destroyed.
How it was found
- An attacker hosts a malicious page with a cross-origin iframe.
- The attacker tricks the user into a gesture inside the iframe.
- The iframe uses the File System Access API to request a file chooser dialog.
- The browser creates a native GTK dialog and attempts to set its transient parent, which requires an asynchronous Wayland roundtrip.
- While the Wayland request is pending, the parent page removes the iframe, causing the dialog to be destroyed.
- The Wayland compositor replies, and the pending callback accesses the freed widget.
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 bug where a program keeps a pointer to memory after it has been freed. If an attacker can control what gets written into that freed memory, they might be able to run their own code. Here, a dialog window is freed while a callback still tries to use it, and the attacker can trigger this by removing an iframe at the right moment.
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.