Closed Bug 1902307 (CVE-2024-7519) Opened 1 year ago Closed 1 year ago

out-of-bound access in ShmemTextureReadLock::ReadUnlock

Categories

(Core :: Graphics, defect)

defect

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox-esr115 129+ fixed
firefox-esr128 129+ fixed
firefox127 --- wontfix
firefox128 --- wontfix
firefox129 + fixed
firefox130 + fixed

People

(Reporter: dalmurino, Assigned: nical)

References

Details

(4 keywords, Whiteboard: [client-bounty-form][adv-main129+][adv-ESR115.14+][adv-ESR128.1+])

Attachments

(4 files)

Attached file patch.diff

In |ReadUnlock()|, |mShmemSection|'s memory region is accessed without validation of offset1. An attacker can achieve an out of bound decrement using this vulnerability. It can manipulate the field of adjacent objects (e.g., length, Reference count, etc.) and there are already many public exploits related to this.

I attempted to get ASAN report but sadly, it didn't work. I guess that ASAN doesn't recognize |PR_ATOMIC_DECREMENT| macro. Therefore, I explain out of bound decrement with a callstack and some logs.
With the attached file, you can see that |info->readCount|, the argument of |PR_ATOMIC_DECREMENT|, is out of the memory region of |mShmemSection| and the destination is in another memory region.

Besides |ReadUnlock()|, the constructors of |ReadLock|, |GetReadCount| and |ShmemTextureReadLock| also have a similar pattern. Though I've only found the way to |ReadUnlock()|, I suggest adding some checks for the offset.

REPRODUCTION CASE
Type of vulnerbility: GPU Process

To reproduce crash, please follow these steps:
Apply patch.diff
Open https://webrtc.github.io/samples/src/content/capture/video-pc/ in browser
// patch.diff emulates a compromised content process

Even if running this Poc on the ASAN build, it is unlikely that a crash or ASAN report will occur. I recommend using a debugger to identify the point where the vulnerability occurs.

Flags: sec-bounty?
Attached file readme.txt
Group: firefox-core-security → gfx-core-security
Status: UNCONFIRMED → NEW
Component: Security → Graphics
Ever confirmed: true
Product: Firefox → Core
Summary: out-of-bound access in ReadUnlock → out-of-bound access in ShmemTextureReadLock::ReadUnlock

I think this qualifies as a sandbox escape.

See Also: → 1533918
Blocks: gfx-triage
Assignee: nobody → nical.bugzilla
No longer blocks: gfx-triage

The severity field is not set for this bug.
:bhood, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(bhood)
Severity: -- → S2
Flags: needinfo?(bhood)

Comment on attachment 9410512 [details]
Bug 1902307 - Better validate shm sections. r=#gfx-reviewers

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: The attacker needs to compromise the content process first. See comment 0 for more details about what the attacker could do then.
  • 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 branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: all of them
  • If not all supported branches, which bug introduced the flaw?: None
  • Do you have backports for the affected branches?: No
  • If not, how different, hard to create, and risky will they be?: The patch applied and builds on beta and central
  • How likely is this patch to cause regressions; how much testing does it need?: Unlikely
  • Is the patch ready to land after security approval is given?: Yes
  • Is Android affected?: Yes
Attachment #9410512 - Flags: sec-approval?

Comment on attachment 9410512 [details]
Bug 1902307 - Better validate shm sections. r=#gfx-reviewers

Beta/Release Uplift Approval Request

  • User impact if declined: Security vulnerability
  • Is this code covered by automated tests?: No
  • 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): It is a rather simple change where we use two separate types to represent the untrusted and the validated version of something with simple validation between the two.
  • String changes made/needed: None
  • Is Android affected?: Yes
Attachment #9410512 - Flags: approval-mozilla-beta?
Attachment #9410512 - Flags: approval-mozilla-esr128?
Attachment #9410512 - Flags: approval-mozilla-esr115?

Comment on attachment 9410512 [details]
Bug 1902307 - Better validate shm sections. r=#gfx-reviewers

sec-approval+ = dveditz, and a+ for early beta uplift.

Attachment #9410512 - Flags: sec-approval?
Attachment #9410512 - Flags: sec-approval+
Attachment #9410512 - Flags: approval-mozilla-beta?
Attachment #9410512 - Flags: approval-mozilla-beta+
Pushed by nsilva@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/23d2c44dbc20 Better validate shm sections. r=gfx-reviewers,lsalzman
Group: gfx-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Pushed by dmeehan@mozilla.com: https://hg.mozilla.org/releases/mozilla-beta/rev/483295097353 Better validate shm sections. r=gfx-reviewers,lsalzman, r=dmeehan
QA Whiteboard: [post-critsmash-triage]
Flags: qe-verify-

Comment on attachment 9410512 [details]
Bug 1902307 - Better validate shm sections. r=#gfx-reviewers

Approved for 115.14esr

Attachment #9410512 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+

Comment on attachment 9410512 [details]
Bug 1902307 - Better validate shm sections. r=#gfx-reviewers

Approved for 128.1esr.

Attachment #9410512 - Flags: approval-mozilla-esr128? → approval-mozilla-esr128+
Flags: sec-bounty? → sec-bounty+
Whiteboard: [client-bounty-form] → [client-bounty-form][adv-main129+]
Whiteboard: [client-bounty-form][adv-main129+] → [client-bounty-form][adv-main129+][adv-ESR115.14+]
Whiteboard: [client-bounty-form][adv-main129+][adv-ESR115.14+] → [client-bounty-form][adv-main129+][adv-ESR115.14+][adv-ESR128.1+]
Attached file advisory.txt
Alias: CVE-2024-7519
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: