Skip to content
Memory corruption Advisory Advanced CVE-2026-7908

Use after free in Fullscreen (CVE-2026-7908)

A use-after-free exists in the fullscreen exit path because a nested message loop can destroy a WebContentsImpl held by a raw pointer. An attacker could potentially hijack control flow in the browser process and escape the sandbox.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 38 days

Project Fortify, an experimental security project, has identified the following potential security issue.

Overview: A Use-After-Free vulnerability exists in WebContentsImpl::ForSecurityDropFullscreen due to reentrancy when exiting fullscreen mode. A nested message loop allows attacker-controlled destruction of a WebContentsImpl object held by a raw pointer, leading to a UAF virtual method call. This could potentially result in a browser process sandbox escape.

Affected files:

  • content/browser/web_contents/web_contents_impl.cc

Estimated timestamp from git blame: 2023-11-30

Vulnerability Details

There is a potential Use-After-Free (UAF) vulnerability in content/browser/web_contents/web_contents_impl.cc within the WebContentsImpl::ForSecurityDropFullscreen function. This function drops the fullscreen state when security-sensitive UI elements (like JavaScript dialogs or file choosers) are invoked, preventing UI spoofing attacks.

The function contains two loops. The second loop iterates over the opener chain of the current WebContents:

C++
  for (auto* opener : GetAllOpeningWebContents(this)) {
    if (is_fullscreen(opener, display_id)) {
      opener->ExitFullscreen(true);
    }
    // ...
    ++opener->fullscreen_blocker_count_;
    blocked_contentses.push_back(opener->weak_factory_.GetWeakPtr());
  }

GetAllOpeningWebContents returns a base::flat_set<WebContentsImpl*>. These are raw pointers, lacking MiraclePtr (raw_ptr<T>) protection.

Inside the loop, opener->ExitFullscreen(true) is called for any fullscreen opener. On platforms with complex window management (e.g., macOS, Windows), exiting fullscreen eventually calls delegate_->ExitFullscreenModeForTab(this), which can spin a nested message loop to wait for the transition to complete.

While this nested loop runs, the browser continues to process IPCs. An attacker can use an IPC (such as window.close()) to destroy another, non-fullscreen WebContentsImpl that is further down the flat_set iteration order. Because this second WebContents is not fullscreen, it is not protected by the raw_ptr quarantine present in the first loop of the function (fullscreen_set_copy). Its memory is immediately freed.

When the nested loop completes, iteration resumes. The loop will eventually process the now-dangling raw pointer. The is_fullscreen inline lambda is invoked, which executes tab->GetDelegate()->GetFullscreenState(tab). This results in a UAF virtual method call on attacker-controlled memory, leading to potential Remote Code Execution (RCE) in the privileged Browser Process.

Suggested Attack Steps (Potential)

Note: Our tooling agent does not run live exploits; these are analytically determined steps to trigger the bug.

  1. A malicious page (Page A) opens a same-origin child window (Page B).
  2. Page B opens another same-origin child window (Page C).
  3. By relying on sequential heap allocation, the attacker ensures Page A resides at a lower memory address than Page B, meaning Page A will be processed first in the base::flat_set.
  4. Page A enters fullscreen mode.
  5. Page C calls alert('XSS'), triggering a JavaScript dialog.
  6. The browser process receives the IPC and calls ForSecurityDropFullscreen on Page C's WebContentsImpl.
  7. The second loop calls GetAllOpeningWebContents, capturing raw pointers to A, B, and C.
  8. The loop processes Page A first. Since it is fullscreen, ExitFullscreen is called, spinning a nested message loop.
  9. While blocked in the nested loop, Page C's JavaScript executes pageB.close(), sending an IPC that destroys Page B. Page B is freed.
  10. The attacker heap-sprays via IPC to reclaim Page B's memory with a fake WebContentsImpl containing a fake delegate_ vtable.
  11. The nested message loop finishes. The iteration continues to the dangling pointer for Page B.
  12. is_fullscreen is called on the dangling pointer, triggering a virtual call to the fake delegate_, hijacking control flow.

Suggested Fix

Refactor GetAllOpeningWebContents to return a collection of base::WeakPtr<WebContentsImpl> or base::SafeRef<WebContentsImpl> instead of raw pointers. Alternatively, convert the raw pointers to WeakPtr locally within ForSecurityDropFullscreen before entering the loop, and check for validity (if (!opener) continue;) before dereferencing them on each iteration.

Evaluated with Chrome root at commit: 876d480da1f794d87813cfa2e6ff4fcf9771e939


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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 opener chain is stored as raw pointers, and a nested message loop during fullscreen exit allows one of those objects to be destroyed before the loop dereferences it.

Impact

This could potentially result in a browser process sandbox escape and remote code execution, though the report notes the steps are analytically determined and not a live exploit.

What the attacker needed

Victim visits a malicious page; same-origin child windows; fullscreen mode; JavaScript dialog

The fix

The function should use weak or safe references instead of raw pointers and check validity before dereferencing.

How it was found

  1. A malicious page opens a same-origin child window, which opens another same-origin child window.
  2. The attacker arranges heap allocation so the first page is processed first in the opener set.
  3. The first page enters fullscreen mode.
  4. The last child window triggers a JavaScript dialog, causing the browser to drop fullscreen.
  5. While the fullscreen exit spins a nested message loop, the last child window closes the middle window, freeing its WebContentsImpl.
  6. The attacker heap-sprays to reclaim the freed memory with a fake object, and the loop later calls a virtual method on the dangling pointer.

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.

When a web page exits fullscreen, the browser runs a loop that can pause and let other messages run. During that pause, another page can close a window, freeing memory that the loop still holds a pointer to. The loop then uses the freed memory, which an attacker could fill with fake data to take control of the browser.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.