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

Use after free in WebXR (CVE-2026-9995)

Several WebXR swap chain classes in Blink call into a WebGL rendering context from their destructors, which Oilpan does not guarantee is still alive. If the context is finalised first, the destructor reads freed memory and may call through a corrupted pointer, potentially allowing code execution in the renderer.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 14 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 without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: Multiple WebXR swap chain classes in Blink incorrectly dereference a Member<WebGLRenderingContextBase> during their destruction process. Because Oilpan does not guarantee the destruction order of objects in the same collection cycle, this leads to a potential Use-After-Free if the WebGL context is finalized before the swap chain.

Affected files:

  • third_party/blink/renderer/modules/xr/xr_webgl_cubemap_swap_chain.cc
  • third_party/blink/renderer/modules/xr/xr_webgl_texture_array_swap_chain.cc
  • third_party/blink/renderer/modules/xr/xr_webgl_swap_chain.cc
  • third_party/blink/renderer/modules/xr/xr_webgl_swap_chain.h
  • third_party/blink/renderer/modules/xr/xr_swap_chain.h

Estimated timestamp from git blame: 2025-01-17

Summary

A potential Use-After-Free (UAF) vulnerability exists in several Oilpan-managed classes within the WebXR module: XRWebGLCubemapSwapChain, XRWebGLTextureArraySwapChain, and XRWebGLStaticSwapChain. These classes violate a core safety contract of Blink's garbage collector (Oilpan), which specifies that destructors must not access other on-heap objects. This is because the order of finalization during a garbage collection sweep is non-deterministic, meaning an object's members may be finalized and reclaimed before the object itself is destroyed.

Technical Details

The affected classes inherit from XRWebGLSwapChain, which holds a reference to the WebGL rendering context as a traced member:

C++
// third_party/blink/renderer/modules/xr/xr_webgl_swap_chain.h
WebGLRenderingContextBase* context() { return webgl_context_.Get(); }
// ...
Member<WebGLRenderingContextBase> webgl_context_;

In their destructors, these classes call context()->ContextGL() to obtain a gpu::gles2::GLES2Interface* for cleaning up GPU-side resources:

  • XRWebGLCubemapSwapChain: Calls context()->ContextGL() in ~XRWebGLCubemapSwapChain() (third_party/blink/renderer/modules/xr/xr_webgl_cubemap_swap_chain.cc:133).
  • XRWebGLTextureArraySwapChain: Calls context()->ContextGL() in ~XRWebGLTextureArraySwapChain() (third_party/blink/renderer/modules/xr/xr_webgl_texture_array_swap_chain.cc:48).
  • XRWebGLStaticSwapChain: Calls context()->ContextGL() in ~XRWebGLStaticSwapChain() (third_party/blink/renderer/modules/xr/xr_webgl_swap_chain.cc:126).

When both the swap chain and the WebGLRenderingContextBase become unreachable in the same GC cycle, the context may be finalized first. The call to context()->ContextGL() then performs a field read from the now-freed or reclaimed memory to retrieve the gles2_interface_ pointer. This pointer is subsequently used for virtual function calls, such as gl->DeleteTextures() or gl->DeleteBuffers().

Potential Impact

By controlling the data at the memory offset of the gles2_interface_ pointer (e.g., through heap spraying), a potential attacker could redirect virtual function calls to arbitrary addresses. This provides a primitive for remote code execution (RCE) within the sandboxed renderer process.

Reachability

This code path is reachable via the WebXR Layers API (e.g., createCubeLayer or createProjectionLayer with depth/stencil attachments), which is stable and enabled by default. Triggering the vulnerability would require an active WebXR session, which involves a one-time user permission prompt.

Suggested Attack Steps (Potential)

  1. Initialize a WebGL context and an immersive WebXR session.
  2. Create a vulnerable swap chain using XRWebGLBinding (e.g., by calling createCubeLayer).
  3. Release all JavaScript references to the WebGL context and the WebXR objects to make them eligible for garbage collection.
  4. Trigger a garbage collection cycle while simultaneously spraying the heap with attacker-controlled data designed to overlap with the WebGLRenderingContextBase memory layout.
  5. If the context is finalized before the swap chain, the swap chain's destructor will dereference the sprayed memory, potentially leading to hijacked control flow.

Recommended Fix

Blink objects should not access on-heap members in their destructors. The cleanup logic should be moved to a pre-finalizer or an explicit shutdown method that is guaranteed to run while the referenced objects are still valid. For example, the XRWebGLSwapChain classes could use the USING_PRE_FINALIZER macro to perform GL resource cleanup before finalization begins.

Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e


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.

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

The swap chain destructors access the on-heap WebGL context member, violating Oilpan's rule that destructors must not touch other on-heap objects whose finalisation order is non-deterministic.

Impact

A successful exploit could redirect virtual calls and provide a primitive for remote code execution, but only inside the sandboxed renderer process and only if the attacker wins the finalisation race and controls the freed memory.

What the attacker needed

WebXR session with user permission; WebGL context; Ability to trigger garbage collection; Heap spray control

The fix

The cleanup should be moved to a pre-finaliser or explicit shutdown method, for example using the USING_PRE_FINALIZER macro, so GL resources are released while the context is still valid.

How it was found

  1. Create a WebGL context and start an immersive WebXR session.
  2. Create a vulnerable swap chain through XRWebGLBinding, for example with createCubeLayer.
  3. Drop all JavaScript references to the WebGL context and the WebXR objects so they become garbage-collectable.
  4. Trigger a garbage collection while heap spraying data shaped like the WebGL context.
  5. If the context is finalised before the swap chain, the destructor dereferences the sprayed 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.

Blink, Chrome's rendering engine, uses a garbage collector called Oilpan that frees objects in no fixed order. Some WebXR objects try to use a WebGL context while being destroyed, but that context may already have been freed, so they read memory that is no longer valid. An attacker who can shape that freed memory could make the program jump to an address they choose.

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.