Closed Bug 1871109 (CVE-2024-4765) Opened 1 year ago Closed 10 months ago

generateHash in Manifest.sys.mjs should use sha256 or be removed

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox125 --- wontfix
firefox126 + fixed
firefox127 + fixed

People

(Reporter: keeler, Assigned: linuohan.fred22)

Details

(Keywords: sec-moderate, Whiteboard: [adv-main126+])

Attachments

(2 files)

It's unclear that Manifest.sys.mjs is still used, but if it is, then generateHash should be using a secure hash like sha256. If it isn't, then it should be removed.

Hey Peter, we (the security engineering team) are working on removing deprecated hashes from the Firefox code base. I wanted to check in and ask if you could prioritize this bug? Could you maybe even provide a timeline?

We imagine the change shouldn't be too complicated. We could imagine that replacing md5 with e.g. sha256 could work, though we are happy to discuss options with you and the team. Thank you!

Flags: needinfo?(peterv)

It turns out this is still used on mobile. Using a different hash for writing new files shouldn't be hard, but it seems we need to keep reading the existing files. That means being able to generate an MD5 hash based on a URL so we can find the existing files as fallback, if there is no file found based on the new hash.

I don't know who has time to work on that.

Flags: needinfo?(peterv) → needinfo?(htsai)

Thanks Peter. I am currently exploring the solution with Christoph.

Flags: needinfo?(htsai)

I should have filed this as a security bug originally. The issue here is that the data being hashed is controlled by the attacker, and as far as I can tell, that value is where we store the manifest file. If an attacker can get a user to add a manifest for a url where the md5 hash collides with the md5 hash of an existing manifest url, presumably the existing manifest file gets overwritten. The next time that manifest is read, it's all attacker-controlled data. I'm assuming that can lead to the attacker doing whatever they want in the context of that existing manifest (steal cookies? login credentials? private data?)

Group: dom-core-security
Keywords: sec-moderate

Hey Peter, do you know where on mobile is this still used?

Assignee: nobody → nuli
Status: NEW → ASSIGNED
Flags: needinfo?(peterv)
Pushed by jschanck@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d2adc352f591 generateHash in Manifest.sys.mjs should use sha256 r=peterv
Group: dom-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch

Nuohan could this get a beta uplift request?

Flags: needinfo?(nuli)

Comment on attachment 9391775 [details]
Bug 1871109 - generateHash in Manifest.sys.mjs should use sha256 r=jschanck

Beta/Release Uplift Approval Request

  • User impact if declined: Using MD5 for filenames in Firefox poses a risk as it's vulnerable to collision attacks. This could allow attackers to replace legitimate files with malicious ones. SHA-256 offers stronger collision resistance, therefore switching to SHA-256 reduces this risk.
  • 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: N/A
  • List of other uplifts needed: N/A
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This change is low-risk. It involves computing the SHA-256 hash for each manifest. If a file with the hash exists, we create a new file using SHA-256 and migrate the content. If not, we simply create a new file with SHA-256.
  • String changes made/needed: No
  • Is Android affected?: Yes
Flags: needinfo?(nuli)
Attachment #9391775 - Flags: approval-mozilla-beta?

Comment on attachment 9391775 [details]
Bug 1871109 - generateHash in Manifest.sys.mjs should use sha256 r=jschanck

Approved for 126.0b6

Attachment #9391775 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [post-critsmash-triage]
Flags: qe-verify-
Whiteboard: [adv-main126+]
Alias: CVE-2024-4765
Type: task → defect
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: