Use after free in Printing (CVE-2026-10894)
A use-after-free vulnerability exists in the Linux printing component where a raw window pointer is cached across an asynchronous D-Bus handshake. If the window is destroyed during this period, subsequent dereferences in the completion callback can lead to memory corruption, potentially allowing code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 19 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 Use-After-Free (UAF) vulnerability exists in the Linux printing component where a raw aura::Window pointer is cached across an asynchronous D-Bus handshake. If the window is destroyed during this period, subsequent dereferences in the completion callback can lead to memory corruption. This issue affects Chrome on Linux and potentially allows for code execution in the browser process.
Affected files:
components/printing/common/print_dialog_linux_portal.cccomponents/printing/common/print_dialog_linux_portal.hui/gtk/printing/print_dialog_gtk.cc
Estimated timestamp from git blame: 2025-12-11
Summary
A potential Use-After-Free (UAF) vulnerability has been identified in PrintDialogLinuxPortal. The class caches a raw aura::Window* (stored as gfx::NativeView) across an asynchronous D-Bus operation. If the WebContents or its associated window is closed before the handshake completes, the pointer becomes dangling, leading to a UAF when the completion callback is executed.
Root Cause Analysis
In components/printing/common/print_dialog_linux_portal.cc, the ShowDialog method initiates an asynchronous portal check:
void PrintDialogLinuxPortal::ShowDialog(gfx::NativeView parent_view, ...) {
parent_view_ = parent_view; // Caches raw aura::Window*
dbus_xdg::RequestXdgDesktopPortal(
bus_.get(), base::BindOnce(&PrintDialogLinuxPortal::OnPortalAvailable,
weak_factory_.GetWeakPtr(), has_selection));
}
The PrintDialogLinuxPortal is kept alive by a temporary ownership cycle involving PrinterQuery and the print callback. If an attacker closes the window (e.g., via window.close() in a renderer) while the D-Bus request is pending, parent_view_ becomes a dangling pointer. When OnPortalAvailable is eventually called, it dereferences this pointer:
void PrintDialogLinuxPortal::OnPortalAvailable(bool has_selection, uint32_t version) {
// ...
aura::Window* window = parent_view_ ? parent_view_ : nullptr;
if (window && window->GetRootWindow()) {
delegate->ExportWindowHandle(
window->GetHost()->GetAcceleratedWidget(), // <--- Potential UAF
...);
GetHost() and GetAcceleratedWidget() involve accessing the memory of the freed aura::Window and performing virtual function calls. An attacker who can reclaim this memory via heap spraying could potentially hijack the control flow to achieve code execution in the unsandboxed browser process.
Potential Attack Sequence (Unverified)
- A compromised renderer opens a popup window.
- The renderer triggers a scripted print request for that popup.
- The browser process initiates the
PrintDialogLinuxPortaland the asynchronous D-Bus handshake. - The renderer closes the popup window, destroying the associated
aura::Windowwhile the handshake is pending. - The attacker attempts to reclaim the freed memory in the browser process using heap spraying techniques.
- Upon completion of the D-Bus call,
OnPortalAvailableexecutes, dereferencing the dangling pointer and triggering the virtual call on attacker-controlled memory.
Suggested Fix
The PrintDialogLinuxPortal should not store a raw aura::Window*. Instead, it should use an aura::WindowTracker to safely monitor the lifetime of the parent window. Before dereferencing the window in OnPortalAvailable, the code should check the tracker to ensure the window is still valid. Alternatively, using a base::WeakPtr to the aura::WindowTreeHost (as seen in SelectFileDialogLinuxPortal) would also mitigate this risk.
Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e
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
The code stores a raw pointer to an aura::Window across an asynchronous D-Bus call without tracking the window's lifetime, so the pointer can dangle if the window is destroyed before the callback runs.
Impact
This issue affects Chrome on Linux and potentially allows for code execution in the browser process, though the attack sequence is unverified.
What the attacker needed
Compromised renderer; Chrome on Linux; user opens print dialog
The fix
The PrintDialogLinuxPortal should not store a raw aura::Window*; instead, it should use an aura::WindowTracker to safely monitor the lifetime of the parent window, or use a base::WeakPtr to the aura::WindowTreeHost.
How it was found
- A compromised renderer opens a popup window.
- The renderer triggers a scripted print request for that popup.
- The browser process initiates the PrintDialogLinuxPortal and the asynchronous D-Bus handshake.
- The renderer closes the popup window, destroying the associated aura::Window while the handshake is pending.
- The attacker attempts to reclaim the freed memory in the browser process using heap spraying techniques.
- Upon completion of the D-Bus call, OnPortalAvailable executes, dereferencing the dangling pointer and triggering the virtual call on attacker-controlled memory.
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 reference to memory after it has been freed. Here, the printing code remembers a window pointer while waiting for a system service, and if the window is closed in the meantime, the pointer becomes invalid. Later use of that pointer can crash the browser or 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.