Closed Bug 1854669 (CVE-2023-6860) Opened 9 months ago Closed 7 months ago

VideoBridge allows any content process to use any texture produced by remote decoder

Categories

(Core :: Audio/Video, defect)

defect

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox-esr115 121+ fixed
firefox120 --- wontfix
firefox121 + fixed
firefox122 + fixed

People

(Reporter: aosmond, Assigned: aosmond)

Details

(Keywords: csectype-sandbox-escape, sec-moderate, Whiteboard: [adv-main121+][adv-esr115.6+])

Attachments

(2 files, 1 obsolete file)

The compositor process uses SurfaceDescriptorRemoteDecoder, which contains a source ID and handle, to link a TextureHost created by a helper process (RDD, media utility, GPU process) to a TextureHost created by a content process during display list building:
https://searchfox.org/mozilla-central/rev/48b6992e03fa66f77ac9688ba61c95d31a451bc1/gfx/layers/composite/TextureHost.cpp#340

As you can follow from the code above, we just accept the opaque source/handle without any additional validation.

The source ID is merely which utility process created it, not the process that requested it. We decide which VideoBridgeParent that maps to here:
https://searchfox.org/mozilla-central/rev/48b6992e03fa66f77ac9688ba61c95d31a451bc1/gfx/layers/composite/GPUVideoTextureHost.cpp#41

The handle is the unique ID associated with that particular texture for that utility process:
https://searchfox.org/mozilla-central/rev/077fc34d03b85b09add26b5f99f1a3a3a72c8720/gfx/layers/composite/GPUVideoTextureHost.cpp#47

Nothing stops a compromised content process from using an arbitrary ID. In fact, because we race between the content process creating its own wrapper texture and the utility process creating the actual texture, we gracefully handle the scenario where there is no texture available yet to map to.

We should have some sort of token validation here, where the utility process generates namespace IDs for each content process, shares that with the compositor process, and only allows wrapper textures created by the owning content process to wrap the actual texture from the VideoBridge. This would be similar to how we validate graphics resources in the WebRender display pipeline.

I don't have any POC using this as an exploit but in theory, it wouldn't be that hard to construct after escaping the content process sandbox. What one could do with this, I'm not sure, but I'm looking at using the same infrastructure with WebGL to avoid copies into the content process and back into the compositor process when using GPUVideoImage for CPU memory backed textures. This is showing up in profiles with WebCodecs. In theory this will also be useful for DrawTargetWebgl / accelerated canvas (and D2D canvas if necessary/desired). Expanding the attack surface without fixing this is probably not good.

I haven't checked, but it is possible there is a similar bug on the audio side.

Severity: -- → S2

This isn't a problem on the readback path directly into the content process because it can only access textures it created:
https://searchfox.org/mozilla-central/rev/48b6992e03fa66f77ac9688ba61c95d31a451bc1/dom/media/ipc/RemoteDecoderManagerParent.cpp#285

Does comment 3 contradict comment 0 where you said

Nothing stops a compromised content process from using an arbitrary ID.

Or is comment 3 limited to just that one kind of use, and other APIs are not policed in the same way?

Is there more to a texture than just the graphics that get displayed (or audio that could be heard)? polluting images and such would be cross-origin data sharing trouble but not a Firefox compromise. But if there are other values associated that could be changed using the same ID then maybe that could get another process to do something bad.

Flags: needinfo?(aosmond)
Severity: S2 → S3

(In reply to Daniel Veditz [:dveditz] from comment #4)

Does comment 3 contradict comment 0 where you said

Nothing stops a compromised content process from using an arbitrary ID.

Or is comment 3 limited to just that one kind of use, and other APIs are not policed in the same way?

Is there more to a texture than just the graphics that get displayed (or audio that could be heard)? polluting images and such would be cross-origin data sharing trouble but not a Firefox compromise. But if there are other values associated that could be changed using the same ID then maybe that could get another process to do something bad.

The readback path is used in the content process, so comment 3 is referring to the fact that an arbitrary content process cannot readback a GPUVideoImage created for another content process.

Right now then, an arbitrary content process can only use an arbitrary GPUVideoImage on the rendering pipeline. I have patches that would like to allow canvas replays and WebGL in the compositor process to access an arbitrary GPUVideoImage, but it needs to be accessed controlled. Hence why I filed this bug first.

Flags: needinfo?(aosmond)
Group: gfx-core-security
Group: media-core-security
Attached file Bug 1854669.

Andrew said that this could potentially allow a content process to inject video as though it was coming from another content process (but not read what the other process was doing), if the attacker page has already taken over the content process. So you could be watching a video on YouTube, but suddenly there's (extra?) video from the attacker page. That's sort of like a URL bar spoof, but the attacker can't read anything, so not really. YouTube probably isn't a great example because people probably don't have a ton of expectation for the validity of anything they watch (hopefully) but I guess if you are watching a video on a government webpage and suddenly it starts telling you to buy gift cards or whatever that might be confusing.

They couldn't exploit the audio this way, since it has a different codepath. But yes, in theory an exploited content process could display content intended for another unexploited content process.

Dan, does sec-moderate seem reasonable for this bug or should it be higher? Thanks.

Flags: needinfo?(dveditz)

wfm. It's not really a sandbox "escape", more like a leak.

Flags: needinfo?(dveditz)
Keywords: sec-moderate
Group: gfx-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch

The patch landed in nightly and beta is affected.
:aosmond, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox121 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(aosmond)
Attached file Bug 1854669. (obsolete) —
Attachment #9367320 - Flags: approval-mozilla-beta?

Comment on attachment 9367320 [details]
Bug 1854669.

Beta/Release Uplift Approval Request

  • User impact if declined: Sec issue
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It touches a lot of files but it is almost entirely boilerplate. The actual changes are trivial.
  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(aosmond)
Attachment #9365224 - Flags: approval-mozilla-beta?

Comment on attachment 9365224 [details]
Bug 1854669.

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Sec issue
  • User impact if declined:
  • Fix Landed on Version: 122
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Mostly boilerplate changes, actual functional change is trivial to enforce access restrictions
Attachment #9365224 - Flags: approval-mozilla-esr115?
Attachment #9367320 - Attachment is obsolete: true
Attachment #9367320 - Flags: approval-mozilla-beta?

Comment on attachment 9365224 [details]
Bug 1854669.

Approved for 121.0b9 and 115.6esr.

Attachment #9365224 - Flags: approval-mozilla-esr115?
Attachment #9365224 - Flags: approval-mozilla-esr115+
Attachment #9365224 - Flags: approval-mozilla-beta?
Attachment #9365224 - Flags: approval-mozilla-beta+
QA Whiteboard: [post-critsmash-triage]
Flags: qe-verify-
Whiteboard: [adv-main121+]
Whiteboard: [adv-main121+] → [adv-main121+][adv-esr115.6+]
Attached file advisory.txt
Alias: CVE-2023-6860

Bulk-unhiding security bugs fixed in Firefox 119-121 (Fall 2023). Use "moo-doctrine-subsidy" to filter

Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: