Use after free in Streaming (CVE-2026-106283)
A data race in MirroringGpuFactoriesFactory allows the Main and Video threads to concurrently modify a scoped_refptr without synchronisation, leading to a use-after-free of the GPU context provider. An attacker who compromises the renderer could trigger a GPU context loss to exploit this race, potentially achieving remote code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 6 months
Flapjack, 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 MirroringGpuFactoriesFactory where the Main and Video threads concurrently modify a scoped_refptr without synchronization. This race can be triggered during a GPU context loss, resulting in a Use-After-Free (UAF) of the GPU context provider. Because scoped_refptr uses a raw pointer internally, this UAF completely bypasses MiraclePtr protections.
Affected files:
components/mirroring/service/mirroring_gpu_factories_factory.cccomponents/mirroring/service/mirroring_gpu_factories_factory.hcomponents/mirroring/service/openscreen_session_host.cc
Estimated timestamp from git blame: 2026-02-27
Summary
A critical thread-safety vulnerability exists in MirroringGpuFactoriesFactory within the Mirroring Service (utility process). The class shares state between the Main thread and the Video encoding thread without explicit synchronization. A data race on a scoped_refptr can result in a Use-After-Free (UAF) condition that explicitly bypasses MiraclePtr (BackupRefPtr) protections, potentially leading to Remote Code Execution (RCE).
Vulnerability Details
In MirroringGpuFactoriesFactory, two member variables are accessed concurrently by different threads:
context_provider_(ascoped_refptr<viz::ContextProviderCommandBuffer>)instance_(astd::unique_ptr<media::MojoGpuVideoAcceleratorFactories>)
During initialization, GetInstance() runs on the Main thread (kMain). It instantiates the context_provider_ and then posts a task (BindOnVideoThread) to the Video thread (kVideo). Because PostTask is non-blocking, GetInstance() immediately continues executing on the Main thread.
If the GPU context is lost or the bind fails, the Video thread immediately executes OnContextLost(), which calls ResetGpuFactories(). Inside ResetGpuFactories(), the Video thread clears both members:
instance_.reset();
if (context_provider_) {
context_provider_->RemoveObserver(this);
context_provider_ = nullptr; // Data race here!
}
Meanwhile, the Main thread is still inside GetInstance(), attempting to pass the context_provider_ by value into the MojoCodecFactoryDefault constructor. To do this, it invokes the scoped_refptr copy constructor, which reads the internal raw pointer.
Because there is no base::Lock or sequence checking protecting these members, a C++ data race occurs. The Video thread can nullify the scoped_refptr and destroy the underlying object at the exact moment the Main thread is reading the internal raw pointer to increment its reference count. The Main thread will end up wrapping a dangling pointer, creating a Use-After-Free.
MiraclePtr Bypass
This vulnerability bypasses MiraclePtr (BackupRefPtr). Chromium's scoped_refptr implementation uses a raw C++ pointer internally (T* ptr_) which is explicitly annotated with RAW_PTR_EXCLUSION. Because the data race occurs directly on the scoped_refptr's internal pointer, the memory access is not guarded by MiraclePtr quarantine checks.
Potential Steps to Trigger
Note: These are suggested steps. Our tooling agent does not yet have the ability to run code and provide a working proof-of-concept.
- An attacker compromises a renderer process or uses malicious Web APIs (e.g., Presentation API) to initiate a mirroring session.
- The browser process launches the Mirroring Service utility process, creating an
OpenscreenSessionHost. - The host requests hardware encoding, invoking
MirroringGpuFactoriesFactory::GetInstance()on the Main thread. GetInstance()creates the context provider and posts the binding task to the Video thread.- The attacker intentionally triggers a GPU context loss (e.g., by exhausting GPU memory or sending malformed WebGL commands from the compromised renderer).
- The context loss forces the Video thread to immediately fail the bind operation and call
ResetGpuFactories(), destroying the context provider. - Simultaneously, the Main thread attempts to copy the
scoped_refptrto initialize the codec factory, catching the exact race window where the object is being freed. - The Main thread passes the dangling pointer to the video encoder, triggering the UAF when the encoder later attempts to use the freed context provider.
Suggested Fix
Shared members in MirroringGpuFactoriesFactory (specifically context_provider_ and instance_) must be protected.
- Option 1: Introduce a
base::Lockto synchronize all read and write access tocontext_provider_andinstance_across the Main and Video threads. - Option 2: Refactor the initialization sequence so that all creation, access, and destruction of these GPU factory members happens strictly on a single sequence (e.g., the Video thread), returning a
SafeRefor thread-safe interface to the Main thread.
Evaluated with Chrome root at commit: 09ec9e7cc4d24823d20b6d37cf3d282734f6bf0f
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.
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 shared member variables context_provider_ and instance_ are accessed by the Main and Video threads without any locking or sequence checking, causing a data race on the scoped_refptr.
Impact
A compromised renderer could trigger a use-after-free that bypasses MiraclePtr protections, potentially leading to remote code execution.
What the attacker needed
Compromised renderer process; ability to trigger GPU context loss
The fix
The shared members should be protected by introducing a lock or by refactoring so that all access happens on a single sequence.
How it was found
- An attacker compromises a renderer process or uses malicious Web APIs to initiate a mirroring session.
- The browser process launches the Mirroring Service utility process, creating an OpenscreenSessionHost.
- The host requests hardware encoding, invoking MirroringGpuFactoriesFactory::GetInstance() on the Main thread.
- GetInstance() creates the context provider and posts the binding task to the Video thread.
- The attacker intentionally triggers a GPU context loss.
- The context loss forces the Video thread to call ResetGpuFactories(), destroying the context provider, while the Main thread attempts to copy the scoped_refptr, 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.
This report describes a bug where two parts of a program (threads) try to use and free the same piece of memory at the same time without coordination. One thread frees the memory while the other is still using it, which can crash the program or let an attacker run their own code. The bug is in a component that handles screen mirroring, and an attacker who already controls a web page could trigger it.
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.