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

Use after free in Streaming (CVE-2026-113033)

A data race exists in Chrome Cast Remoting because the Receiver object erases a callback from a shared registry on the media thread while the main thread may be invoking it. An attacker could potentially exploit this race to achieve remote code execution in the sandboxed renderer process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 6 months

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 security team.

Overview: A data race exists in the Chrome Cast Remoting implementation because media::remoting::Receiver mutates the RpcMessenger callback registry on the media thread while it is concurrently accessed on the main thread. This lack of synchronization during session teardown can lead to a Use-After-Free (UAF) of std::function state. An attacker could potentially exploit this race to achieve remote code execution in the sandboxed renderer process.

Affected files:

  • media/remoting/receiver.cc
  • third_party/openscreen/src/cast/streaming/public/rpc_messenger.cc
  • media/remoting/receiver_controller.cc
  • third_party/openscreen/src/util/flat_map.h

Estimated timestamp from git blame: 2021-08-19

Vulnerability Detail

A critical concurrency vulnerability exists in the Cast Remoting implementation, specifically in how the media::remoting::Receiver interacts with the process-global openscreen::cast::RpcMessenger registry.

The RpcMessenger class maintains a registry of callbacks in a FlatMap<Handle, ReceiveMessageCallback> called receive_callbacks_. FlatMap is a wrapper around std::vector<std::pair<K, V>> and provides no internal thread synchronization.

In the renderer process, this vector is accessed concurrently from two different threads without locking:

  1. Main Thread (Read/Execute): The ReceiverController singleton receives RPC messages via Mojo. ReceiverController::OnMessageFromSource executes on the main thread and calls RpcMessenger::ProcessMessageFromRemote. This function performs a std::find_if on receive_callbacks_ and invokes the resulting std::function callback (entry->second(std::move(message))).
  2. Media Thread (Write/Erase): The media::remoting::Receiver object is owned by the media pipeline (PipelineImpl::RendererWrapper) and is destroyed on the media thread when a streaming session terminates. Its destructor, ~Receiver(), calls rpc_messenger_->UnregisterMessageReceiverCallback(rpc_handle_). This immediately calls std::vector::erase on the media thread.

Impact

When std::vector::erase is called on the media thread concurrently with the main thread iterating over or invoking a callback from the same vector, a severe data race occurs. The erase operation shifts elements and destroys std::function objects. If the main thread attempts to call through a std::function that is actively being moved or destroyed, it accesses corrupted heap state (specifically, the internal polymorphic state of the std::function or the base::BindState it holds).

Because the corruption involves the execution flow through an implicit this pointer on the stack or STL-internal control blocks, MiraclePtr (BRP) does not provide protection.

Potential Attacker Steps

Please note: These are theoretical steps as our tooling cannot currently execute a Proof of Concept.

  1. An attacker connects to a vulnerable Chrome Cast Receiver (e.g., CastOS or Cast Android) and initiates a remoting session to act as the Cast Sender.
  2. The attacker floods the receiver with a high volume of valid RPC messages (e.g., RPC_R_SET_VOLUME), forcing the main thread to constantly iterate and execute callbacks inside RpcMessenger::OnMessage.
  3. Simultaneously, the attacker abruptly forces a session teardown (e.g., by dropping the connection or sending a fatal error). This triggers the teardown of PipelineImpl on the media thread.
  4. The ~Receiver destructor runs on the media thread, erasing the callback from the vector while the main thread is simultaneously invoking it.
  5. The ensuing Use-After-Free allows the attacker to hijack the instruction pointer when the main thread calls into the freed std::function state, potentially achieving arbitrary code execution within the sandboxed renderer.

Suggested Fix

The root cause is that Receiver modifies a main-thread data structure from the media thread. The fix is to ensure that unregistration happens on the main thread.

In ~Receiver(), instead of calling unregister directly, post a task to the main_task_runner_:

C++
Receiver::~Receiver() {
  main_task_runner_->PostTask(
      FROM_HERE,
      base::BindOnce(&RpcMessenger::UnregisterMessageReceiverCallback,
                     base::Unretained(rpc_messenger_), rpc_handle_));
}

(Note: This is the exact pattern already safely used by the sender-side CourierRenderer in media/remoting/courier_renderer.cc:846).

Evaluated with Chrome root at commit: f200f57a19490707ff8bc7aa5de3cbc443a3afad


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 Receiver destructor unregisters a callback from a shared registry on the media thread without synchronisation, while the main thread may be reading or invoking that same callback.

Impact

The use-after-free could allow an attacker to hijack the instruction pointer and potentially achieve arbitrary code execution within the sandboxed renderer process.

What the attacker needed

Attacker can connect to a Cast receiver; attacker can initiate a remoting session; attacker can send RPC messages; attacker can force session teardown

The fix

The fix should ensure that unregistration happens on the main thread by posting a task to the main task runner instead of calling unregister directly from the destructor.

How it was found

  1. An attacker connects to a vulnerable Chrome Cast Receiver and initiates a remoting session.
  2. The attacker floods the receiver with valid RPC messages to keep the main thread busy iterating callbacks.
  3. The attacker abruptly forces a session teardown, triggering the media thread to destroy the Receiver.
  4. The Receiver destructor erases the callback from the vector while the main thread is invoking it, causing a use-after-free.

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 memory but then keeps using it, like deleting a file and then trying to open it. Here, two parts of the program run at the same time: one deletes a callback function while the other tries to call it, which can crash or let an attacker run their own code. The report suggests a fix by making sure the deletion happens on the same thread that uses the callback.

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.