Closed Bug 1846687 (CVE-2023-4573) Opened 2 years ago Closed 1 years ago

use-after-free in mStream

Categories

(Core :: Graphics, defect, P1)

defect

Tracking

()

RESOLVED FIXED
118 Branch
Tracking Status
firefox-esr102 117+ fixed
firefox-esr115 117+ fixed
firefox116 --- wontfix
firefox117 + fixed
firefox118 + fixed

People

(Reporter: sonakkbi, Assigned: bobowen)

Details

(5 keywords, Whiteboard: [reporter-external] [client-bounty-form] [verif?] [adv-main117+] [adv-esr115.2+] [adv-esr102.15+])

Attachments

(8 files)

Attached file ASAN.txt

While graphics rendering, |mStream| is used to receive rendering data1. |mStream| could be destroyed when initialized. However, there is no check in init function2 and it could initialize twice. This could lead to use-after-free when |mStream| is destroyed during accessing rendering data.

REPRODUCE
Operating System: All
1.apply *patch1.diff and patch2.diff
2.visit index.html

*: patch1.diff is emulating a compromised content process. patch2.diff is patching the Graphic Process to improve the success rate (just for reproducing easily)

Crash State: see asan file

Flags: sec-bounty?
Attached file index.html
Attached patch patch1.diffSplinter Review
Attached patch patch2.diffSplinter Review
Group: firefox-core-security → gfx-core-security
Component: Security → Graphics
Product: Firefox → Core
Keywords: testcase

I was unable to reproduce this on Linux.

I'm sorry to hear that it's not reproducible on Linux. The vulnerability itself still exists in Linux, but I overlooked that the function used in the patch.diff is not called in Linux. Could you test it on Windows?

(In reply to sonakkbi from comment #5)

I'm sorry to hear that it's not reproducible on Linux. The vulnerability itself still exists in Linux, but I overlooked that the function used in the patch.diff is not called in Linux. Could you test it on Windows?

I did modify the patch to work on Linux, but perhaps I missed something. I was trying to get a rr/Pernosco session (Linux only) to hopefully save them some work. I'll leave it do a developer with more knowledge of this component to try.

Attached file svg.html

Tyson, it might be possible to reproduce this with this test case on Linux instead of the attached one.

Flags: needinfo?(twsmith)

Bob, can you take a look at this?

Assignee: nobody → bobowencode
Flags: needinfo?(bobowencode)

(In reply to Jeff Muizelaar [:jrmuizel] from comment #7)

Tyson, it might be possible to reproduce this with this test case on Linux instead of the attached one.

I'd be happy to give it a try.

I also had issues with the patches not applying cleanly and targeting Windows. Could you have a look at them as well please?

Flags: needinfo?(twsmith) → needinfo?(jmuizelaar)

(In reply to Jeff Muizelaar [:jrmuizel] from comment #8)

Bob, can you take a look at this?

The patches were a bit mangled for me as well, so I applied them by hand.
I could see the issue either way from the description.
Pretty sure it will only affect Windows.

Severity: -- → S2
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(bobowencode)
Priority: -- → P1

(In reply to Bob Owen (:bobowen) from comment #10)

(In reply to Jeff Muizelaar [:jrmuizel] from comment #8)

Bob, can you take a look at this?

The patches were a bit mangled for me as well, so I applied them by hand.
I could see the issue either way from the description.
Pretty sure it will only affect Windows.

The crash I was getting turned out to be in webrender code and not a UAF.
By modifying the patch a bit I think I've now reproduced the issue raised here.
Once I've got something for this, I'll see if I can still reproduce the crash in webrender and file a separate bug.

Here's my reproduction patch that I've rolled into one.

Flags: needinfo?(jmuizelaar)

Comment on attachment 9347656 [details]
Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel!

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: Assuming they knew it was a sec bug, working out the problem from the patch is probably fairly easy, but not trivial.
    However, there isn't a known exploit of the vulnerability currently.
  • Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
  • Which older supported branches are affected by this flaw?: All
  • If not all supported branches, which bug introduced the flaw?: None
  • Do you have backports for the affected branches?: Yes
  • If not, how different, hard to create, and risky will they be?: (Patch grafts onto all required branches.)
  • How likely is this patch to cause regressions; how much testing does it need?: Unlikely, it adds an extra check that should never be triggered without an exploited content process.
  • Is Android affected?: No
Attachment #9347656 - Flags: sec-approval?

Comment on attachment 9347656 [details]
Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel!

Approved to land and uplift

Attachment #9347656 - Flags: sec-approval? → sec-approval+
Pushed by bobowencode@gmail.com: https://hg.mozilla.org/integration/autoland/rev/d548ab29d331 Don't allow CanvasTranslator to be initialized twice. r=jrmuizel

Comment on attachment 9347656 [details]
Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel!

Beta/Release Uplift Approval Request

  • User impact if declined: Vulnerability that can be triggered in the GPU process from a compromised content process, which could potentially be used as part of a sandbox escape.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • 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): Simple is null check added that should never fail without a compromised content process.
  • String changes made/needed: None
  • Is Android affected?: No
Attachment #9347656 - Flags: approval-mozilla-release?
Attachment #9347656 - Flags: approval-mozilla-beta?

Comment on attachment 9347656 [details]
Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel!

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: sec-high
  • User impact if declined: Vulnerability that can be triggered in the GPU process from a compromised content process, which could potentially be used as part of a sandbox escape.
  • Fix Landed on Version: 118
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Simple is null check added that should never fail without a compromised content process.
Attachment #9347656 - Flags: approval-mozilla-esr115?
Status: ASSIGNED → RESOLVED
Closed: 1 years ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch

Comment on attachment 9347656 [details]
Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel!

Approved for 117.0b6

Attachment #9347656 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9347656 [details]
Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel!

This will be roll out with 117 and will not be included in the next 116 dot release. If for any reason we do need to take this in the dot release, please feel free to NI me.

Attachment #9347656 - Flags: approval-mozilla-release? → approval-mozilla-release-
Group: gfx-core-security → core-security-release

Comment on attachment 9347656 [details]
Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel!

Approved for 115.2esr and 102.15esr.

Attachment #9347656 - Flags: approval-mozilla-esr115?
Attachment #9347656 - Flags: approval-mozilla-esr115+
Attachment #9347656 - Flags: approval-mozilla-esr102+
Flags: sec-bounty? → sec-bounty+
QA Whiteboard: [post-critsmash-triage]
Flags: qe-verify-
Whiteboard: [reporter-external] [client-bounty-form] [verif?] → [reporter-external] [client-bounty-form] [verif?] [adv-main117+] [adv-esr115.2+] [adv-esr102.15+]
Group: core-security-release
Alias: CVE-2023-4573
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: