Incomplete cleanup in GetUserMedia (CVE-2026-79265)
A state machine bug in MediaStreamManager leaves a capture request stuck in a pending state after a failed source change, so later stop requests skip closing the hardware while still removing all privacy indicators. A compromised renderer could keep receiving captured frames without the user's knowledge.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A state machine inconsistency in MediaStreamManager allows media capture to continue silently after being stopped if a prior source change request failed. The failure leaves the request stuck in a pending state, causing subsequent stop requests to bypass hardware closure while still removing all UI privacy indicators.
Affected files:
content/browser/renderer_host/media/media_stream_manager.cc
Estimated timestamp from git blame: Unknown (Google3 checkout)
Summary
A state machine bug exists in MediaStreamManager that can cause media capture devices (such as screen sharing) to remain active in the background after the user believes they have stopped the capture.
If a user is sharing their screen and initiates a source change (e.g., clicking "Share this tab instead"), but then cancels the media picker prompt, the internal state of the capture session becomes corrupted. Subsequently, if the user or the web application attempts to stop the stream, the browser successfully removes all UI privacy indicators (like the sharing bubble and tab icon) but completely bypasses the logic to stop the underlying hardware capture. A compromised renderer process could theoretically continue receiving captured frames indefinitely without the user's knowledge.
Technical Details
When an active capture session undergoes a source change, MediaStreamManager::ChangeMediaStreamSourceFromBrowser is invoked. This updates the underlying DeviceRequest type to blink::MEDIA_DEVICE_UPDATE and sets the request state to MEDIA_REQUEST_STATE_PENDING_APPROVAL while waiting for the user to select a new tab in the media picker.
If the user cancels the picker, MediaStreamManager::FinalizeRequestFailed is called. For MEDIA_DEVICE_UPDATE requests, this function contains a logic error:
void MediaStreamManager::FinalizeRequestFailed(
DeviceRequests::const_iterator request_it,
MediaStreamRequestResult result) {
// ...
switch (request->request_type()) {
// ...
case blink::MEDIA_DEVICE_UPDATE: {
// Fail to change capture source, keep everything unchanged and
// bring the previous shared tab to the front.
// ...
return; // Early return!
}
}
DeleteRequest(request_it);
}
The early return allows the original stream to survive the cancellation, but it fails to revert the DeviceRequest state back to MEDIA_REQUEST_STATE_DONE. The state remains stuck at MEDIA_REQUEST_STATE_PENDING_APPROVAL.
Later, when the stream is stopped (e.g., the user clicks "Stop sharing", or the tab is closed), MediaStreamManager::CancelRequest is called to tear down the capture. It iterates over the active devices and checks their state:
// content/browser/renderer_host/media/media_stream_manager.cc
void MediaStreamManager::CancelRequest(...) {
// ...
for (...) {
const MediaRequestState state = request->state(device.type);
if (state != MEDIA_REQUEST_STATE_OPENING &&
state != MEDIA_REQUEST_STATE_DONE) {
continue; // Skips CloseDevice!
}
CloseDevice(device.type, device.session_id());
}
// ...
DeleteRequest(request_it);
}
Because the state is stuck at MEDIA_REQUEST_STATE_PENDING_APPROVAL, the condition evaluates to true, and continue; is executed. The critical call to CloseDevice is skipped, meaning VideoCaptureManager::Close is never invoked, and the hardware continues capturing.
Finally, CancelRequest calls DeleteRequest(request_it), which destroys the DeviceRequest and its MediaStreamUIProxy. This removes all user-facing privacy indicators. However, the Mojo IPC (VideoCaptureHost) remains open, allowing a compromised renderer to silently exfiltrate the continuous stream of captured frames.
Potential Exploit Steps
Note: These are suggested steps based on static analysis.
- An attacker gains code execution in a renderer process.
- The attacker triggers a legitimate screen capture request (
getDisplayMedia()), which the user approves. - The attacker prompts the user to change the shared tab (e.g., by presenting a confusing UI that leads the user to click the browser's "Share this tab instead" button but then cancel the resulting prompt).
- The user cancels the source change prompt. The state is now corrupted.
- The attacker's script calls
track.stop(), or the user clicks "Stop sharing". - The browser destroys the UI indicators, making the user think capture has stopped.
- The compromised renderer ignores standard IPC stop messages, keeps the
VideoCaptureHostMojo pipe open, and continues to silently receive screen frames.
Suggested Fix
In MediaStreamManager::FinalizeRequestFailed, within the blink::MEDIA_DEVICE_UPDATE switch case, explicitly reset the request state to MEDIA_REQUEST_STATE_DONE for the active devices before executing the early return.
case blink::MEDIA_DEVICE_UPDATE: {
// Fail to change capture source, keep everything unchanged and
// bring the previous shared tab to the front.
request->SetState(request->audio_type(), MEDIA_REQUEST_STATE_DONE);
request->SetState(request->video_type(), MEDIA_REQUEST_STATE_DONE);
// ...
return;
}
Evaluated with Chrome root at commit: 65b3256311f3ab6fb9870eaa522de7e6dd2663bb
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 early return in FinalizeRequestFailed for a failed source change does not reset the request state back to done, leaving it stuck in pending approval so CancelRequest skips CloseDevice.
Impact
A compromised renderer could theoretically continue receiving captured frames indefinitely without the user's knowledge, though the report notes these are suggested steps based on static analysis.
What the attacker needed
Code execution in a renderer process; user approves screen capture; user cancels a source change prompt
The fix
The fix should explicitly reset the request state to done for the active devices before the early return in FinalizeRequestFailed.
How it was found
- An attacker gains code execution in a renderer process.
- The attacker triggers a legitimate screen capture request, which the user approves.
- The attacker prompts the user to change the shared tab and then cancel the resulting prompt.
- The user cancels the source change prompt, corrupting the state.
- The attacker's script calls track.stop(), or the user clicks stop sharing.
- The browser destroys the UI indicators, and the compromised renderer keeps the capture pipe open to receive frames.
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 you share your screen, the browser keeps a note of whether the sharing is active or waiting for you to pick a window. If you try to switch to a different tab but then cancel, that note gets stuck on 'waiting'. Later, when you press stop, the browser hides the sharing icons but forgets to actually turn off the screen capture, so a malicious page could keep seeing your screen.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.