Use after free in FullScreen (CVE-2026-11648)
A use-after-free occurs in WebContentsImpl::SetWindowRect because ForSecurityDropFullscreen can spin a nested message loop on Windows, during which the calling WebContents can be destroyed by a popup's fullscreenchange handler calling window.close(). The subsequent call to delegate_->SetContentsBounds then reads from the freed object, which ASAN confirms is still exploitable despite MiraclePtr.
Originally disclosed on Chrome VRP
- Fix shipped in 43 days
Use-After-Free in WebContentsImpl::SetWindowRect via ForSecurityDropFullscreen
Summary
WebContentsImpl::SetWindowRect() calls ForSecurityDropFullscreen() which internally calls ExitFullscreen() on other WebContents. On Windows, this can spin a nested message loop via ::SetWindowPos. During this nested loop, the calling WebContents can be destroyed (e.g., via window.close() from a popup's fullscreenchange handler). The subsequent call to delegate_->SetContentsBounds(this, bounds) then reads from the freed WebContentsImpl object.
This is a variant of my earlier report, Bug 505045913 (UAF in RenderFrameHostImpl::ExitFullscreen). That fix added a WeakPtr guard in ExitFullscreen, but the same nested message loop race exists in SetWindowRect via ForSecurityDropFullscreen and was not addressed.
Version
Chrome 149.0.7805.0, Windows x64, ASAN build (is_asan=true is_debug=false symbol_level=1)
Steps to Reproduce
- Build Chrome with ASAN
- Apply
patch.diff(RunLoop simulating::SetWindowPosnested message loop) - Launch:
chrome --no-sandbox poc.html - Click Start — a popup opens
- Click the popup body — it enters fullscreen, opener auto-resizes
- ASAN reports heap-use-after-free in
SetWindowRect
Root Cause
content/browser/web_contents/web_contents_impl.cc:
void WebContentsImpl::SetWindowRect(const gfx::Rect& new_bounds) {
// ...
ForSecurityDropFullscreen(display_id).RunAndReset(); // [1]
delegate_->SetContentsBounds(this, bounds); // [2]
}
[1] ForSecurityDropFullscreen iterates fullscreen WebContents and calls ExitFullscreen() on each. On Windows, ExitFullscreen → ExitFullscreenMode → ::SetWindowPos spins a nested message loop. During this loop, Mojo IPCs are processed — including RequestClose from the popup's fullscreenchange handler calling opener.close() — destroying this WebContents.
[2] delegate_->SetContentsBounds(this, bounds) reads this->delegate_ from the freed 5592-byte WebContentsImpl allocation.
The ExitFullscreen fix (Bug 505045913) added a WeakPtr guard in RenderFrameHostImpl::ExitFullscreen(), but SetWindowRect reaches the same nested message loop via ForSecurityDropFullscreen without any guard.
ASAN Trace
==17584==ERROR: AddressSanitizer: heap-use-after-free on address 0x1218f580c210
READ of size 8 at 0x1218f580c210 thread T0
#0 in content::WebContentsImpl::SetWindowRect web_contents_impl.cc:9737
#1 in content::RenderFrameHostImpl::SetWindowRect render_frame_host_impl.cc:7809
freed by thread T0 here:
#0 in operator delete
#1 in content::WebContentsImpl::~WebContentsImpl web_contents_impl.cc:1370
#7 in content::WebContentsImpl::Close web_contents_impl.cc:9699
#8 in content::RenderFrameHostImpl::ClosePageIgnoringUnloadEvents render_frame_host_impl.cc:7769
MiraclePtr Status: NOT PROTECTED
This crash is still exploitable with MiraclePtr.
Patch Explanation
patch.diff adds a base::RunLoop pump between ForSecurityDropFullscreen() and SetContentsBounds(). This simulates the natural race from the ::SetWindowPos nested message loop on Windows, allowing the pending RequestClose Mojo IPC to execute and destroy the WebContents.
Suggested Fix
fix.diff adds a base::WeakPtr guard after ForSecurityDropFullscreen(), matching the pattern from the ExitFullscreen fix (Bug 505045913):
base::WeakPtr<WebContentsImpl> weak_this = weak_factory_.GetWeakPtr();
ForSecurityDropFullscreen(display_id).RunAndReset();
if (!weak_this) {
return;
}
delegate_->SetContentsBounds(this, bounds);
Reporter Credit: Mihnea Nicolau
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 code calls ForSecurityDropFullscreen, which can spin a nested message loop on Windows, and then uses the WebContentsImpl pointer without a WeakPtr guard, so the object may be freed during the loop.
Impact
The use-after-free could be exploited for memory corruption, and the report notes it is still exploitable with MiraclePtr, though the proof of concept relies on a patch simulating the Windows nested message loop.
What the attacker needed
Chrome on Windows x64; Victim opens a malicious page; Victim clicks to open a popup; Victim clicks the popup to enter fullscreen
The fix
The suggested fix adds a base::WeakPtr guard after ForSecurityDropFullscreen and returns early if the WebContents has been destroyed, matching the earlier ExitFullscreen fix.
How it was found
- Build Chrome with ASAN and apply a patch that simulates the nested message loop.
- Launch Chrome with the proof-of-concept page.
- Click Start to open a popup.
- Click the popup body to enter fullscreen, causing the opener to auto-resize.
- ASAN reports a heap-use-after-free in SetWindowRect.
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 using a piece of memory after it has been freed, which can let an attacker control what happens next. Here, a browser function that resizes a window can pause to process other messages, and during that pause the window's page can be closed and its memory freed. When the function resumes, it still touches the freed memory, which is a memory safety bug.
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.