Closed Bug 1920423 (CVE-2024-10462) Opened 1 year ago Closed 1 year ago

using long url address in permission prompt truncated lead to spoof

Categories

(Firefox :: Site Permissions, defect, P1)

defect

Tracking

()

VERIFIED FIXED
133 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 132+ verified
firefox130 --- wontfix
firefox131 --- wontfix
firefox132 + verified
firefox133 + verified

People

(Reporter: sas.kunz, Assigned: emz)

References

(Regression)

Details

(4 keywords, Whiteboard: [client-bounty-form] [adv-main132+] [adv-esr128.4+])

Attachments

(7 files)

Attached image domainlong.png

when using long url address, url in permission prompt is truncated leading to spoof

steps to reproduce

  1. open https://xxxxxxxxxxxxxxxxxxx.login.secures.documents.drives.google.com.aogarantiza.com/chromium/pepc-bounds.html
  2. open console do :
    navigator.mediaDevices.getUserMedia(
    {audio: true, video: true}).then()
  3. the url shown in permission prompt: https://xxxxxxxxxxxxxxxxxxx.login.secures.documents.drives.google.com not https://xxxxxxxxxxxxxxxxxxx.login.secures.documents.drives.google.com.aogarantiza.com

OS: windows 10

Flags: sec-bounty?
Component: Security → Site Permissions
Attachment #9426500 - Attachment description: popup-notification-with-working-host-display.png → popup-notification-with-working-host-display.png This used to work. Here is the PoC with an older version of Firefox

The PopupNotification used to resize properly to accommodate the long URL. This is a regression.
I ran mozgression on it:

 8:57.59 INFO: Narrowed nightly regression window from [2022-10-17, 2022-10-19] (2 days) to [2022-10-17, 2022-10-18] (1 days) (~0 steps left)
 8:57.59 INFO: Got as far as we can go bisecting nightlies...
 8:57.59 INFO: Last good revision: ac1330b68d3e7b231a177cfa1ac52e1b2199bb84 (2022-10-17)
 8:57.59 INFO: First bad revision: b6e04e02b4f8532eac41194d203e72d91dbfc2ff (2022-10-18)
 8:57.59 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=ac1330b68d3e7b231a177cfa1ac52e1b2199bb84&tochange=b6e04e02b4f8532eac41194d203e72d91dbfc2ff

Not sure yet which is the regressing bug.

This is a bit of a long-shot: Emilio, could this be related to Bug 1790616?

Flags: needinfo?(emilio)
Severity: -- → S2
Priority: -- → P1

That seems likely, before that, rules like this one weren't really honored. If you change that to min-content then it works as you expect.

We could:

  • Add a min-width: min-content to that rule.
  • Remove that rule.
  • Allow the domain to break by using word-break: anywhere or so?
  • Something else?
Flags: needinfo?(emilio)

Thanks! Let's mark it as a regression for now.
I like the idea of word-break: anywhere but going back to the original behavior by updating the width may be safer here.

Keywords: regression
Regressed by: 1790616

Set release status flags based on info from the regressing bug 1790616

The ideal solution here would be to add an ellipsis in the right spot so that the site (eTLD+1) is still shown. We could also detect the "overflow" and switch to only showing site in that case. I'm wondering if we have existing helpers specifically for URIs for this that are not just cropping somewhere in the center.

As a stop-gap fix I suggest to add word-break: break-all;. However, we can't add it to the entire body because that would mean we would break anywhere for the entire description text which doesn't look good and difficult to read.

Targeting just the host portion turned out to be trickier than I thought. The l10n string uses a %S placeholder for the host which then gets replaced by < >. This is handed to PopupNotifications#show which parses it and eventually sets the name attribute on the custom element <popupnotification>. This name attribute is then mapped to the DOM using a quite obscure selector.

I'm working on a patch which makes the selector a bit clearer and targets only the "name" field, making it wrap anywhere. I need to double check that we really only use this field for hosts and not insert other text which should wrap properly.

Setting custom style just for the host portion of the description would be a lot easier if these prompts used Fluent. Fluent allows developers to add HTML tags as part of the localization string. This is where we could add e.g. a class name to target. However, I consider migrating all site permission prompts to Fluent out of scope for this bug.

While looking into this I've noticed that PopupNotifications supports displaying the host via the displayURI option. Permission prompts don't seem to use that (anymore?). Probably because we now show the host inline as part of the description text. The displayURI implementation uses crop=center which will add an ellipsis in the middle. Most of the time that resolves this problem. There may still be cases where the site (eTLD+1) part is so long that it will hide parts of it too.

Assignee: nobody → pbz
Status: NEW → ASSIGNED

Set release status flags based on info from the regressing bug 1790616

Attached file Bug 1920423, r=Gijs!
Attachment #9428475 - Attachment description: Bug 1920423 - For permission prompts word-break host anywhere. r=Gijs! → Bug 1920423, r=Gijs!
Attachment #9428589 - Flags: approval-mozilla-beta?

beta Uplift Approval Request

  • User impact if declined: Spoofing of hostname in permission prompts.
  • Code covered by automated testing: no
  • Fix verified in Nightly: no
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: See comment 0
  • Risk associated with taking this patch: low
  • Explanation of risk level: Only a styling change. There is a low risk for a cosmetic issue where we wrap content of PopupNotifications weirdly.
  • String changes made/needed: none
  • Is Android affected?: no
Flags: qe-verify+
Pushed by pzuhlcke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6a15156e22b8 r=Gijs,desktop-theme-reviewers,reusable-components-reviewers,hjones
Attachment #9428592 - Flags: approval-mozilla-esr128?

esr128 Uplift Approval Request

  • User impact if declined: Spoofing of hostname in permission prompts.
  • Code covered by automated testing: no
  • Fix verified in Nightly: no
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: See comment 0
  • Risk associated with taking this patch: low
  • Explanation of risk level: Only a styling change. There is a low risk for a cosmetic issue where we wrap content of PopupNotifications weirdly.
  • String changes made/needed: none
  • Is Android affected?: no
Group: firefox-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
QA Whiteboard: [qa-triaged]
Attachment #9428589 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9428592 - Flags: approval-mozilla-esr128? → approval-mozilla-esr128+
Attachment #9428592 - Flags: approval-mozilla-esr128+ → approval-mozilla-esr128-

Reproduced this issue on an affected nightly build, following the STR from Comment 0.
Verified as fixed on latest Nightly 133.0a1 (2024-10-03) and latest Beta 132.0b3 (treeherder build - 20241003135730) on Win 10, Win 11, macOS 11 and Ubuntu 22.04.

Flags: sec-bounty? → sec-bounty+

NI for the rebased ESR128 patch.

Flags: needinfo?(pbz)

Rebased https://phabricator.services.mozilla.com/D224349
Though I didn't run into any merge conflicts locally. Might have auto merged properly.

Flags: needinfo?(pbz)
Attachment #9428592 - Flags: approval-mozilla-esr128- → approval-mozilla-esr128+
Whiteboard: [client-bounty-form] → [client-bounty-form] [adv-main132+] [adv-esr128.4+]

Verified as fixed on Firefox 128.4.0esr (20241021193311) on Win 10, Win 11, macOS 11 and Ubuntu 22.04.

Status: RESOLVED → VERIFIED
Alias: CVE-2024-10462
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: