Closed Bug 1723281 (CVE-2021-43542) Opened 3 years ago Closed 3 years ago

Fast query of registered URL schemes through XMLHttpRequest for system fingerprinting

Categories

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

defect

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox-esr91 95+ fixed
firefox94 --- wontfix
firefox95 + fixed
firefox96 + fixed

People

(Reporter: smolikraphael, Assigned: smaug)

References

(Blocks 1 open bug)

Details

(Keywords: csectype-disclosure, privacy, sec-moderate, Whiteboard: [reporter-external] [client-bounty-form][fingerprinting][necko-triaged][adv-main95+][adv-ESR91.4.0+])

Attachments

(3 files, 1 obsolete file)

System fingerprinting like https://schemeflood.com/ use a slow variant, the bug enables tracking-services to fast list up all registered URL protocols. The problem on URL scheme fingerprinting is, that it will create a fingerprint for the system and not just the browser.

Tested on Windows 10 with Firefox 92 and Firefox 90.

The problem is that XMLHttpRequest will return different status codes dependent on the registration-state of the protocol or not.

Javascript code snippet:

var scheme = "spotify://dummy";

try {
var ajaxObj = new XMLHttpRequest()
ajaxObj.open("GET", scheme, false);
ajaxObj.send();
} catch (error) {
if (ajaxObj.status === 0) {
console.log("Protocol found: " + scheme);
} else { // regulary ajaxObj.status == 200
console.log("Protocol NOT found: " + scheme);
}
}

A fix would be to disallow XMLHttpRequest requests with protocols others than http, https, ...

Flags: sec-bounty?

(In reply to smolikraphael from comment #0)

A fix would be to disallow XMLHttpRequest requests with protocols others than http, https, ...

This seems like the kind of thing the fetch spec has something to say about. Anne, do you know if that is the case?

Blocks: 1711084, 1626068
Group: firefox-core-security → dom-core-security
Type: task → defect
Component: Security → DOM: Networking
Flags: needinfo?(annevk)
Product: Firefox → Core

Yeah, as per https://fetch.spec.whatwg.org/#scheme-fetch anything other than about:/blob:/data:/file:/http:/https: ought to return a network error (which would result in status 0).

And that is the case for everything that invokes fetch, including XMLHttpRequest. The only thing that can handle other schemes is HTML's navigate algorithm, which only defers to fetch for certain schemes.

When fixing this we should make sure that HTML's <img>, CSS's background-image, fetch(), etc. do not have the same problem.

Kershaw, would you have time to look into this? (In case you see this while still OOO, please ignore until you are back. 😊)

Severity: -- → S2
Flags: needinfo?(annevk) → needinfo?(kershaw)
Priority: -- → P2
Whiteboard: [reporter-external] [client-bounty-form] [verif?] → [reporter-external] [client-bounty-form] [verif?][fingerprinting]

I created a little example page to retrieve data from a client, for this project I found this bug. It checks the schemes dependent on the user agent to use different methods to check the schemes. (Firefox: this bug; chrome: focus loss method like https://schemeflood.com/ ; Edge a other method, that opens in the worst case each program; the last two will ask the user to start, because the bug is the single way, the user won't recognize). The found protocols will be displayed at the bottom. Here is the site. https://v2202108153726159664.quicksrv.de/

I now tested it with different systems:
Windows 10 the bug is there (tested with Firefox 90 and 92).
Android seems to list all schemes. (latest Firefox version and android 10)
Tor with Windows also won't work (I think because there are all prtotocol interactions restricted).
Ubuntu (21) and Firefox 89, the bug is also in.
Windows 8.1 and Firefox 78 and 90 the bug is also in.

This is just an update, I hope this is helpful for you.
I also have a question am I allowed to publish the bug, or is there any limitation in concerne with the bounty (if it is even relevant)?

(In reply to smolikraphael from comment #3)

I also have a question am I allowed to publish the bug, or is there any limitation in concerne with the bounty (if it is even relevant)?

Passing this question to Tom explicitly...

Flags: needinfo?(tom)

(In reply to smolikraphael from comment #3)

I also have a question am I allowed to publish the bug, or is there any limitation in concerne with the bounty (if it is even relevant)?

From a general security policy point of view, we would appreciate the opportunity to address the issue before it is published and some notice about when it will be published if so. From a Bug Bounty point of view, if a bug is made public before the issue is fixed, we generally look at the time that passed and events that occurred between reporting and publishing, and try to judge if the disclosure aligned with general industry best practices or not.

Flags: needinfo?(tom)

Jens, do you know who might be available to fix this soon? Thanks.

Flags: needinfo?(jstutte)

I guess we need to tweak the fix for bug 716491 a bit.

Assignee: nobody → bugs

Thanks for taking this, Olli.

Flags: needinfo?(kershaw)
Whiteboard: [reporter-external] [client-bounty-form] [verif?][fingerprinting] → [reporter-external] [client-bounty-form] [verif?][fingerprinting][necko-triaged]
Flags: needinfo?(jstutte)

Noticed similar issue with the blob uri, so fixed that in this patch too.
Tests are in the next patch.

InitiateFetch() call a bit later handles the marking for some other error cases.

Group: dom-core-security → core-security-release
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Flags: sec-bounty? → sec-bounty+

The patch landed in nightly and beta is affected.
:smaug, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(bugs)

freddy, do you think we should uplift this?

Flags: needinfo?(bugs) → needinfo?(fbraun)
No longer blocks: 1711084

The patch seems simple and I'm leaning towads yes.

Flags: needinfo?(fbraun)

Hi Dragana, smaug is not here the entire week, could you please request uplift?

Flags: needinfo?(dd.mozilla)

I can do it :)

Flags: needinfo?(dd.mozilla)

Comment on attachment 9248919 [details]
Bug 1723281, mark XHR load being an error load when send() fails, r=kershaw

Beta/Release Uplift Approval Request

  • User impact if declined: Exposing registered URL schemes to web sites
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: So there is a testcase attached to the bug, but that hasn't landed. I wanted to wait a bit with that. Though, I guess the issue is known given the public web site.
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): this should be low risk, because it is just tweaking an error case.
  • String changes made/needed:
Attachment #9248919 - Flags: approval-mozilla-beta?
Attachment #9248921 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Attachment #9248921 - Flags: approval-mozilla-beta?

Comment on attachment 9248919 [details]
Bug 1723281, mark XHR load being an error load when send() fails, r=kershaw

Approved for 95 beta 8, thanks.

Attachment #9248919 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

Hello! Can someone help to give some steps in order to reproduce and verify this manually?

I'm not sure what to do here, I loaded the javascript snippet from comment 0 in an affected build on https://playcode.io giving a Protocol NOT found: spotify://dummy console message and on a fixed build is giving a Protocol found: spotify://dummy console message, but I'm not sure that this is the right way.

Also, comment 17 is statting that a test case should be uploaded in near future. Thank you!

Comment on attachment 9248919 [details]
Bug 1723281, mark XHR load being an error load when send() fails, r=kershaw

Approved for 91.4esr also.

Attachment #9248919 - Flags: approval-mozilla-esr91+

Hello! Can you please help me with some steps to manually reproduce/ verify this issue? Thank you in advance,

Flags: needinfo?(bugs)

See the testcase, which I didn't land yet. I think I could land it now.

Flags: needinfo?(bugs)
Flags: in-testsuite? → in-testsuite+
Whiteboard: [reporter-external] [client-bounty-form] [verif?][fingerprinting][necko-triaged] → [reporter-external] [client-bounty-form][fingerprinting][necko-triaged][adv-main95+][adv-ESR91.4.0+]
Attached file advisory.txt (obsolete) —

We will be crediting you in the security advisories for our upcoming release of Firefox 95 as "smolikraphael".
Please respond to this needinfo request, if you wish to be credited differently (or not at all).

Flags: needinfo?(smolikraphael)
Alias: CVE-2021-43542

The name would be ok, Raphael Smolik would be better.

Flags: needinfo?(smolikraphael)
Attached file advisory.txt

Advisory text changed. Thank you :)

Attachment #9253425 - Attachment is obsolete: true
QA Whiteboard: [qa-triaged] → [qa-triaged][post-critsmash-triage]
QA Whiteboard: [qa-triaged][post-critsmash-triage] → [post-critsmash-triage]

Since we were not able to reproduce the issue, we are removing the qe+ flag, but if any additional information is added and QA is needed, please add again the qe+ flag.

Flags: qe-verify+
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: