Use after free in DOM (CVE-2026-13845)
An AI-generated analysis claims that PagePopupController keeps a raw C++ reference to an off-heap popup object, and that a re-entrant popup creation during cancellation can orphan that popup so it is destroyed without full teardown. A pending JavaScript task could then call setWindowRect on the freed object, giving a use-after-free that the text says could lead to renderer remote code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 35 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 PagePopupController because it holds a raw C++ reference to an off-heap WebPagePopupImpl. Re-entrant page popup creation during popup cancellation can overwrite or clear WebViewImpl's tracking reference, leaving an orphaned popup that is destructed without full teardown. If a pending JavaScript task subsequently invokes setWindowRect in the orphaned context, it performs a virtual function call on the freed WebPagePopupImpl object.
Affected files:
third_party/blink/renderer/core/page/page_popup_controller.hthird_party/blink/renderer/core/page/page_popup_controller.ccthird_party/blink/renderer/core/exported/web_page_popup_impl.ccthird_party/blink/renderer/core/exported/web_view_impl.cc
Estimated timestamp from git blame: 2015-04-15
Potential Use-After-Free in PagePopupController
Analysis
PagePopupController stores a raw, unmanaged C++ reference to PagePopup:
// third_party/blink/renderer/core/page/page_popup_controller.h
PagePopup& popup_;
This reference points to a WebPagePopupImpl instance, which is allocated off-heap using PartitionAlloc and does not benefit from MiraclePtr protection.
During normal operation, WebViewImpl manages the active popup via scoped_refptr<WebPagePopupImpl> page_popup_. However, during a re-entrant OpenPagePopup sequence (for example, if a synchronous JS event is dispatched while a popup is being cancelled or closed), a new popup can be initialized before the previous popup's teardown completes. Because DCHECK assertions are compiled out in production builds, this re-entrant flow can overwrite the active page_popup_ pointer or cause CleanupPagePopup() to set page_popup_ to nullptr prematurely.
When a popup is orphaned this way:
-
It retains a reference count of 1 (held by its self-reference for the visible widget).
-
When the browser process disconnects the widget host for the orphaned popup,
WebPagePopupImpl::WidgetHostDisconnected()callsClose(), which initiatesCancel(). -
Cancel()routes back toWebViewImpl::ClosePagePopup(), which checks:C++ if (page_popup_.get() != popup_impl) return;Since
page_popup_no longer points to the orphaned popup (or isnullptr), this check fails and early-returns, completely bypassingClosePopup()andDestroyPage(). -
Consequently, the orphaned popup is immediately destructed when its refcount drops to 0, but its associated
LocalFrameand DOM window are never properly detached or shut down. -
Any pending asynchronous tasks (e.g., DOM timers) still queued in the orphaned frame's context can execute on subsequent event loop ticks and call
window.pagePopupController.setWindowRect(). -
This invokes
PagePopupController::setWindowRect(), which performs a pure virtual method call (popup_.SetWindowRect(...)) on the deletedWebPagePopupImplobject, leading to a potential use-after-free and renderer remote code execution.
Potential Trigger Scenario (Conceptual)
Note: These are potential steps that need verification as our current tooling does not run code.
- A page opens a form-associated popup (Popup A).
- The attacker triggers a re-entrant popup request (Popup B) via synchronous event listeners (e.g., during events dispatched when Popup A is cancelled or closed).
- In release builds, this overwrites/invalidates
WebViewImpl::page_popup_, orphaning Popup A. - When the browser process disconnects the orphaned popup's host widget, its destructor runs but its frame and page scheduler are bypassed during teardown and remain active.
- An asynchronous timer or event listener in Popup A's context executes after the object is freed and invokes
setWindowRect, triggering the virtual call UAF.
Suggested Remediation
- Avoid storing raw C++ references to
PagePopupinPagePopupController. Instead, use a nullable pointer or a weak reference pattern that can be safely invalidated during teardown. - Harden
WebViewImpl::OpenPagePopupagainst re-entrancy by ensuring that popup creation requests are safely deferred or rejected if a page popup cancellation/closure sequence is currently active on the stack.
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 controller stores an unmanaged raw reference to the popup, and the close path early-returns when the tracked popup pointer no longer matches, so an orphaned popup is freed without detaching its frame.
Impact
The text claims this could lead to a use-after-free and renderer remote code execution, but it is a conceptual analysis that the authors say has not been verified by running code.
What the attacker needed
Victim loads attacker page; synchronous event listeners fire; release build without DCHECKs
The fix
The report suggests replacing the raw reference with a safely invalidatable pointer or weak reference and hardening popup opening against re-entrancy; it does not say a fix was shipped.
How it was found
- A page opens a form-associated popup.
- The attacker triggers a re-entrant popup request through synchronous event listeners while the first popup is being cancelled or closed.
- In release builds this overwrites or invalidates the tracked popup pointer, orphaning the first popup.
- When the browser process disconnects the orphaned popup's host widget, its destructor runs but its frame and scheduler are bypassed and stay active.
- An asynchronous timer or listener in the orphaned context runs after the object is freed and calls setWindowRect, triggering the virtual call on freed 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 throws away an object but something still holds a pointer to it and later uses it, like using a key to a flat that has been demolished. Here the popup controller keeps such a pointer, and a timing trick with a second popup opening while the first is closing can leave the first one destroyed while its page is still running code. That leftover code then calls into the dead object, which can crash the browser tab or, in theory, 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.