Closed Bug 1996555 (CVE-2025-14323) Opened 1 year ago Closed 1 year ago

Loading of the notification API icon URI seems to be missing checks.

Categories

(Core :: DOM: Notifications, defect, P2)

defect

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox-esr115 146+ fixed
firefox-esr140 146+ fixed
firefox144 --- wontfix
firefox145 --- wontfix
firefox146 + fixed
firefox147 + fixed

People

(Reporter: tiebuchen, Assigned: aaiunusov)

References

(Blocks 1 open bug, Regression)

Details

(4 keywords, Whiteboard: [client-bounty-form][adv-main146+][adv-esr115.31+][adv-esr140.6+])

Attachments

(2 files, 4 external files, 1 obsolete file)

6.82 MB, image/gif
Details
28.64 KB, image/jpeg
Details
Attached image Notification API Icon.gif β€”

A security vulnerability has been identified in Firefox's implementation of the Web Notifications API. The browser fails to properly validate and sanitize the icon parameter when creating notifications via new Notification(), allowing malicious actors to bypass multiple security restrictions that are properly enforced in Chromium-based browsers.

Firefox does not perform adequate security checks on the URL provided to the icon parameter in the Notification constructor. This oversight enables several security bypasses:

  1. Local Network Access Bypass
    Issue: The notification icon feature can be exploited to make arbitrary requests to local network resources, bypassing Local Network Access restrictions.

Example:
new Notification('Test', {
icon: 'http://localhost/request_type?notification_icon'
});

Impact:

Attackers can probe and interact with services on the local network (localhost, private IP ranges)
Bypasses the browser's Local Network Access security model
Enables reconnaissance of local services and potential SSRF (Server-Side Request Forgery) attacks from the client side

  1. Local File System Access Bypass
    Issue: The icon parameter accepts file:// protocol URLs, allowing direct access to local filesystem resources and bypassing same-origin policy isolation.
    Example:
    javascriptnew Notification('Test', {
    icon: 'file:///c:/tmp/image.png'
    });
    Impact:

Bypasses browser restrictions on local file access
Violates the browser's security isolation model (sandbox/island mode)
Potential for information disclosure by accessing local files
Could be used to probe for the existence of specific files on the user's system

  1. Arbitrary URL Schema Handling
    Issue: Firefox accepts arbitrary URL schemas in the icon parameter and prompts the user to open them, but critically fails to include the requesting origin URL in the prompt.
    Example:
    javascriptnew Notification('Test', {
    icon: 'calculator:://test'
    });

Impact:

Users may be prompted to open external applications without clear context of which website initiated the request
Lack of origin information in the prompt makes it difficult for users to make informed security decisions
Could be exploited for social engineering attacks
Potential for triggering malicious actions in external protocol handlers

Reproduce :

  1. open https://permission.site/ , click Notifications , allow Notifications permission bubble prompt
  2. run the javascript code in the console

2.1. Local Network Access bypass
new Notification('Test1', {
icon: 'http://localhost/request_type?notification_icon'
});

2.2 Local file system access via file:// protocol
new Notification('Test2', {
icon: 'file:///c:/tmp/image.png'
});

2.3 Arbitrary URL schema handling without origin context
new Notification('Test3', {
icon: 'calculator:://test'
});

Flags: sec-bounty?
Group: firefox-core-security → dom-core-security
Component: Security → DOM: Navigation
Product: Firefox → Core
Component: DOM: Navigation → DOM: Notifications

This will also bypass the CSP <meta http-equiv="Content-Security-Policy" content="img-src 'self'"> .

Severity: -- → S2
Priority: -- → P2
Flags: needinfo?(krosylight)
Attached image Clipboard 1.jpg β€”

I managed to reproduce the bug with
new Notification('Test', { icon: 'calculator:://test' });

(Clipboard 1.jpg)

I think yes, icon parameter must be filtered before using

We must only allow the icons from the same domain

This looks bad.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Insecure handling of the Notification API Icon can trigger a variety of security issues. → Loading of the notification API icon URI seems to be missing checks.

I will submit a patch soon

Attached file (secure) β€”
Assignee: nobody → aiunusov
Status: NEW → ASSIGNED

was debugging a bit

So, https://searchfox.org/firefox-main/rev/75f89f7dee3f30c371af717da54ba8bbf046e5fd/toolkit/components/alerts/AlertNotification.cpp#425
here we pass correct Content principal, but it still allows to load all of this stuff (even with nsIContentPolicy::TYPE_IMAGE)

Nika was noting that was pass null as the document (presumably because we're in the parent process) so maybe that is causing us to skip a check somehow?

See Also: → 1997282

okay, I am going to try <img> case with nullptr ass a document, to see what will happen

nsresult imgLoader::LoadImage(
    nsIURI* aURI, nsIURI* aInitialDocumentURI, nsIReferrerInfo* aReferrerInfo,
    nsIPrincipal* aTriggeringPrincipal, uint64_t aRequestContextID,
    nsILoadGroup* aLoadGroup, imgINotificationObserver* aObserver,
    nsINode* aContext, Document* aLoadingDocument, nsLoadFlags aLoadFlags,
    nsISupports* aCacheKey, nsContentPolicyType aContentPolicyType,
    const nsAString& initiatorType, bool aUseUrgentStartForChannel,
    bool aLinkPreload, uint64_t aEarlyHintPreloaderId,
    FetchPriority aFetchPriority, imgRequestProxy** _retval) {
  VerifyCacheSizes();
  aLoadingDocument = nullptr; // <----

basically, makes no difference for <img> tag in terms of security
I'm continue debugging imgLoader..

found exact cause:

https://searchfox.org/firefox-main/rev/a7d872e9d28072c2dd6d688d1b6c0493fcf7e94c/image/imgLoader.cpp#936

for Notification icons imgLoader uses a system principal.

from @smaug

So, worth to read https://bugzilla.mozilla.org/show_bug.cgi?id=1206961

https://searchfox.org/firefox-main/rev/a7d872e9d28072c2dd6d688d1b6c0493fcf7e94c/image/imgLoader.cpp#932-933,936
so, at some point, the author who touched this code forgot Notification case and passed a system principal

Comment on attachment 9523065 [details]
(secure)

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: patch is self explanatory for attackers (they will know it immediately)
  • Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: Yes
  • 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 branches since the last 10 years
  • If not all supported branches, which bug introduced the flaw?: Bug 1206961
  • Do you have backports for the affected branches?: No
  • If not, how different, hard to create, and risky will they be?: trivial
  • How likely is this patch to cause regressions; how much testing does it need?: we do not know yet, and will need to push to try
  • Is the patch ready to land after security approval is given?: Yes
  • Is Android affected?: Yes
Attachment #9523065 - Flags: sec-approval?

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

(waiting for a sec approval)

Still waiting for security approval, in order to push-to-try before landing

Comment on attachment 9523065 [details]
(secure)

Approved to land and request uplift

Attachment #9523065 - Flags: sec-approval? → sec-approval+

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

Pushed by aiunusov@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a3059a12773c https://hg.mozilla.org/integration/autoland/rev/22adde50fa4a Use the TriggeringPrincipal if we have one, not the SystemPrincipal, r=smaug,ckerschb

firefox-beta Uplift Approval Request

  • User impact if declined: 10 years old security bug will persist
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: low risk due to the passed local tests (image load related)
  • String changes made/needed: no
  • Is Android affected?: yes
Attachment #9526010 - Flags: approval-mozilla-beta?
Attached file (secure) β€”

firefox-esr115 Uplift Approval Request

  • User impact if declined: 10 years old security bug will persist
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: low risk due to the passed local tests (image load related)
  • String changes made/needed: no
  • Is Android affected?: yes
Attachment #9526011 - Flags: approval-mozilla-esr115?
Attached file (secure) β€”

firefox-esr140 Uplift Approval Request

  • User impact if declined: 10 years old security bug will persist
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: low risk due to the passed local tests (image load related)
  • String changes made/needed: no
  • Is Android affected?: yes
Attachment #9526012 - Flags: approval-mozilla-esr140?
Attached file (secure) β€”
Attached file (secure) (obsolete) β€”
Attachment #9526013 - Flags: approval-mozilla-release?

firefox-release Uplift Approval Request

  • User impact if declined: 10 years old security bug will persist
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: low risk due to the passed local tests (image load related)
  • String changes made/needed: no
  • Is Android affected?: yes
Group: dom-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch

The bounty team is debating whether this is really a sec-high or if it's more of a sec-moderate.

  • bypassing CSP or iframe sandbox would be sec-moderate
  • we haven't shipped LNA, but bypassing it would be sec-moderate
  • loading files is normally forbidden, but what is the harm? the caller can't learn about the image/file. wrong for sure, but moderate?
  • launching external protocols without asking the user: sec-vector? depends on the vulnerability of other apps. Do we at least still block the "known bad" protocols or does Chrome get a pass on that?
Attachment #9526010 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [sec] [uplift] [qa-triage-done-c147/b146]
Attachment #9526011 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
Attachment #9526012 - Flags: approval-mozilla-esr140? → approval-mozilla-esr140+

rolled back from esr115 for causing mochitest failures

backout

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

https://searchfox.org/firefox-main/source/toolkit/components/alerts/test/chrome/test_image.html#99

"Loading principal is HTTPS; image URL is HTTP."

I think it is a good idea not to allow loading this
But I'll see how to resolve this (maybe a test needs adjustment)

security.mixed_content.upgrade_display_content

https://github.com/mozilla-firefox/firefox/blob/esr115/modules/libpref/init/StaticPrefList.yaml#L13701 - disabled in ESR115

https://github.com/mozilla-firefox/firefox/blob/esr140/modules/libpref/init/StaticPrefList.yaml#L16511 - enabled in ESR140 and later

I'll tweak a test and provide a patch for ESR115 soon

It looks like esr115 was more strict about loading mixed content. And my patch is correct

This means the test is expected to fail. And it fails now.

I plan to change security.mixed_content.upgrade_display_content to false and test esr115 locally.
If this is the case, a minor test adjustment will be required (only checking the security.mixed_content.upgrade_display_content pref).

Flags: sec-bounty? → sec-bounty+
Comment 30 is private: false

While I agree with the reporter that we were missing expected checks, I disagree with many of the hypothetical harms

Quoting from comment 0 with some formatting changes to make replies easier

Issue 1: icon: 'http://localhost/request_type?notification_icon'
Impact:

  1. Attackers can probe and interact with services on the local network (localhost, private IP ranges)
    2, Bypasses the browser's Local Network Access security model
  2. Enables reconnaissance of local services and potential SSRF (Server-Side Request Forgery) attacks from the client side

Yes, this allows the notifications API to do what web sites have been able to do since 1991, bypassing a protection mechanism we probably still won't ship by default for a couple of months. In Fx146 it will be part of "ETP Strict" for users who turn that on (bug 1991917).

It's definitely a bug, but not the worst thing.

Issue 2: icon: 'file:///c:/tmp/image.png'
Impact:

  1. Bypasses browser restrictions on local file access
  2. Violates the browser's security isolation model (sandbox/island mode)
  3. Potential for information disclosure by accessing local files
  4. Could be used to probe for the existence of specific files on the user's system

yes to #1. #2 appears to imagine reasons for the restriction that aren't true (it's not about isolation or sandboxing). #3 and #4 seem to be the same thing and are a main reason for the file: restriction in web pages, but how can you use notifications to conduct a probe or load a document to trigger the scripts it contains? the page sending the notification gets no feedback on whether the load succeeded or failed.

Issue 3: icon: 'calculator:://test'
Impact:

  1. Users may be prompted to open external applications without clear context of which website initiated the request
  2. Lack of origin information in the prompt makes it difficult for users to make informed security decisions
  3. Could be exploited for social engineering attacks
  4. Potential for triggering malicious actions in external protocol handlers

#1-3 are essentially the same: "this is confusing and someone could take advantage of it" (which is true: this is definitely unwanted behavior). For #2 specifically, the prompt shows up at exactly the same time as the notification, and the notification has the hostname of the responsible site. It's confusing, but not impossible to figure out. Hopefully when faced with a mystery prompt from a mystery location most users will hit "Cancel".

#4 is the primary reason for the prompt. That situation would be a security bug in that other app, but that does happen. Even with a proper prompt people can unwisely click "allow". In any case, there is no way for an external handler to be the source of an image so these simply should never have been allowed in an image context, prompt or no prompt.

from comment 1:

This will also bypass the CSP <meta http-equiv="Content-Security-Policy" content="img-src 'self'"> .

Since the image is not loaded into the document these notifications are outside the CSP threat model. Preventing exfiltration is explicitly specified as not a goal in the content security policy spec. Still, we should see if we can preserve the "policy container" for these requests because CSP is not the only thing that is likely to be missing

Sadly this patch is incomplete. It fixes issues 2 and 3, but because there's no document context (the requestingNode) not everything is fixed. There's still no LNA warning because we only know the origin of the notification, but don't know if it was loaded as a public or private site. And likewise we have no access to the document's content security policy so it still bypasses CSP as mentioned in comment 1.

It would be a confusing mess to reopen this bug so I will file a follow-up bug for the remaining issues

hey Artur, any update on a test fix?

Flags: needinfo?(aiunusov)

(It would be tricky to have a test of Notification API, because we don't expose the result as pointed out in comment #39, but we should be able to test AlertNotification itself in a mochitest.)

(But given we'll remove AlertNotification.loadImage, perhaps the test should be done in bug 2001265 than here...)

Attachment #9526013 - Attachment is obsolete: true
Attachment #9526013 - Flags: approval-mozilla-release?

(Regarding to the esr115 test. I will update a ESR115 patch soon.)

Flags: needinfo?(aiunusov)
Attachment #9526011 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
Whiteboard: [client-bounty-form] → [client-bounty-form][adv-main146+]
Whiteboard: [client-bounty-form][adv-main146+] → [client-bounty-form][adv-main146+][adv-esr115.31+]
Whiteboard: [client-bounty-form][adv-main146+][adv-esr115.31+] → [client-bounty-form][adv-main146+][adv-esr115.31+][adv-esr140.6+]
Alias: CVE-2025-14323
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: