Closed
Bug 1246945
(CVE-2016-5293)
Opened 9 years ago
Closed 9 years ago
Write to arbitrary file with updater and moz maintenance service using updater.log hardlink
Categories
(Toolkit :: Application Update, defect)
Toolkit
Application Update
Tracking
()
People
(Reporter: hofusec, Assigned: robert.strong.bugs)
Details
(Keywords: reporter-external, sec-high, Whiteboard: [post-critsmash-triage][adv-main50+][adv-esr45.5+] fixed by bug 1168743)
Attachments
(4 files, 1 obsolete file)
66.41 KB,
application/zip
|
Details | |
48.23 KB,
patch
|
robert.strong.bugs
:
review+
abillings
:
sec-approval+
|
Details | Diff | Splinter Review |
47.14 KB,
patch
|
robert.strong.bugs
:
review+
lizzard
:
approval-mozilla-esr45+
abillings
:
sec-approval+
|
Details | Diff | Splinter Review |
9.40 KB,
patch
|
Details | Diff | Splinter Review |
During an update a updater.log file is created in the update source directory. If possible the new log data are added to an existing log file. If the file is actually a hardlink the new data are added to an arbitrary file.
The poc use the CreateHardlink tool from https://github.com/google/symboliclink-testing-tools to create the hardlink without the need of write access to the target file.
I have tested the poc with win7 and ff 47 nightly installed to C:\Program Files (x86)\Nightly\:
To reproduce
- download poc and extract the files
- execute poc.rb
The poc adds amongst other data a user controlled new line to the updater.ini in the firefox directory.
This might be used to elevate privileges by overwriting a script or ini file which has a permissive parser which subsequently gets executed/parsed by a privileged process.
Comment 1•9 years ago
|
||
Rob, can you take this and suggest a security rating?
Flags: needinfo?(robert.strong.bugs)
Assignee | ||
Comment 2•9 years ago
|
||
Similar bugs have been rated sec-high. Looking into what can be done to mitigate this.
Flags: needinfo?(robert.strong.bugs)
Comment 3•9 years ago
|
||
Matt, is this another one of these bugs that you'll be looking at?
Flags: needinfo?(mhowell)
Comment 4•9 years ago
|
||
This one wasn't on my radar, but I'll go ahead and take it.
rstrong, did you ever have time to come up with any mitigation ideas? This exploit uses a replace request, so it's exploiting the fact that moving the existing log file to the new temporary path before we append to it preserves the hard link from the source path. My first thought is that we should be able to move that file in a way that breaks the link.
Assignee: nobody → mhowell
Flags: needinfo?(mhowell) → needinfo?(robert.strong.bugs)
Comment 5•9 years ago
|
||
This patch copies the existing log file instead of moving it; the original is then deleted by already existing code. This copies the content of the log while breaking the hard link.
Flags: needinfo?(robert.strong.bugs)
Comment 6•9 years ago
|
||
Updated•9 years ago
|
Attachment #8761353 -
Flags: review?(robert.strong.bugs)
Assignee | ||
Comment 7•9 years ago
|
||
Note: in bug 1168743 I am removing the append option from logging which also fixes this bug.
Assignee | ||
Comment 8•9 years ago
|
||
Comment on attachment 8761353 [details] [diff] [review]
Patch
Won't this suffer from the same issue as bug 1171518 when using CopyFile?
Attachment #8761353 -
Flags: review?(robert.strong.bugs) → review-
Comment 9•9 years ago
|
||
(In reply to Robert Strong [:rstrong] (use needinfo to contact me) from comment #8)
> Won't this suffer from the same issue as bug 1171518 when using CopyFile?
Yeah, looks like it would. I could mitigate that to a degree by including some randomness in the temp file name, instead of a timestamp like GetTempFileName uses. Do you want to bother in light of comment 7 though? Removing the append functionality is definitely the better fix.
Flags: needinfo?(robert.strong.bugs)
Assignee | ||
Comment 10•9 years ago
|
||
I think it would be better to go with bug 1168743
Flags: needinfo?(robert.strong.bugs)
Assignee | ||
Comment 11•9 years ago
|
||
Al, the client patch in bug 1168743 addresses this bug and I'd like to know how you'd like to handle getting that landed. Would you prefer that I put the client patch that only fixes this bug in this bug for the security approvals, etc. for landing on other branches and if so would you like the client patch without the additional cleanup? I don't think the additional cleanup is that risky to land on other branches especially since we are early in this cycle but I'm not against reducing the changes. Also, the test patches in bug 1168743 will need to land on the branches as well. Thanks!
Flags: needinfo?(abillings)
Comment 12•9 years ago
|
||
I'd just ask for sec-approval here and branch approvals with the caveat to all involved that we're actually approving (quietly) the patches for bug 1168743, if that works for you. That's assuming that the patches there are review+ in general.
Flags: needinfo?(abillings)
Assignee | ||
Comment 13•9 years ago
|
||
Works for me and thanks!
Assignee | ||
Updated•9 years ago
|
Assignee: mhowell → robert.strong.bugs
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Updated•9 years ago
|
Attachment #8761353 -
Attachment is obsolete: true
Assignee | ||
Comment 14•9 years ago
|
||
Attaching client patch from bug 1168743 so I have something to request sec-approcal on
[Security approval request comment]
How easily could an exploit be constructed based on the patch? Not easily at all since this fix was done as part of bug 1168743.
Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem? Not at all
Which older supported branches are affected by this flaw? It was introduced in Firefox 42 in bug 1171518 to fix a different security bug. So, all supported branches.
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 don't expect any difficulty in creating backports.
How likely is this patch to cause regressions; how much testing does it need? Not very likely but I'd like this to spend a week or two on nightly before uplifting as with all app update changes. With this being the start of the cycle this shouldn't be a problem.
Attachment #8762239 -
Flags: sec-approval?
Attachment #8762239 -
Flags: review+
Updated•9 years ago
|
Attachment #8762239 -
Flags: sec-approval? → sec-approval+
Assignee | ||
Comment 15•9 years ago
|
||
Pushed patches in bug 1168743 to mozilla-inbound.
Pushed by rstrong@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a78bd6c722f8
test data files - Only use env vars in the test updater and general app update cleanup. r=mhowell
https://hg.mozilla.org/integration/mozilla-inbound/rev/8f965be1037f
client changes - Only use env vars in the test updater and general app update cleanup. r=mhowell
https://hg.mozilla.org/integration/mozilla-inbound/rev/c69b17415feb
test changes - Only use env vars in the test updater and general app update cleanup. r=mhowell
Assignee | ||
Comment 16•9 years ago
|
||
After the patches from bug 1168743 have baked on m-c nightly for a while I'll request branch approval.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•9 years ago
|
Group: toolkit-core-security → core-security-release
Comment 17•9 years ago
|
||
Has it baked enough? It's too late to get this into Beta but would be nice to get it into Aurora so it has the full Beta period for testing.
status-firefox47:
--- → wontfix
status-firefox48:
--- → affected
status-firefox49:
--- → affected
status-firefox50:
--- → fixed
status-firefox-esr45:
--- → affected
tracking-firefox49:
--- → +
tracking-firefox50:
--- → +
Flags: needinfo?(robert.strong.bugs)
Whiteboard: fixed by bug 1168743
Assignee | ||
Comment 18•9 years ago
|
||
After baking I found a regression (bug 1287176) that needs to be fixed first and I am working on.
Flags: needinfo?(robert.strong.bugs)
Comment 19•9 years ago
|
||
Definitely a no-go for Fx48 then; maybe it'll make Firefox 49.
tracking-firefox-esr45:
--- → 49+
Comment 20•8 years ago
|
||
Hi :rstrong,
Since this patch also affects 49, are you also considering to uplift this patch to 49 beta?
Flags: needinfo?(robert.strong.bugs)
Assignee | ||
Comment 21•8 years ago
|
||
I have considered it and don't think it should be uplifted at present due to comment #18.
Flags: needinfo?(robert.strong.bugs)
Comment 22•8 years ago
|
||
Bug 1287176 is marked as unaffected for 49. Does that change things? Or do you think it also affects 49?
Flags: needinfo?(robert.strong.bugs)
Assignee | ||
Comment 23•8 years ago
|
||
The patch in bug 1168743 which fixes this bug caused bug 1287176. I'd like the patch for bug 1287176 to bake a little longer but after that I am ok with uplifting bug 1168743 and bug 1287176 if you want them. Please note that like most of the app update bugs like this that local system access is necessary to exploit this and afaik we haven't had reports of this ever happening.
Flags: needinfo?(robert.strong.bugs) → needinfo?(lhenry)
Comment 25•8 years ago
|
||
seems that esr will have to leave with this bug, are we ok?
Updated•8 years ago
|
Flags: sec-bounty?
Assignee | ||
Comment 26•8 years ago
|
||
How about uplifting this to esr when this merges to beta?
Assignee | ||
Comment 27•8 years ago
|
||
If bug 1168743 is uplifted to esr45 I'd like to take bug 1212939 as well to simplify the changes needed for the esr45 patch. In case we do decide at some point to uplift to esr45 I've created an esr45 patch for bug 1168743 and will soon create one for bug 1287176.
Assignee | ||
Comment 28•8 years ago
|
||
I have patches that apply to esr45 and the tests pass locally if this is wanted after the merge from aurora to beta.
Comment 29•8 years ago
|
||
I think we should take this on ESR45.5 (shipping with Firefox 50).
Updated•8 years ago
|
Flags: sec-bounty? → sec-bounty+
Assignee | ||
Comment 30•8 years ago
|
||
Requested esr45 on bug 1212939 to simplify the landing of this patch.
Assignee | ||
Comment 31•8 years ago
|
||
This patch requires the patch from bug 1212939 and bug 1287176 (I'll attach the patch for bug 1299333 in this bug as well).
[Approval Request Comment]
If this is not a sec:{high,crit} bug, please state case for ESR consideration:
User impact if declined: Possible to write to arbitrary file with local computer access using the updater and moz maintenance service and an updater log hardlink
Fix Landed on Version: Firefox 50
Risk to taking this patch (and alternatives if risky): Minimal. The fix and the regression the patch caused has baked on Nightly and Aurora.
String or UUID changes made by this patch: None
See https://wiki.mozilla.org/Release_Management/ESR_Landing_Process for more info.
[Security approval request comment]
How easily could an exploit be constructed based on the patch?
Not easily at all since this fix was done as part of bug 1168743.
Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
Not at all
Which older supported branches are affected by this flaw?
It was introduced in Firefox 42 in bug 1171518 to fix a different security bug. So, all supported branches.
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?
Yes, I do.
How likely is this patch to cause regressions; how much testing does it need?
Not likely since it has baked on Nightly and Aurora for quite some time. Only normal update testing should be needed.
Attachment #8790403 -
Flags: sec-approval?
Attachment #8790403 -
Flags: review+
Attachment #8790403 -
Flags: approval-mozilla-esr45?
Assignee | ||
Comment 32•8 years ago
|
||
[Approval Request Comment]
See previous request
Attachment #8790404 -
Flags: approval-mozilla-esr45?
Assignee | ||
Comment 33•8 years ago
|
||
Note: I'll land this myself since there are several test patches that go along with it.
Comment 34•8 years ago
|
||
This can land on 9/20. sec-approval for that date for trunk. I think we'll want to move this up the branches after things are settled on trunk.
The flags on this bug are confusing since it isn't really "fixed" on 50 is it?
Whiteboard: fixed by bug 1168743 → fixed by bug 1168743 [checkin on 9/20]
Updated•8 years ago
|
Attachment #8790403 -
Flags: sec-approval? → sec-approval+
Comment 35•8 years ago
|
||
or is this patch ESR only?
Assignee | ||
Comment 36•8 years ago
|
||
This patch is esr only
Comment 37•8 years ago
|
||
Ah, ok. Thank you for making this clear.
Comment 39•8 years ago
|
||
Comment on attachment 8790403 [details] [diff] [review]
esr45 bug 1168743 client patch
Already landed in 50, sec-high, let's take this for ESR45.5.0.
Flags: needinfo?(lhenry)
Attachment #8790403 -
Flags: approval-mozilla-esr45? → approval-mozilla-esr45+
Assignee | ||
Comment 40•8 years ago
|
||
Liz, this also needs the patch in bug 1212939. Can I get approval for that as well?
Flags: needinfo?(lhenry)
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(lhenry)
Assignee | ||
Updated•8 years ago
|
Attachment #8790404 -
Flags: approval-mozilla-esr45?
Assignee | ||
Comment 41•8 years ago
|
||
Pushed the patches from bug 1168743 to mozilla-esr45
https://hg.mozilla.org/releases/mozilla-esr45/rev/54f7eaaa6de3 test data files
https://hg.mozilla.org/releases/mozilla-esr45/rev/a1e06af61ab3 client code
https://hg.mozilla.org/releases/mozilla-esr45/rev/6ac20c152794 test code
Pushed the patches from bug 1287176 to mozilla-esr45
https://hg.mozilla.org/releases/mozilla-esr45/rev/0569d5dce9db client code
https://hg.mozilla.org/releases/mozilla-esr45/rev/804d7029982c test code
Updated•8 years ago
|
Flags: qe-verify+
QA Contact: kjozwiak
Whiteboard: fixed by bug 1168743 [checkin on 9/20] → fixed by bug 1168743 [checkin on 9/20][post-critsmash-triage]
Updated•8 years ago
|
Whiteboard: fixed by bug 1168743 [checkin on 9/20][post-critsmash-triage] → fixed by bug 1168743 [checkin on 9/20][post-critsmash-triage][adv-main50+][adv-esr45.5+]
Comment 42•8 years ago
|
||
I managed to reproduce this issue using Firefox 49.0.2 build 2 and STR from Comment 0.
The issue is no longer reproducible on Firefox 45.5.0ESR, Firefox 50.0, Firefox 51.0a2(2016-11-08), or on Firefox 52.0a1(2016-11-07).
Tests were performed under Windows 10x64.
Comment 43•8 years ago
|
||
As :mboldan used Win 10 x64 for verification, I double checked using Win 7 as it was the original platform used in comment#0.
Reproduced the issue using the POC from comment#0 with the following build:
* https://archive.mozilla.org/pub/firefox/nightly/2016/02/2016-02-09-03-03-47-mozilla-central/
Platform used:
* Win 7 SP1 x64 - PASSED
Changed the appropriate paths under "write.poc\poc.rb" when using fx51.0a2 and fx50.0b9.
FX builds being used:
* fx52.0a1, buildId: 20161108030212, changeset: f13e90d496cf - PASSED
* fx51.0a2, buildId: 20161108004019, changeset: d9cfe58247e8 - PASSED
* fx50.0b9, buildId: 20161020152750, changeset: 2bb6dc758711 - PASSED
* fx45.5.0, buildId: 20161031153904, changeset: 32ce7be98543 - PASSED
Updated•8 years ago
|
Alias: CVE-2016-5293
Updated•8 years ago
|
Whiteboard: fixed by bug 1168743 [checkin on 9/20][post-critsmash-triage][adv-main50+][adv-esr45.5+] → [post-critsmash-triage][adv-main50+][adv-esr45.5+] fixed by bug 1168743
Updated•8 years ago
|
Group: core-security-release
Updated•8 months ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•