Use after free in Blink (CVE-2026-13031)
A use-after-free vulnerability exists in Blink's WidgetBase::UpdateSurfaceAndScreenInfo because it synchronously dispatches an orientationchange event, allowing an attacker to destroy the widget during the callback. This leaves a dangling pointer that can be exploited for renderer remote code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 12 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. 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 in WidgetBase::UpdateSurfaceAndScreenInfo occurs due to synchronous JavaScript execution during visual property updates. An attacker can destroy the widget synchronously by intercepting an orientationchange event, leading to a dangling pointer read and subsequent virtual call hijack.
Affected files:
third_party/blink/renderer/platform/widget/widget_base.ccthird_party/blink/renderer/core/frame/web_frame_widget_impl.cc
Estimated timestamp from git blame: Unknown (Google3 checkout)
Description
A Use-After-Free (UAF) vulnerability exists in the renderer process within WidgetBase::UpdateSurfaceAndScreenInfo. When processing visual property updates that contain an orientation change, the method synchronously invokes client_->OrientationChanged(). This call dispatches a synchronous orientationchange JavaScript event.
If an attacker registers an event listener for this event, they can execute arbitrary DOM manipulation, such as detaching the iframe containing the widget. Detaching the frame immediately triggers the widget shutdown sequence (WebFrameWidgetImpl::Close), which deletes the WidgetBase instance. Upon return from the synchronous callback, the this pointer in UpdateSurfaceAndScreenInfo is dangling. The code subsequently accesses this->client_ to perform a virtual method call (DidUpdateSurfaceAndScreen), providing a reliable primitive for renderer remote code execution (RCE).
Potential Exploitation Steps
- An attacker creates a malicious page containing an
iframe. - Inside the
iframe, the attacker registers anorientationchangeevent listener:window.addEventListener('orientationchange', () => { window.parent.document.getElementById('target').remove(); });. - The attacker triggers a visual property update that modifies the screen orientation (e.g., via resizing or programmatic orientation APIs).
- The browser sends the updated properties to the renderer via IPC (
WidgetBase::UpdateVisualProperties). - Execution reaches
WidgetBase::UpdateSurfaceAndScreenInfo. The orientation change is detected, andclient_->OrientationChanged()is called. - This triggers the synchronous JavaScript event dispatch. The attacker's listener executes and detaches the
iframe. - The detachment triggers
WebFrameWidgetImpl::Close, which callswidget_base_.reset(), destroying theWidgetBaseobject. - The attacker uses heap manipulation techniques to reclaim the freed
WidgetBasememory with attacker-controlled data. - Execution returns to
UpdateSurfaceAndScreenInfo. The code attempts to callclient_->DidUpdateSurfaceAndScreen(...). - Because the attacker controls the memory previously occupied by
this, a controlled pointer is loaded forclient_. Dereferencing this pointer for the virtual call results in arbitrary control flow hijacking.
Note: WidgetBase is manually managed via std::unique_ptr and is not protected by MiraclePtr (BackupRefPtr).
Suggested Fix
Similar to WidgetBase::BeginMainFrame, utilize a base::WeakPtr to ensure the object is still alive after the potentially destructive synchronous callback.
if (orientation_changed) {
auto weak_this = weak_ptr_factory_.GetWeakPtr();
client_->OrientationChanged();
if (!weak_this) {
return;
}
}
client_->DidUpdateSurfaceAndScreen(previous_original_screen_infos);
Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff
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 calls a synchronous JavaScript event handler without checking whether the object still exists afterwards, so the handler can free the object and leave a dangling pointer.
Impact
An attacker could achieve renderer remote code execution by reclaiming the freed memory and hijacking control flow.
What the attacker needed
Victim visits a malicious page; browser processes orientation change
The fix
The fix should use a base::WeakPtr to check that the object is still alive after the synchronous callback before making further calls.
How it was found
- Create a malicious page with an iframe.
- Register an orientationchange event listener inside the iframe that removes an element from the parent document.
- Trigger a visual property update that changes the screen orientation.
- The browser sends updated properties to the renderer via IPC.
- Execution reaches UpdateSurfaceAndScreenInfo, which calls client_->OrientationChanged().
- The synchronous JavaScript event fires, the listener detaches the iframe, and the widget is destroyed.
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 changes orientation, the browser runs some JavaScript code immediately. If that JavaScript deletes the part of the page that triggered the change, the browser's internal object is freed while still being used, which can let an attacker take control of the program.
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.