Closed
Bug 1454909
(CVE-2018-12369)
Opened 7 years ago
Closed 7 years ago
No check for privileged permissions for WebExtension experiments
Categories
(WebExtensions :: Experiments, defect, P1)
WebExtensions
Experiments
Tracking
(firefox-esr52 unaffected, firefox-esr6061+ fixed, firefox59 wontfix, firefox60+ wontfix, firefox61+ fixed)
RESOLVED
FIXED
mozilla61
People
(Reporter: jkt, Assigned: jkt)
References
Details
(4 keywords, Whiteboard: [fixed by bug 1454820][adv-main61+][adv-esr60.1+][post-critsmash-triage])
Attachments
(2 files, 7 obsolete files)
8.99 KB,
application/x-xpinstall
|
Details | |
6.72 KB,
patch
|
Details | Diff | Splinter Review |
It appears there aren't any checks for bundled web extension experiments.
https://searchfox.org/mozilla-central/rev/f65d7528e34ef1a7665b4a1a7b7cdb1388fcd3aa/toolkit/components/extensions/Extension.jsm#632 doesn't check for privileged permissions.
experimentsAllowed appears never to be used:
https://searchfox.org/mozilla-central/rev/f65d7528e34ef1a7665b4a1a7b7cdb1388fcd3aa/toolkit/components/extensions/Extension.jsm#1355
I compiled the code with isPrivileged and experimentsAllowed hard coded to return false. I was still able to load an XPI built by web-ext build which was a bundled experiment through about:debugging.
This was able to set preferences etc. Is there something I am missing here?
Assignee | ||
Comment 1•7 years ago
|
||
This appears that https://bugzilla.mozilla.org/show_bug.cgi?id=1454820 wouldn't be needed currently as the code isn't used in the evaluation of if an extension can have an experiment.
If the idea is that an extension is filtered out by AMO then perhaps this is fine too?
Assignee | ||
Comment 3•7 years ago
|
||
I just submitted an unlisted addon to AMO and got lint errors: "experiments.rollout is not supported" but it did not reject signing on that.
I was able to install this signed XPI to release 59.0.1
Assignee | ||
Comment 4•7 years ago
|
||
* 59.0.2 sorry
Assignee | ||
Comment 5•7 years ago
|
||
Example XPI attached.
Assignee | ||
Updated•7 years ago
|
Summary: No check for privileged permissions → No check for privileged permissions for WebExtension experiments
Comment 6•7 years ago
|
||
I filed bug 1454939 to deny submissions of webextension experiments on AMO to prevent them from getting signed.
Assignee | ||
Comment 7•7 years ago
|
||
This includes the check I had for Bug 1454820 however I couldn't find a way to check the isSystem from this bit of code.
However it seemed like it would be good to bundle the patches together.
Assignee | ||
Comment 8•7 years ago
|
||
I just verified my patch still works as a temp addon in about:debugging but not installing through about:addons. (not that I am even sure if we want users to install an xpi as a temp addon and get this behaviour either)
Comment 9•7 years ago
|
||
Someone should check whether we've signed any extensions with bundled experiments.
Assignee: nobody → kmaglione+bmo
Flags: needinfo?(aswan)
Assignee | ||
Comment 11•7 years ago
|
||
:kmag Andreas suggested that only mine had been signed with code like this.
Comment 12•7 years ago
|
||
OK, then. Please request beta uplift before you land so we can land on both channels at once. And please land this patch as part of the bug to allow experiments in system add-ons. If you can add a stealth test, so much the better.
We can watch for new signatures while that rolls out.
Comment 13•7 years ago
|
||
Is it possible to land the patch after bug 1454939 is resolved? How long would bug 1454939 take until it is deployed on AMO? The risk of detection would be much lower if AMO had been fixed up already.
Comment 14•7 years ago
|
||
At this point, this only affects nightly and beta users, so there's not too much risk of this being exploited. I'd rather land the fix sooner than wait for AMO. We can always block any experiment extensions if they're signed in the meantime.
Assignee | ||
Comment 15•7 years ago
|
||
:kmag I was able to repro on stable?
Comment 16•7 years ago
|
||
Oh, did it land in 59? That's unfortunate. It might make sense to land the AMO fix first, then, but I'd still lean towards watching and blocklisting. We should be able to block before any add-ons get significant distribution.
Assignee | ||
Comment 17•7 years ago
|
||
Tests shouldn't be added to sec patches should they?
Attachment #8968886 -
Attachment is obsolete: true
Attachment #8968909 -
Flags: review?(kmaglione+bmo)
Attachment #8968909 -
Flags: review?(jhofmann)
Comment 18•7 years ago
|
||
(In reply to Jonathan Kingston [:jkt] from comment #17)
> Created attachment 8968909 [details] [diff] [review]
> bug-1454909.b.patch
>
> Tests shouldn't be added to sec patches should they?
In general they shouldn't, but I want this landed as part of bug 1454820, with tests. We should be able to add tests for all of the cases there without drawing attention to this one.
Comment 19•7 years ago
|
||
Comment on attachment 8968909 [details] [diff] [review]
bug-1454909.b.patch
>diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
>--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
>+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
>@@ -3873,6 +3873,7 @@ var XPIProvider = {
> resourceURI: getURIForResourceInFile(aFile, ""),
> signedState: aAddon.signedState,
> temporarilyInstalled: installLocation == TemporaryInstallLocation,
>+ systemInstalled: installLocation == BuiltInInstallLocation,
This should probably be something like installLocation.isSystem. Though maybe this makes more sense, since system add-ons in other location shoud be signed, anyway.
Still needs a test. Please submit that for review in bug 1454820. I'd rather not draw atrention to that by reviewing out of band.
Attachment #8968909 -
Flags: review?(kmaglione+bmo)
Comment 20•7 years ago
|
||
Could argue this is sec-high rather than sec-critical because there's a prompt, but you can make an extension look pretty innocuous.
Blocks: 1323845
status-firefox59:
--- → wontfix
status-firefox60:
--- → affected
status-firefox61:
--- → affected
status-firefox-esr52:
--- → unaffected
tracking-firefox60:
--- → +
tracking-firefox61:
--- → +
Comment 21•7 years ago
|
||
Comment on attachment 8968909 [details] [diff] [review]
bug-1454909.b.patch
Review of attachment 8968909 [details] [diff] [review]:
-----------------------------------------------------------------
Not 100% certain how Kris wants this patch to interact with the one in bug 1454820. It sounds like a good idea to me to submit all of the code for review in bug 1454820 and just leave this bug without patches.
Attachment #8968909 -
Flags: review?(jhofmann)
Updated•7 years ago
|
Severity: normal → critical
Priority: -- → P1
Assignee | ||
Comment 22•7 years ago
|
||
I spent a crazy amount of time failing to get any tests to work which I'm not really sure why.
Anyway my plan is to throw this into the Bug 1454820 when we are happy with it to minimize noise in that bug.
Attachment #8968909 -
Attachment is obsolete: true
Attachment #8969646 -
Flags: review?(kmaglione+bmo)
Attachment #8969646 -
Flags: review?(jhofmann)
Assignee | ||
Comment 23•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Attachment #8969646 -
Attachment is obsolete: true
Attachment #8969646 -
Flags: review?(kmaglione+bmo)
Attachment #8969646 -
Flags: review?(jhofmann)
Assignee | ||
Updated•7 years ago
|
Attachment #8970105 -
Flags: review?(kmaglione+bmo)
Attachment #8970105 -
Flags: review?(jhofmann)
Comment 24•7 years ago
|
||
Comment on attachment 8970105 [details] [diff] [review]
bug-1454909.d.patch
Review of attachment 8970105 [details] [diff] [review]:
-----------------------------------------------------------------
This looks fine to me (and solves the issue in my testing) but I'm not very experienced with that code. I'll leave the final sign-off to Kris.
::: toolkit/components/extensions/test/xpcshell/test_ext_experiments.js
@@ +124,5 @@
> + {isPrivileged: true, temporarilyInstalled: false, shouldPass: true},
> + {isPrivileged: false, temporarilyInstalled: true, shouldPass: true},
> + {isPrivileged: false, temporarilyInstalled: false, shouldPass: false},
> + ];
> + for (let i = 0; i < testCases.length; i++) {
nit: could simplify this to for (let testCase of testCases)
@@ +127,5 @@
> + ];
> + for (let i = 0; i < testCases.length; i++) {
> + let testCase = testCases[i];
> + async function background(shouldPass) {
> + if (shouldPass) {
nit: shouldPass is a bit weird as a name, maybe something like shouldHaveExperiments?
Attachment #8970105 -
Flags: review?(jhofmann) → review+
Assignee | ||
Comment 25•7 years ago
|
||
Attachment #8970105 -
Attachment is obsolete: true
Attachment #8970105 -
Flags: review?(kmaglione+bmo)
Attachment #8970141 -
Flags: review?(kmaglione+bmo)
Attachment #8970141 -
Flags: review?(jhofmann)
Comment 26•7 years ago
|
||
CC'ing Lizzard to make sure this probable late 60 uplift is noted. Liz, there are plans to include this patch in the one for bug 1454820 (and then uplift together, I suppose).
I would also suggest downgrading this to sec-high since bug 1454939 was resolved and it's no longer a problem on release.
Comment 27•7 years ago
|
||
With bug 1454939 resolved, I think this is only sec-moderate.
Assignee | ||
Comment 28•7 years ago
|
||
Comment on attachment 8970141 [details] [diff] [review]
bug-1454909.e.patch
[Security approval request comment]
How easily could an exploit be constructed based on the patch?
Not very, we now have mitigations in AMO
Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
No
Which older supported branches are affected by this flaw?
59+
If not all supported branches, which bug introduced the flaw?
Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
I plan to uplift, it should cleanly apply to 60.
How likely is this patch to cause regressions; how much testing does it need?
The chance of regressions is low, we have more tests and the only "risk" is with system addons with experiments which currently don't exist.
Attachment #8970141 -
Flags: sec-approval?
Comment 29•7 years ago
|
||
Comment on attachment 8970141 [details] [diff] [review]
bug-1454909.e.patch
Review of attachment 8970141 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/extensions/test/xpcshell/test_ext_experiments.js
@@ +122,5 @@
> + let testCases = [
> + {isPrivileged: true, temporarilyInstalled: true, shouldHaveExperiments: true},
> + {isPrivileged: true, temporarilyInstalled: false, shouldHaveExperiments: true},
> + {isPrivileged: false, temporarilyInstalled: true, shouldHaveExperiments: true},
> + {isPrivileged: false, temporarilyInstalled: false, shouldHaveExperiments: false},
Should have separate cases for system SIGNEDSTATE_SYSTEM and SIGNEDSTATE_PRIVILEGED.
Attachment #8970141 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Comment 30•7 years ago
|
||
Attachment #8970141 -
Attachment is obsolete: true
Attachment #8970141 -
Flags: sec-approval?
Attachment #8970141 -
Flags: review?(jhofmann)
Attachment #8970489 -
Flags: sec-approval?
Attachment #8970489 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 31•7 years ago
|
||
Still at least a sec-high due to: Bug 1455266
Updated•7 years ago
|
Attachment #8970489 -
Flags: review?(kmaglione+bmo) → review+
Comment 32•7 years ago
|
||
jonathan, and aswan, does this resolve the issues mentioned by aswan in https://bugzilla.mozilla.org/show_bug.cgi?id=1454820#c3 ?
Are you planning to land patches with uplift requests in both this bug and that other bug?
It's late in beta but we still have the beta 16 build and next week's RC so I'd like to get this into 60.0b16 if Al gives sec approval.
Flags: needinfo?(jkt)
Flags: needinfo?(aswan)
Comment 33•7 years ago
|
||
(In reply to Liz Henry (:lizzard) (needinfo? me) from comment #32)
> jonathan, and aswan, does this resolve the issues mentioned by aswan in
> https://bugzilla.mozilla.org/show_bug.cgi?id=1454820#c3 ?
Yes, the recent patch addresses that issue.
Flags: needinfo?(aswan)
Comment 34•7 years ago
|
||
Comment on attachment 8970489 [details] [diff] [review]
bug-1454909.f.patch
sec-approval+
Attachment #8970489 -
Flags: sec-approval? → sec-approval+
Assignee | ||
Comment 35•7 years ago
|
||
My plan was now to move this patch into bug 1454820 and mark as uplift there, not mentioning anything security there in public view.
> does this resolve the issues mentioned by aswan...
Yeah I will override the patch there with this one.
So I will ask for :johannh's approval tomorrow on the other bug with the exact same patch, as he will be in the same room and we have the correct approvals here anyway.
Unless :lizzard it would be better to move this public as close to 60.0b16 as possible?
Flags: needinfo?(jkt) → needinfo?(lhenry)
Comment 36•7 years ago
|
||
Just post the patch to the public bug now. It doesn't do anything to draw more attention it than it already has, and the routes to exploit have been closed by the AMO patches anyway.
Assignee | ||
Comment 37•7 years ago
|
||
Ah I didn't see Bug 1455266 was fixed already :) will do now thanks.
Flags: needinfo?(lhenry)
Comment 38•7 years ago
|
||
Just to clarify bug 1454820 comment 12, which I left intentionally vague:
It's no longer possible to exploit this bug in release channels, since AMO will no longer sign extensions with embedded experiments, and release channels won't load unsigned extensions. So I don't think it's necessary to uplift the fix to 60.
That said, if we do plan to ship system add-ons with bundled experiments to 60, doing so without uplifting that patch would look suspicious, so in that case the uplift would probably still make sense.
Updating the severity to reflect the current state of affairs. This is no longer exploitable without an exploit on the AMO side which would cause it to sign these extensions, which makes it sec-moderate.
Keywords: sec-critical → sec-moderate
Updated•7 years ago
|
status-firefox-esr60:
--- → affected
tracking-firefox-esr60:
--- → 61+
Whiteboard: [fixed by bug 1454820]
Target Milestone: --- → mozilla61
Assignee | ||
Comment 40•7 years ago
|
||
[Approval Request Comment]
If this is not a sec:{high,crit} bug, please state case for ESR consideration: This would be a high if it were not for mitigations placed in our AMO code.
User impact if declined: User may end up with extensions that have permissions to do what the browser can.
Fix Landed on Version: 61
Risk to taking this patch (and alternatives if risky): Low, some addons could break if we haven't signed them correctly (for example ohnoreflow was in this category).
String or UUID changes made by this patch: N/A
See https://wiki.mozilla.org/Release_Management/ESR_Landing_Process for more info.
This patch was taken from: https://reviewboard.mozilla.org/r/237414/diff/7#index_header this was the landed patch.
Attachment #8970489 -
Attachment is obsolete: true
Flags: needinfo?(jkt) → needinfo?(ryanvm)
Attachment #8983593 -
Flags: approval-mozilla-esr60?
Comment 41•7 years ago
|
||
Comment on attachment 8983593 [details] [diff] [review]
rb237414.patch
Fix for possible privilege escalation via malicious extensions. Approved for ESR 60.1.
Flags: needinfo?(ryanvm)
Attachment #8983593 -
Flags: approval-mozilla-esr60? → approval-mozilla-esr60+
Comment 42•7 years ago
|
||
This is going to need some rebasing. There's some conflicts with the patch and test failures if those get resolved.
https://treeherder.mozilla.org/logviewer.html#?job_id=182351552&repo=mozilla-esr60
Group: toolkit-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(jkt)
Resolution: --- → FIXED
Updated•7 years ago
|
Whiteboard: [fixed by bug 1454820] → [fixed by bug 1454820][adv-main61+][adv-esr60.1+]
Updated•7 years ago
|
Flags: qe-verify-
Whiteboard: [fixed by bug 1454820][adv-main61+][adv-esr60.1+] → [fixed by bug 1454820][adv-main61+][adv-esr60.1+][post-critsmash-triage]
Assignee | ||
Comment 43•7 years ago
|
||
The patch also needed to include: Bug 1457718. It looks like Bug 1467113 has already been applied.
Whiteboard: [fixed by bug 1454820][adv-main61+][adv-esr60.1+][post-critsmash-triage] → [fixed by bug 1454820][adv-main61+][adv-esr60.1+]
Assignee | ||
Comment 44•7 years ago
|
||
As mentioned this includes the patch from 1454820 and 1457718 applied for ESR combined.
Sorry for the delay Ryan, I was travelling monday.
Attachment #8983593 -
Attachment is obsolete: true
Flags: needinfo?(jkt) → needinfo?(ryanvm)
Comment 45•7 years ago
|
||
uplift |
Thanks Jonathan!
https://hg.mozilla.org/releases/mozilla-esr60/rev/24df9f92227a
Flags: needinfo?(ryanvm)
Comment 46•7 years ago
|
||
Please leave this string in place, inside the whiteboard, as it helps QA track what has and hasn't been triaged.
Whiteboard: [fixed by bug 1454820][adv-main61+][adv-esr60.1+] → [fixed by bug 1454820][adv-main61+][adv-esr60.1+][post-critsmash-triage]
Updated•7 years ago
|
Product: Toolkit → WebExtensions
Updated•7 years ago
|
status-firefox59:
wontfix → ---
status-firefox60:
wontfix → ---
status-firefox61:
fixed → ---
status-firefox-esr52:
unaffected → ---
status-firefox-esr60:
fixed → ---
tracking-firefox60:
+ → ---
tracking-firefox61:
+ → ---
tracking-firefox-esr60:
61+ → ---
Keywords: sec-moderate → sec-high
Updated•7 years ago
|
Keywords: sec-high → sec-moderate
Updated•7 years ago
|
status-firefox60:
--- → wontfix
status-firefox61:
--- → fixed
status-firefox-esr52:
--- → unaffected
status-firefox-esr60:
--- → fixed
Updated•7 years ago
|
Updated•7 years ago
|
status-firefox59:
--- → wontfix
Updated•7 years ago
|
Alias: CVE-2018-12369
Updated•6 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•