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

Use after free in Cast Receiver (CVE-2026-13898)

A data race in the Cast Receiver component allows a worker thread to read a URL rewrite rules provider pointer after the main thread has freed it, leading to a use-after-free. The report claims this can be turned into an arbitrary atomic increment primitive in the renderer process, 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. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team.

Overview: A data race exists in ContentRendererClientMixinsImpl where url_rewrite_rules_providers_ is accessed across threads without synchronization. Concurrent modification on the main thread and read from a worker thread leads to a Use-After-Free. This can be leveraged into an arbitrary atomic increment primitive in the renderer process.

Affected files:

  • components/cast_receiver/renderer/content_renderer_client_mixins_impl.cc
  • components/cast_receiver/renderer/content_renderer_client_mixins_impl.h
  • components/cast_receiver/renderer/wrapping_url_loader_throttle_provider.cc

Estimated timestamp from git blame: 2023-11-07

Technical Details

A potential Use-After-Free (UAF) and data race vulnerability exists in the cast_receiver component, specifically in cast_receiver::ContentRendererClientMixinsImpl. This component manages URL rewrite rules for different frames using a base::flat_map<blink::LocalFrameToken, std::unique_ptr<UrlRewriteRulesProvider>> named url_rewrite_rules_providers_.

The url_rewrite_rules_providers_ map is modified on the renderer's main thread during frame creation (RenderFrameCreated calls emplace()) and destruction (OnRenderFrameRemoved calls erase()).

However, the map is read via GetUrlRewriteRulesProvider() which is called by WrappingURLLoaderThrottleProvider::CreateThrottles(). This method can execute on worker threads (for dedicated/shared worker subresource fetches) or background threads (when BackgroundResourceFetch is enabled). There is no locking mechanism protecting url_rewrite_rules_providers_ in ContentRendererClientMixinsImpl.

Potential Exploitation Steps

While we do not have a working Proof of Concept, code analysis suggests an attacker could exploit this via the following steps:

  1. Frame Setup: The attacker's webpage on the main thread creates a subframe (iframe).
  2. Worker Setup: The page spawns a Web Worker that will initiate subresource fetches.
  3. Fetch & Map Read: The worker thread executes a fetch. During throttle creation, WrappingURLLoaderThrottleProvider::CreateThrottles calls client_->GetUrlRewriteRulesProvider(...). This performs a binary search on the flat_map and returns a raw pointer to the UrlRewriteRulesProvider. This pointer is stored in a local stack variable provider.
  4. Race Condition: A context switch occurs back to the main thread. The attacker's script removes the subframe created in step 1.
  5. Destruction: Frame removal triggers OnRenderFrameRemoved on the main thread, which calls erase() on the map. Because base::flat_map is backed by a std::vector, this shifts elements and destroys the std::unique_ptr holding the UrlRewriteRulesProvider, freeing the object in the heap.
  6. Heap Spray: The attacker sprays the heap from the main thread or another worker, reclaiming the freed memory with attacker-controlled data designed to mimic a UrlRewriteRulesProvider object.
  7. Use-After-Free: Context switches back to the worker thread. The worker thread executes auto rules = provider->GetCachedRules(); using the now-dangling provider pointer.
  8. Atomic Increment: GetCachedRules() internally reads a scoped_refptr from the attacker-controlled memory and returns it by value. Returning by value invokes the copy constructor, which calls AddRef() on the attacker-provided pointer. Because the target object inherits from base::RefCountedThreadSafe, this provides the attacker with a highly reliable arbitrary atomic increment primitive.

This primitive can be used to corrupt reference counts of other objects, leading to further memory corruption and ultimately Remote Code Execution (RCE) in the sandboxed renderer process.

Note: MiraclePtr (BackupRefPtr) does not mitigate this specific UAF because the dangling provider pointer is held as a stack-local raw pointer rather than a class member.

Affected Files

  • components/cast_receiver/renderer/content_renderer_client_mixins_impl.h
  • components/cast_receiver/renderer/content_renderer_client_mixins_impl.cc
  • components/cast_receiver/renderer/wrapping_url_loader_throttle_provider.cc

Suggested Fix

  1. Introduce a base::Lock in ContentRendererClientMixinsImpl to protect all accesses (reads and writes) to url_rewrite_rules_providers_.
  2. Instead of returning a raw pointer from GetUrlRewriteRulesProvider(), the map should store scoped_refptr<url_rewrite::UrlRequestRewriteRules> directly, or GetUrlRewriteRulesProvider() should return the scoped_refptr by value while holding the lock. This ensures the rules stay alive for the duration of the worker thread's usage, even if the frame is destroyed.

Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b


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

The map of URL rewrite rules providers is accessed from multiple threads without any locking, so a worker thread can read a pointer to an object that the main thread has already erased and freed.

Impact

This could lead to further memory corruption and ultimately remote code execution in the sandboxed renderer process, though no working proof of concept is provided.

What the attacker needed

Victim visits attacker's webpage; browser runs Cast Receiver component; worker threads enabled

The fix

The map should be protected by a lock, and the provider should be returned as a reference-counted pointer by value so it stays alive during worker thread usage.

How it was found

  1. The attacker's webpage creates a subframe (iframe) on the main thread.
  2. The page spawns a Web Worker that will initiate subresource fetches.
  3. The worker thread executes a fetch, and during throttle creation it calls GetUrlRewriteRulesProvider, which returns a raw pointer to the provider.
  4. A context switch occurs back to the main thread, and the attacker's script removes the subframe.
  5. Frame removal triggers OnRenderFrameRemoved, which erases the map entry and frees the provider object.
  6. The attacker sprays the heap to reclaim the freed memory with controlled data, then the worker thread uses the dangling pointer to call GetCachedRules, causing an atomic increment on attacker-controlled 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.

A use-after-free happens when a program keeps a pointer to memory after that memory has been freed, and then uses it again. Here, a background thread reads a pointer to an object that the main thread has already deleted, so the background thread ends up using memory that may now contain attacker-controlled data. This can let an attacker corrupt memory and possibly run their own code.

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.