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

Use after free in WebView (CVE-2026-13870)

A use-after-free exists in the Android WebView JS Sandbox service because a task posted to the thread pool can outlive the isolate that created it. An attacker who can run JavaScript in a sandboxed isolate could trigger a write into freed memory and a virtual call on a freed object, potentially leading to remote code execution.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 3 months

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

Overview: A potential Use-After-Free (UAF) exists in JsSandboxIsolate when ConsumeNamedDataAsArrayBuffer posts a task directly to the base::ThreadPool. If the isolate is destroyed while this task is blocked reading a file descriptor, the task outlives the isolate, leading to a UAF write into a freed V8 ArrayBuffer and a UAF read/virtual call on the freed JsSandboxIsolate object.

Affected files:

  • android_webview/js_sandbox/service/js_sandbox_isolate.cc
  • android_webview/js_sandbox/service/js_sandbox_isolate.h

Estimated timestamp from git blame: 2025-11-07

Description

A potential Use-After-Free (UAF) vulnerability exists in JsSandboxIsolate within the Android WebView JS Sandbox service. The issue originates from an asynchronous task posted to the global base::ThreadPool that outlives the JsSandboxIsolate object and its associated V8 Isolate.

In android_webview/js_sandbox/service/js_sandbox_isolate.cc, the ConsumeNamedDataAsArrayBuffer method allows sandboxed JavaScript to read data from a pipe into an ArrayBuffer. To perform the read without blocking the main isolate thread, it posts a task (ConvertPromiseToArrayBufferInThreadPool) to the base::ThreadPool using base::Unretained(this). This task is passed a raw void* pointer (inner_buffer) pointing to the V8 ArrayBuffer's backing store.

The worker task executes a blocking base::ReadFromFD call. If the isolate is destroyed (e.g., via the host app calling close(), or an error causing the isolate to terminate) while this task is blocked waiting for data on the file descriptor, the following sequence occurs:

  1. TerminateAndDestroy() is executed, which resets the cancelable_task_tracker_. However, this does not cancel the ThreadPool task because it was posted directly to base::ThreadPool, bypassing the tracker.
  2. DeleteSelf() is called on the isolate thread, deleting the JsSandboxIsolate C++ object.
  3. The destruction of the isolate triggers the disposal of the V8 isolate, which immediately frees all associated ArrayBuffer backing stores.

Once the attacker provides data to the pipe (or the writer is closed), the worker task resumes. This leads to two critical impacts:

  • Use-After-Free Write: base::ReadFromFD blindly writes data into the now-freed inner_buffer memory span. Since the inner_buffer is a raw pointer passed into an UNSAFE_TODO span, this write is not protected by MiraclePtr and provides a controlled memory corruption primitive.
  • Use-After-Free Read and Virtual Call: After reading, the task attempts to access this->control_task_runner_ (a scoped_refptr member of the deleted JsSandboxIsolate object) to post a completion task. This results in a UAF read and a virtual call on the resulting pointer, providing a path for vtable hijacking and potentially Remote Code Execution (RCE).

This vulnerability is significant because the JsSandbox service hosts untrusted JavaScript and can run multiple isolates within the same utility process. An exploit can be used to break cross-isolate boundaries and compromise the renderer-tier privileged utility process.

Potential Steps to Trigger (Theoretical)

Please note our tooling agent does not have the ability to run code, so these are suggested steps based on static analysis:

  1. An attacker gains the ability to execute arbitrary JavaScript within a sandboxed JsSandboxIsolate instance.
  2. The attacker ensures a named data pipe (file descriptor) is passed to the isolate, where they control the write-end of the pipe and can deliberately delay writing data.
  3. The attacker's JavaScript code calls android.consumeNamedDataAsArrayBuffer(name).
  4. The underlying C++ code posts the ConvertPromiseToArrayBufferInThreadPool task, which blocks in base::ReadFromFD waiting for data.
  5. The attacker triggers the destruction of the isolate (e.g., by coordinating with a malicious host app to call close(), or by triggering an OOM condition within the isolate).
  6. The JsSandboxIsolate and the ArrayBuffer backing store are destroyed and freed.
  7. The attacker writes payload data to the pipe. The ThreadPool task unblocks, performs the UAF write into the freed ArrayBuffer backing store, and then accesses the freed this pointer to post the reply, triggering the vulnerability.

Suggested Fix

Do not use base::Unretained(this) and raw pointers to V8 memory for tasks posted to the ThreadPool.

Instead of allocating the ArrayBuffer upfront and passing its backing store to the thread pool, allocate an independent buffer (e.g., a std::vector<uint8_t> or std::string) in the thread pool, read the data into it, and then pass ownership of that buffer back to the control sequence. Once safely back on the isolate thread, allocate the ArrayBuffer and copy or transfer the data into it.

To manage the callback safely across threads, the state required to post back to the control sequence (like the task runner and the file descriptor) should be encapsulated in a reference-counted state object (base::RefCountedThreadSafe) or bound using base::BindPostTask combined with a base::WeakPtr (if appropriate for the threading model). This ensures the background task operates on valid memory and cannot interact with a destroyed JsSandboxIsolate.

Evaluated with Chrome root at commit: a9cbf6e8b275fe4147435aa905f3b7f5a656f5f0


Results from 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 code posts a task to the thread pool using a raw pointer to the isolate and a raw pointer to the ArrayBuffer backing store, without a mechanism to cancel the task or keep the objects alive until the task finishes.

Impact

An attacker could break cross-isolate boundaries and compromise the renderer-tier privileged utility process, potentially achieving remote code execution.

What the attacker needed

Ability to run JavaScript in a sandboxed isolate; control over a named data pipe; ability to trigger isolate destruction

The fix

The code should avoid using raw pointers and base::Unretained(this) for thread pool tasks; instead, it should read into an independent buffer and use a reference-counted state object or base::BindPostTask with a base::WeakPtr to safely manage the callback across threads.

How it was found

  1. Gain the ability to execute arbitrary JavaScript within a sandboxed JsSandboxIsolate instance.
  2. Ensure a named data pipe is passed to the isolate, with control over the write end and the ability to delay writing.
  3. Call android.consumeNamedDataAsArrayBuffer(name) from JavaScript.
  4. The underlying C++ code posts a task that blocks waiting for data on the pipe.
  5. Trigger destruction of the isolate, for example by calling close() or causing an out-of-memory condition.
  6. Write data to the pipe so the blocked task resumes and performs the use-after-free write and read.

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 frees some memory but keeps using it, like deleting a file and then trying to read it. Here, a background task keeps running after the object it belongs to has been destroyed, so it writes into memory that has already been freed. An attacker who can run JavaScript inside the sandbox could exploit this to corrupt memory and possibly take control of the 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.

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.