Inappropriate implementation in Media (CVE-2026-17846)
A GPU resource destruction task bypasses the GPU scheduler and runs without making the correct GL context current, so glDeleteTextures can act on whatever context was last active on the thread. An attacker could potentially delete textures belonging to another origin's WebGL context.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: SharedImageReadLock uses base::OnTaskRunnerDeleter to destroy VideoImageRepresentation on the GPU-main thread. Because these tasks bypass the GPU Scheduler, they execute without calling MakeCurrent on the thread-local GL context. This can allow glDeleteTextures to run on an unrelated victim context that was left active on the thread, potentially causing cross-origin texture deletion.
Affected files:
media/base/win/mf_helpers.ccmedia/base/win/mf_helpers.h
Estimated timestamp from git blame: 2026-04-24
Root Cause Analysis
In Chromium's Windows hardware-encode video paths, SharedImageReadLock (defined in media/base/win/mf_helpers.h) wraps a gpu::VideoImageRepresentation and its ScopedReadAccess to manage their lifetimes when passed across threads. To guarantee that these GPU resources are destroyed on the correct thread, SharedImageReadLock utilizes base::OnTaskRunnerDeleter bound to the default sequenced task runner at construction time:
// media/base/win/mf_helpers.cc
SharedImageReadLock::SharedImageReadLock(
std::unique_ptr<gpu::VideoImageRepresentation> representation,
std::unique_ptr<gpu::VideoImageRepresentation::ScopedReadAccess>
scoped_read_access,
scoped_refptr<VideoFrame> frame)
: representation_(representation.release(),
base::OnTaskRunnerDeleter(
base::SequencedTaskRunner::GetCurrentDefault())),
scoped_read_access_(scoped_read_access.release(),
base::OnTaskRunnerDeleter(
base::SequencedTaskRunner::GetCurrentDefault())),
frame_(std::move(frame)) {}
These locks are constructed on the GPU-main thread (e.g., inside GenerateResourceOnSyncTokenReleased). Thus, OnTaskRunnerDeleter schedules destruction on the GPU-main thread via DeleteSoon tasks.
When OnTaskRunnerDeleter executes, it posts a raw non-nestable task (DeleteSoon) to the GPU-main thread's message loop. This task runs directly as a standard base::OnceClosure and bypasses the GPU Scheduler completely, performing no MakeCurrent call.
The Vulnerable Destruction Path
When the associated IMFSample (for MediaFoundationVideoEncodeAccelerator) is released on a background thread, the SharedImageReadLock COM object is destroyed, posting the raw DeleteSoon tasks to the GPU-main thread.
When the deletion tasks run on the GPU-main thread:
~SharedImageRepresentation()is called on theVideoImageRepresentation.SharedImageManager::OnRepresentationDestroyed(...)is invoked and releases the backing reference. If the renderer has already destroyed its client-side reference, the backing's reference count drops to 0.- The backing (e.g.,
GLTextureImageBacking) is destroyed synchronously. GLTextureImageBacking::~GLTextureImageBacking()destroys itsGLTextureHolderelements.GLTextureHolder::~GLTextureHolder()releases the reference to the underlyinggles2::TexturePassthrough(if using the passthrough command decoder).TexturePassthrough::~TexturePassthrough()checkshave_context_(which istrueunder normal conditions) and issues a synchronousglDeleteTextures(1, &owned_service_id_)call.
Because this raw deletion task runs without a MakeCurrent call, glDeleteTextures resolves through the thread-local GL bindings (via g_current_gl_context). Since gpu::Scheduler interleaves task dispatching and CommandBufferStub context operations do not release/null-out the bound context on scope destruction, any GL context that was previously bound by the last executed GPU task remains active on the thread.
If a victim context (e.g., a WebGL context from another origin utilizing its own gl::GLShareGroup) was the last context active on the GPU-main thread, glDeleteTextures will be dispatched directly into that victim's share group namespace, deleting active victim textures matching the target ID.
Potential Attack Scenario
(Note: These are potential steps; our tooling does not currently run code to verify with a functional PoC)
- Grooming: A compromised renderer advances the GL name allocator to align texture names by allocating multiple temporary GLES2 SharedImages.
- Setup: The attacker creates a target SharedImage
Mwith service IDNand sends anEncode()request to trigger the construction of aSharedImageReadLockinside the GPU process. - Release: The attacker immediately destroys their client-side reference to
M(refcount remains 1, pinned only by theSharedImageReadLock). - Context Swapping: The attacker forces a victim WebGL context (from another origin) to flush GL tasks, leaving the victim's GL context current on the GPU-main thread.
- Trigger: The encoder completes processing and releases the
IMFSampleon a background thread, posting theDeleteSoontasks to the GPU-main thread. This triggersglDeleteTextures(1, &N)inside the active victim context, deleting the victim's texture $N$.
Suggested Remediation
Instead of using base::OnTaskRunnerDeleter which posts raw contextless deletion tasks, the destruction of VideoImageRepresentation and ScopedReadAccess should be performed via a custom wrapper task that explicitly ensures the appropriate GL context is made current prior to releasing the pointers.
For example, we can introduce a helper function on the GPU thread to destroy these objects:
void DestroySharedImageResourcesOnGpuThread(
std::unique_ptr<gpu::VideoImageRepresentation> representation,
std::unique_ptr<gpu::VideoImageRepresentation::ScopedReadAccess> scoped_read_access,
scoped_refptr<gpu::SharedContextState> context_state) {
if (context_state && context_state->MakeCurrent(nullptr)) {
scoped_read_access.reset();
representation.reset();
} else {
// If context cannot be made current, mark as context lost to prevent unsafe deletion
if (scoped_read_access) {
// ...
}
}
}
And invoke this on the GPU task runner when the COM object is released, rather than utilizing the raw OnTaskRunnerDeleter bindings.
Evaluated with Chrome root at commit: fb72408a8493c46bc75fae1c70d03daec96b3040
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.
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 use of base::OnTaskRunnerDeleter posts a raw deletion task that bypasses the GPU scheduler and does not call MakeCurrent, so GL deletion commands execute in whatever context happens to be current on the thread.
Impact
An attacker could potentially delete textures belonging to another origin's WebGL context, but the report notes that these are potential steps and no functional proof-of-concept was run.
What the attacker needed
Compromised renderer; ability to trigger hardware-encode video path; victim WebGL context from another origin
The fix
The destruction of VideoImageRepresentation and ScopedReadAccess should be performed via a custom wrapper task that explicitly ensures the appropriate GL context is made current before releasing the pointers.
How it was found
- Groom the GL name allocator by allocating temporary GLES2 SharedImages.
- Create a target SharedImage and send an Encode request to construct a SharedImageReadLock.
- Destroy the client-side reference to the target SharedImage.
- Force a victim WebGL context from another origin to flush GL tasks, leaving its context current.
- Release the IMFSample on a background thread to post the deletion tasks.
- The deletion tasks run on the GPU-main thread and call glDeleteTextures in the victim's context.
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.
When a program uses a graphics card, it must tell the system which 'drawing board' (context) it is using before giving commands. Here, a cleanup task forgot to do that, so a delete command could hit the wrong drawing board. That might let one website erase another website's graphics data.
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.