Closed Bug 1940804 (CVE-2025-1014) Opened 1 year ago Closed 1 year ago

Using u16::max instead of u16::MAX potentially allows very long certificates

Categories

(Core :: Security: PSM, defect, P1)

defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 135+ fixed
firefox134 --- wontfix
firefox135 + fixed
firefox136 + fixed

People

(Reporter: theemathas, Assigned: keeler)

Details

(Keywords: reporter-external, sec-low, Whiteboard: [psm-assigned][adv-main135+][adv-ESR128.7+])

Attachments

(1 file, 3 external files)

Steps to reproduce:

Sorry if this is the incorrect place to file this report. I found this code which is definitely incorrect: https://github.com/mozilla/gecko-dev/blob/48caa4719ed2c75a2937bcfea9e7326e87846984/security/manager/ssl/cert_storage/src/lib.rs#L1037

In rust, u16::max is a function (it takes two numbers and returns the larger one). On the other hand, u16::MAX is a value equal to 2^16-1. The code in the link is u16::max when the intention was u16::MAX. The code then converts the function pointer into an integer, which results in a large integer. Which means that this validation logic could potentially accept very long certificates as valid.

Actual results:

N/A

Expected results:

N/A

Component: Untriaged → Security: PSM
Product: Firefox → Core
Summary: Using u16::max instead of u16::MAX in gecko-dev potentially allows very long certificates → Using u16::max instead of u16::MAX potentially allows very long certificates
Group: crypto-core-security

Setting security flag, just in case, we can always declassify.

Good catch! In practice, I don't think this is an issue, because all of these certificates are coming from Mozilla.

Assignee: nobody → dkeeler
Severity: -- → S4
Keywords: sec-low
Priority: -- → P1
Whiteboard: [psm-assigned]
Pushed by dkeeler@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fc3462ef5136 avoid some "as" casts in cert_storage r=jschanck
Group: crypto-core-security → core-security-release
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
Attachment #9446849 - Flags: approval-mozilla-beta?

beta Uplift Approval Request

  • User impact if declined: this probably won't affect users, because the data comes from a trustworthy source, but still, it's definitely wrong
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: n/a
  • Risk associated with taking this patch: low
  • Explanation of risk level: this patch changes some casts into statements that can be typechecked by the compiler, so it's definitely safer
  • String changes made/needed: none
  • Is Android affected?: yes
Attachment #9446851 - Flags: approval-mozilla-esr128?

esr128 Uplift Approval Request

  • User impact if declined: this shouldn't affect users, since the data comes from a trusted source, but it's still wrong
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: n/a
  • Risk associated with taking this patch: low
  • Explanation of risk level: this patch changes some casts into statements that can be typechecked by the compiler, so it's definitely safer
  • String changes made/needed: none
  • Is Android affected?: yes
Attachment #9446849 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9446851 - Flags: approval-mozilla-esr128? → approval-mozilla-esr128+
Flags: needinfo?(dkeeler)
QA Whiteboard: [post-critsmash-triage]
Flags: qe-verify-
Attachment #9446851 - Attachment description: Bug 1940804 - avoid some "as" casts in cert_storage r?jschanck → Bug 1940804 - avoid some "as" casts in cert_storage a=RyanVM

I updated the esr128 patch - should be good to go now.

Flags: needinfo?(dkeeler)
QA Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main135+]
QA Whiteboard: [post-critsmash-triage][adv-main135+] → [post-critsmash-triage]
Whiteboard: [psm-assigned] → [psm-assigned][adv-main135+]
Whiteboard: [psm-assigned][adv-main135+] → [psm-assigned][adv-main135+][adv-ESR128.7+]
Attached file advisory.txt —
Alias: CVE-2025-1014

I was asked to make this public and this was fixed more than 3 months ago. There is also little new information from what is already public in https://github.com/rust-lang/rust-clippy/issues/13973#issuecomment-2833386390.

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: