Use after free in WebXR (CVE-2026-10982)
The XRFrame::fillPoses method in Blink's WebXR implementation captures a span from a JavaScript-owned Float32Array and then triggers synchronous JavaScript execution via XRSpace::getPose. An attacker can detach the underlying ArrayBuffer during that execution, causing subsequent writes to the stale span to corrupt memory.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 18 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: The XRFrame::fillPoses method in Blink's WebXR implementation is vulnerable to a potential write-after-free. The function captures a base::span from a JavaScript-owned Float32Array and subsequently triggers synchronous JavaScript execution via the XRSpace::getPose method. An attacker can detach the underlying ArrayBuffer during this execution, causing subsequent writes to the stale span to corrupt memory.
Affected files:
third_party/blink/renderer/modules/xr/xr_frame.ccthird_party/blink/renderer/modules/xr/xr_bounded_reference_space.ccthird_party/blink/renderer/modules/xr/xr_space.ccthird_party/blink/renderer/modules/xr/xr_reference_space.cc
Estimated timestamp from git blame: 2024-10-21
Root Cause Analysis
In third_party/blink/renderer/modules/xr/xr_frame.cc, the fillPoses method retrieves a base::span from the provided Float32Array before entering a loop to populate it with pose data:
// xr_frame.cc:570
auto transforms_data = transforms->AsSpan();
for (const auto& space : spaces) {
auto current_transform = transforms_data.take_first<kFloatsPerTransform>();
if (const XRPose* pose = space->getPose(base_space)) {
current_transform.copy_from(pose->transform()->matrix()->AsSpan());
} else {
std::ranges::fill(current_transform, NAN);
}
}
The transforms_data span is a snapshot of the array's backing store. Within the loop, space->getPose(base_space) is invoked. If the space is an XRBoundedReferenceSpace, this call leads to XRBoundedReferenceSpace::EnsureUpdated() in third_party/blink/renderer/modules/xr/xr_bounded_reference_space.cc (line 104), which dispatches a synchronous reset event:
mutable_this->DispatchEvent(
*XRReferenceSpaceEvent::Create(event_type_names::kReset, mutable_this));
DispatchEvent is a synchronous call that executes JavaScript event listeners. An attacker can use this callback to detach the transforms buffer (e.g., via postMessage). When the callback returns, the transforms_data span in fillPoses still holds a raw pointer to the now-detached or freed memory. Subsequent calls to copy_from or std::ranges::fill result in a write-after-free.
Potential Impact
This vulnerability allows an attacker to perform a controlled write-after-free within the sandboxed renderer process. The attacker can control the contents of the write (via the poses of the spaces) and the location of the write within the ArrayBuffer partition. Since ArrayBuffer backing stores are not protected by MiraclePtr (BackupRefPtr) and often reside in the V8 sandbox cage, this primitive could be leveraged to corrupt V8 objects and achieve remote code execution (RCE) within the renderer.
Suggested Potential Reproduction Steps
- Establish an immersive VR session with 'bounded-floor' support.
- Create a sequence of
XRBoundedReferenceSpaceobjects. - Attach a
resetevent listener to one of the spaces. - In the listener, transfer the
Float32Arraybuffer intended forfillPosesto a Worker to detach it. - Call
xrFrame.fillPoses()with the space sequence and the target array. - Observe a crash or heap corruption when
fillPosesattempts to write to the second or subsequent spaces in the sequence.
Recommended Fix
The base::span should not be held across points of synchronous JavaScript execution. The code should be modified to either:
- Re-acquire the span from the
DOMFloat32Arrayinside the loop after the call togetPose. - Validate that the buffer has not been detached after returning from
getPosebefore performing the write. - Pre-calculate all poses before capturing the span for the output buffer.
Evaluated with Chrome root at commit: 1a8d40fc44df2088d5945c0bf53584038aa1614a
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 base::span is held across a point of synchronous JavaScript execution, so the underlying buffer can be detached before the span is used for writing.
Impact
This could allow a controlled write-after-free within the sandboxed renderer process, potentially leading to remote code execution within the renderer.
What the attacker needed
WebXR with bounded-floor support; Ability to run JavaScript in the renderer
The fix
The code should be modified to re-acquire the span from the DOMFloat32Array inside the loop after the call to getPose, validate that the buffer has not been detached, or pre-calculate all poses before capturing the span.
How it was found
- Establish an immersive VR session with 'bounded-floor' support.
- Create a sequence of XRBoundedReferenceSpace objects.
- Attach a reset event listener to one of the spaces.
- In the listener, transfer the Float32Array buffer intended for fillPoses to a Worker to detach it.
- Call xrFrame.fillPoses() with the space sequence and the target array.
- Observe a crash or heap corruption when fillPoses attempts to write to the second or subsequent spaces in the sequence.
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 keeps a pointer to memory that has been freed and then writes to it. Here, a WebXR function holds a reference to a JavaScript array's memory, then runs JavaScript code that can free that memory, and afterwards writes to the freed memory. This can crash the browser or let an attacker take control of the renderer process.
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.