Closed Bug 1971704 Opened 1 year ago Closed 1 year ago

Block downloads in sandbox before checking for potentially unsafe downloads

Categories

(Core :: DOM: Security, defect)

defect

Tracking

()

RESOLVED FIXED
141 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox-esr140 --- wontfix
firefox139 --- wontfix
firefox140 --- wontfix
firefox141 + fixed

People

(Reporter: tschuster, Assigned: tschuster)

References

(Regression)

Details

(Keywords: regression, sec-low, Whiteboard: [adv-main141-])

Attachments

(1 file, 1 obsolete file)

https://searchfox.org/mozilla-central/rev/0fe159e3c1a09d9cd22b0ceadbe01efc7e8fd788/dom/security/nsContentSecurityUtils.cpp#2242-2248 on the other hand looks worrisome. Why is that before the sandbox check.

bug 1969304 comment 4

We shouldn't even try to check if a download is potentially insecure due to mixed content, we should just block it if the sandbox flags don't allow it.

Currently we also allow downloads triggered by the system principal to bypass the sandbox flags, but not the mixed content blocking. I am not sure if that is really intentional either. It seems backwards to me?

Assignee: nobody → tschuster

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

Not sure about the rating, here? Maybe sec-low?

Need-info myself so I don't forget to write a test for this.

Flags: needinfo?(tschuster)
Blocks: 1971805
Flags: needinfo?(tschuster)
Keywords: sec-low
Flags: needinfo?(tschuster)
Flags: needinfo?(tschuster)
Flags: needinfo?(tschuster)
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Flags: needinfo?(tschuster)
Target Milestone: --- → 141 Branch
Flags: needinfo?(tschuster)
Group: dom-core-security → core-security-release

(In reply to Tom Schuster (MoCo) from comment #0)

Currently we also allow downloads triggered by the system principal to bypass the sandbox flags, but not the mixed content blocking. I am not sure if that is really intentional either. It seems backwards to me?

I don't know where this check lives, but fwiw bug 1668530 (and its sibling bugs around uBlock Origin and similar mechanisms, as well as network failures) may be relevant to your interests?

We ended up removing this check here: https://hg-edge.mozilla.org/mozilla-central/rev/46f7b4cf0509#l1.44. There really shouldn't be a reason for the system principal to bypass the sandbox flags here. It seems like at some point the code was meant to allow the system principal to bypass the mixed content check, but that was broken by some refactoring.

Flags: needinfo?(tschuster)
Flags: needinfo?(tschuster)

I have tried writing a test for this, but haven't succeeded so far. Usually it seems like we would already block mixed content downloads from inside iframes via nsMixedContentBlocker::ShouldLoad before ever reaching nsContentSecurityUtils::ClassifyDownload.

Flags: needinfo?(tschuster)

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

QA Whiteboard: [sec] [qa-triage-done-c142/b141]
Flags: qe-verify-

Did you want to nominate this for ESR140/ESR128 uplift?

Flags: needinfo?(tschuster)

I don't think we need to uplift this. It's not even 100% clear if this is an actual issue.

Whiteboard: [adv-main141-]
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: