Use after free in Views (CVE-2026-9948)
A use-after-free in macOS tooltip handling leaves a dangling pointer after a view is detached, which a compromised renderer can trigger via tooltip IPC messages. This could lead to remote code execution in the browser process, potentially escaping the sandbox.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 41 days
Flapjack, 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 Chrome Security team. Please see go/chrome-ai-generated-security-bugs-faq for more information.
Overview: A Use-After-Free (UAF) in macOS tooltips can potentially be exploited by a compromised renderer. When a view is detached, tooltip cleanup fails to clear an internal pointer, which can later be dereferenced when the renderer sends a malicious tooltip update.
Affected files:
ui/base/cocoa/tool_tip_base_view.mm
Estimated timestamp from git blame: 2015-05-19
Description
A Use-After-Free (UAF) vulnerability exists in ui/base/cocoa/tool_tip_base_view.mm on macOS. ToolTipBaseView caches a raw pointer (_trackingRectUserData) to an internal AppKit NSToolTip struct. When a view is detached from its window and the tooltip is removed, the _trackingRectUserData pointer is not cleared, leaving it dangling. A compromised renderer can force the dereference of this dangling pointer by sending subsequent tooltip update IPC messages, potentially leading to a Sandbox Escape in the Browser process.
Technical Details
- Allocation: When a standard tooltip is displayed, AppKit allocates an
NSToolTipstruct and calls the overriddenaddTrackingRect:...method onToolTipBaseView(or a subclass likeRenderWidgetHostViewCocoa). Chromium caches a pointer to this struct in_trackingRectUserData. - Detachment: The view is detached from its
NSWindow(e.g., during tab tearing or window closure), soself.windowbecomesnil. - Removal: The tooltip is removed (either automatically or triggered by
setToolTipAtMousePoint:). AppKit calls the overriddenremoveTrackingRect:or_removeTrackingRects:count:. These methods correctly set_trackingRectOwnertonilbut fail to clear_trackingRectUserData. AppKit then frees theNSToolTipmemory, leaving_trackingRectUserDatadangling. - Malicious Update: A compromised renderer sends a
SetTooltipText(orUpdateTooltipUnderCursor) IPC message with a non-empty string. (Note: For some views, like Top Chrome WebUI, the bridge check only requires the app to be active, not the window to be valid). - Execution Path: The browser routes this to
-[ToolTipBaseView setToolTipAtMousePoint:].- It first calls
[self removeAllToolTips]. - It then attempts to add the new tooltip. Because
self.windowisnil, AppKit defers tracking rect creation and bypassesaddTrackingRect:, leaving the dangling_trackingRectUserDatauntouched. - It then calls
_sendToolTipMouseEntered. If the mouse is over the desktop, a safety check (windowNumberAtPoint) evaluates to 0, matchingself.window.windowNumber(which is also 0), and bypasses the check. Otherwise, the attacker can send a second IPC update, triggering_sendToolTipMouseExited, which completely lacks a window check.
- It first calls
- UAF: Both paths construct a fake
NSEventusing the dangling_trackingRectUserDataand dispatch it toNSToolTipManager. AppKit dereferences the freed memory. - Exploitation: Because
NSToolTipis an AppKit struct, it is allocated in a macOS system malloc zone. PartitionAlloc-Everywhere (PA-E) only intercepts the default zone, meaning this allocation is likely unprotected by BackupRefPtr (BRP). An attacker controlling the renderer can spray the browser heap to control the reallocated memory, leading to RCE in the Browser process.
Suggested Fix
Ensure _trackingRectUserData is explicitly cleared alongside _trackingRectOwner.
// ui/base/cocoa/tool_tip_base_view.mm
- (void)removeTrackingRect:(NSTrackingRectTag)tag {
...
if (tag == kTrackingRectTag) {
_trackingRectOwner = nil;
_trackingRectUserData = nullptr; // FIX
return;
}
...
}
- (void)_removeTrackingRects:(NSTrackingRectTag *)tags count:(int)count {
...
DCHECK(tag == kTrackingRectTag);
_trackingRectOwner = nil;
_trackingRectUserData = nullptr; // FIX
}
}
Additionally, add robust nil-checks for self.window and _trackingRectUserData in _sendToolTipMouseEntered and _sendToolTipMouseExited.
Evaluated with Chrome root at commit: c1eba8ce379f5d218a2948fafbb5dd72cfa30529
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.
Raised in root component due to access or custom field issues on 1974931
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 tooltip removal methods clear the owner pointer but fail to clear the cached user-data pointer, leaving it dangling after the underlying AppKit tooltip struct is freed.
Impact
A compromised renderer could exploit this use-after-free to achieve remote code execution in the browser process, potentially escaping the sandbox; the text notes that the allocation is likely unprotected by BackupRefPtr, making heap spraying feasible.
What the attacker needed
Compromised renderer; macOS; view detached from window; tooltip removed
The fix
The fix should explicitly clear the cached user-data pointer alongside the owner pointer in the tooltip removal methods, and add nil-checks for the window and pointer in the tooltip event methods.
How it was found
- A tooltip is displayed and AppKit allocates an NSToolTip struct, with Chromium caching a pointer to it.
- The view is detached from its window, making self.window nil.
- The tooltip is removed, freeing the NSToolTip memory but leaving the cached pointer dangling.
- A compromised renderer sends a tooltip update IPC message with a non-empty string.
- The browser calls setToolTipAtMousePoint:, which removes all tooltips and then attempts to add a new one; because the window is nil, tracking rect creation is deferred and the dangling pointer remains.
- The code then calls _sendToolTipMouseEntered or _sendToolTipMouseExited, which construct a fake NSEvent using the dangling pointer and dispatch it to NSToolTipManager, causing a use-after-free.
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 when a program keeps a reference to memory it has already freed, and later uses that stale reference. Here, a macOS tooltip object is freed but a pointer to it is not cleared, so a malicious web page (through the renderer) can make the browser use the freed memory. This could let an attacker run their own code in the browser process, which is more powerful than the sandboxed renderer.
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.