Closed Bug 1530709 (CVE-2019-25136) Opened 6 years ago Closed 5 years ago

Use CSSOM to insert rules in SelectParentHelper.

Categories

(Core :: Layout: Form Controls, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox-esr60 --- wontfix
firefox-esr68 --- wontfix
firefox69 --- wontfix
firefox70 --- fixed
firefox71 --- fixed

People

(Reporter: emilio, Assigned: freddy, Mentored)

References

Details

(Keywords: csectype-priv-escalation, csectype-sandbox-escape, sec-high, Whiteboard: [post-critsmash-triage][adv-main70+])

Attachments

(1 file)

It would avoid CSS surprises in IPC messages from a potentially compromised content process.

Mentor: emilio
Priority: -- → P3

Turns out there's another flow from child->parent for the insertRule call in populateChildren (currently at line 435).

checkin-needed assuming this is going to be green like its predecessors :)

https://treeherder.mozilla.org/#/jobs?repo=try&revision=7cddf2c44ba44ece99e8e241d511c5b1fecfb289

Keywords: checkin-needed

Pushed by rmaries@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1b54dc70e042
Restrict styles to known selectors and single rules per message r=emilio

Keywords: checkin-needed

One of the failures is probably due to background-image being left out of SUPPORTED_PROPERTIES, when it might in fact be required due to the manual override in https://searchfox.org/mozilla-central/rev/e5327b05c822cdac24e233afa37d72c0552dbbaf/toolkit/actors/SelectParent.jsm#104

However, this can't be fixed by just allowing background-image, as the color value might break out of the linear-gradient() function and start a new url() thing. I'll have to think some more on how to fix this.

OK, so I think this needs to go through a parser to be actually safe from escaping. I tried writing into cssRules[0]["background-color"] and then reading out of it again, to get some meaningful color back, but that actually just returns whatever has been written in. Nothing we can use safely within linear-gradient().

If I had a dummy HTML element, I could assign to dummy.style.color and read out of it again. - That does work.
I fear it could be too costly to do so, so maybe you can think of a smarter thing emilio? I also see you have a lot of pending needinfos. Feel free to redirect me!

Flags: needinfo?(fbraun) → needinfo?(emilio)

(In reply to Frederik Braun [:freddyb] from comment #7)

OK, so I think this needs to go through a parser to be actually safe from escaping. I tried writing into cssRules[0]["background-color"] and then reading out of it again, to get some meaningful color back, but that actually just returns whatever has been written in. Nothing we can use safely within linear-gradient().

That is an oversight. cssRules[0]["background-color"] is not the right thing to set. That's just setting a random property in the object, which is why it's not doing the right thing.

You need to use cssRules[0].style["background-color"], which will do what you want.

Flags: needinfo?(emilio)
Keywords: checkin-needed

Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/15163b51d8f1
Restrict styles to known selectors and single rules per message r=emilio

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Assignee: nobody → fbraun

Comment on attachment 9089019 [details]
Bug 1530709 - Restrict styles to known selectors and single rules per message r=emilio

Beta/Release Uplift Approval Request

  • User impact if declined: risk of styling bugs in the browser chrome (parent process)
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): fix uses a different (safer) API. Functionality & logic is the same. The tests confirm it's working.
  • String changes made/needed: None
Attachment #9089019 - Flags: approval-mozilla-beta?
Group: core-security
Group: core-security → core-security-release

Comment on attachment 9089019 [details]
Bug 1530709 - Restrict styles to known selectors and single rules per message r=emilio

Fixes a CSS bug which can potentially lead to incorrect styling in the parent process. Approved for 70.0b8.

Attachment #9089019 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Whiteboard: [post-critsmash-triage]
Flags: qe-verify-
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main70+][adv-main70-rollup]
Whiteboard: [post-critsmash-triage][adv-main70+][adv-main70-rollup] → [post-critsmash-triage][adv-main70+][adv-main70+r]
Group: core-security-release

Turns out this was an exploitable vulnerability that was used in the wild. Details are available here: https://blog.google/threat-analysis-group/new-details-on-commercial-spyware-vendor-variston/

Alias: CVE-2019-25136
Whiteboard: [post-critsmash-triage][adv-main70+][adv-main70+r] → [post-critsmash-triage][adv-main70+]

Also, because we know this was a sandbox escape, I'm retroactively bumping it to sec-high

Keywords: sec-moderatesec-high

We never established a "regressor" because this was more of a hardening effort than a vulnerability fix when it started. Without knowing the regressor, marking old versions as "unaffected" was premature. If we had known then what we know now we would have pushed to take it on the ESR, but at the time it was not filed as a severe vulnerability and ESR patching is conservative.

According to analysis from the Google TAG (see the "Heliconia Files" section) this was exploited in versions Fx64-Fx68 at least.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: