Closed
Bug 804049
Opened 12 years ago
Closed 12 years ago
[Security Review] App Updates for B2G
Categories
(mozilla.org :: Security Assurance, task, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: pauljt, Assigned: pauljt)
References
()
Details
In bug 772404 we have looked at gecko and gaia updates. We also need to review the update process for third party apps, which is the purpose of this bug.
Initial information:
https://wiki.mozilla.org/Gaia/System/Apps#Updates (outdated I think)
Relevant bugs:
bug 790558
bug 796045
Code:
'checkforUpdate' in http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.js
Updated•12 years ago
|
Assignee: nobody → ptheriault
Comment 1•12 years ago
|
||
How are things going with this, Paul?
Assignee | ||
Comment 2•12 years ago
|
||
Do we have an update story yet for apps finalised yet? I thought this was pending signed apps?
Assignee | ||
Comment 3•12 years ago
|
||
Ok I see signed apps is resolved. Trying to untangle the mess of bugs here and piece together the state of things. Jsmith, from bug 823189 you sound like you are across the general process - are you able to point me to anything that might help me understand the current update process, and/or the people to talk to get this information?
Flags: needinfo?(jsmith)
Assignee | ||
Comment 4•12 years ago
|
||
Nevermind, I think I have found the relevant code, and can work from there: http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.jsm#1101
We do also need to look at app signing too, maybe in conjunction with this.
Flags: needinfo?(jsmith)
Comment 5•12 years ago
|
||
bsmith is a good person to check on any the signing checks. As for updates, I think Fabrice implemented the large majority of the gecko portion of the API.
I'd recommend talking to bsmith and fabrice.
Updated•12 years ago
|
Blocks: market-packaged-apps
Assignee | ||
Comment 6•12 years ago
|
||
Slightly broadening the scope of this review now that I am familiar with the code. Basically I am covering all app update flows in this review, with the exception of those performed as part of the system update, which have been covered in https://wiki.mozilla.org/Security/Reviews/B2GUpdates.
Working on a draft here: https://wiki.mozilla.org/Reviews/B2G/AppUpdates
Review/Comment/Contributions appreciated.
Summary: [Security Review]Third Party App updates for B2G → [Security Review] App Updates for B2G
Assignee | ||
Updated•12 years ago
|
Updated•12 years ago
|
Assignee | ||
Comment 7•12 years ago
|
||
An internal (secteam) review was conducted last week. Actions from this are:
1. test for normal app updates to see if initiated by user or not (notifications displyed, test this?)
2. Check to make sure people dont appcache their update manifest (appstore-side)
3. Are we relying on the app to update itself, need to check update cadence in review process (appstore-side)
4. Check when delete old app happens (as part of applying packaged update)
Im not raising these as dependent bugs, as they are really just questions, and I will take these to the formal review when this occurs.
Just a note on 3 - from another thread on dev-b2g, I believe the update cadence is daily, but at a random time daily. Still need to confirm the exact mechanism.
(In reply to Paul Theriault [:pauljt] from comment #7)
> An internal (secteam) review was conducted last week. Actions from this are:
>
> 1. test for normal app updates to see if initiated by user or not
> (notifications displyed, test this?)
The user can initiate update checks in B2G by going to settings->DeviceInformation->CheckNow
I'm not sure if that answers the question
> 2. Check to make sure people dont appcache their update manifest
> (appstore-side)
It's quite possible that if the marketplace app put the update manifest into an appcache that we'd be in trouble.
But the app lives in a different data-jar, so no matter what it appcaches we ignore that when checking the update manifest for the app.
> 3. Are we relying on the app to update itself, need to check update cadence
> in review process (appstore-side)
Every 24 hours we check apps for updates. If the phone is off at that time, we'll check as soon as we get data connection.
Assignee | ||
Comment 9•12 years ago
|
||
(In reply to Jonas Sicking (:sicking) from comment #8)
> (In reply to Paul Theriault [:pauljt] from comment #7)
> > An internal (secteam) review was conducted last week. Actions from this are:
> >
> > 1. test for normal app updates to see if initiated by user or not
> > (notifications displyed, test this?)
>
> The user can initiate update checks in B2G by going to
> settings->DeviceInformation->CheckNow
>
> I'm not sure if that answers the question
Sorry the question was worded better on https://wiki.mozilla.org/Reviews/B2G/AppUpdates:
I wanted to understand if, once the device discovered an app update is available, what the UI looked like. Is it similar to the System update notification? Or is it just applied without asking the user? Is the behavior different between hosted/packaged apps? Does the user choose to apply or not? Is there some record or last time an app was updated?
(I can probably find the answers to many of these questions myself, but just writing down the question more clearly.)
>
> > 2. Check to make sure people dont appcache their update manifest
> > (appstore-side)
>
> It's quite possible that if the marketplace app put the update manifest into
> an appcache that we'd be in trouble.
>
> But the app lives in a different data-jar, so no matter what it appcaches we
> ignore that when checking the update manifest for the app.
So appcache storage is seperated by data-jar origins similar to indexeddb and cookies? I didnt know that, thanks.
>
> > 3. Are we relying on the app to update itself, need to check update cadence
> > in review process (appstore-side)
>
> Every 24 hours we check apps for updates. If the phone is off at that time,
> we'll check as soon as we get data connection.
Ok thanks.
Comment 10•12 years ago
|
||
Might be worthwhile to stick a bunch of us in a room to finish off the questions you have and get bugs filed for any issues that need to be immediately addressed. We are running low on time for v1, so if anything is stop ship, we'll want to know it asap.
I'd pull in people such as:
- Julien (Gaia)
- Etienne (Gaia)
- Fabrice (Platform)
- Me (QA)
- Jonas (Architect)
- Lucas (Security)
Assignee | ||
Comment 11•12 years ago
|
||
Yes, definitely, I was hoping for a proper secreview meeting this week, but I understand everyone is away until Tuesday in the US? I am just testing/reviewing some more stuff at the moment, but I will send out an email to these people shortly to try to figure out a secreview time for this week.
Comment 12•12 years ago
|
||
>
> I wanted to understand if, once the device discovered an app update is
> available, what the UI looked like. Is it similar to the System update
> notification? Or is it just applied without asking the user? Is the behavior
> different between hosted/packaged apps? Does the user choose to apply or
> not? Is there some record or last time an app was updated?
This should be the same UI for system updates, packaged apps, hosted+appcache apps or (I'm not sure) hosted apps.
For system updates, we have an additional prompt when it is downloaded, to let the user choose to apply it now (the phone will reboot) or later (when the phone is rebooted next time).
For app updates, the update is applied as soon as it is downloaded, unless the app is running in front. If it is the case, we wait that it is hidden (most probably the user will press "home") to apply the update.
Assignee | ||
Comment 13•12 years ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #12)
> >
> > I wanted to understand if, once the device discovered an app update is
> > available, what the UI looked like. Is it similar to the System update
> > notification? Or is it just applied without asking the user? Is the behavior
> > different between hosted/packaged apps? Does the user choose to apply or
> > not? Is there some record or last time an app was updated?
>
> This should be the same UI for system updates, packaged apps,
> hosted+appcache apps or (I'm not sure) hosted apps.
>
> For system updates, we have an additional prompt when it is downloaded, to
> let the user choose to apply it now (the phone will reboot) or later (when
> the phone is rebooted next time).
>
> For app updates, the update is applied as soon as it is downloaded, unless
> the app is running in front. If it is the case, we wait that it is hidden
> (most probably the user will press "home") to apply the update.
Thanks Julien, that answers my question.
Assignee | ||
Comment 14•12 years ago
|
||
>
> > 2. Check to make sure people dont appcache their update manifest
> > (appstore-side)
>
> It's quite possible that if the marketplace app put the update manifest into
> an appcache that we'd be in trouble.
>
> But the app lives in a different data-jar, so no matter what it appcaches we
> ignore that when checking the update manifest for the app.
Jonas, just to make sure I understand you correctly:
Consider an active MITM attack scenario against a hosted app that doesn't use SSL:
1. FooApp (a hosted app, not SSL) requests any content over content over http.
2. Attacker responds modifies response to include script to trigger a check for update
3. The WebApps service (in the system app process, but privileged?) makes a request to FooApp's web server to check the app manifest for a new version.
4. The attacker then modifies the contents of the app manifest to include a reference to a spurious appcache manifest
5. The attacker deliberately attempts to cache the app manifest by including it in the list of files cached by the appcache manifest.
If I understand you (&the code) correctly this is not a threat, as step 5 doesn't work as the attacker would like, due to data-jars.
Ignoring that apps are not updated while open, even if this sequence of events happens, the appcache is only poisoned in the data-jar belonging to the app. The code responsible for this is http://mxr.mozilla.org/mozilla-central/source/uriloader/prefetch/nsOfflineCacheUpdate.cpp#1368, noting the call to nsApplicationCacheService::BuildGroupIDForApp.
Comment 15•12 years ago
|
||
Paul, I'm quite sure that we can't cache the app manifest this way.
The app manifest is kept in the Application Registry ([1]) and that's all.
However, even if this could happen, I don't understand what would be the final goal for the attacker ?
[1] http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.jsm#1844
Assignee | ||
Comment 16•12 years ago
|
||
I was thinking along the lines of either application DoS (e.g. permanent defacement) or perhaps permanent app compromise (e.g. run script provided by attacker, every time the user runs the app)
What I was thinking was that if the manifest was cached, then the request which retrieves the update as part of the update check would get the cached version. But I dont know what happens if you use XHR to request an appcached page (i.e. here http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.jsm#1395)
Assignee | ||
Comment 17•12 years ago
|
||
Oh derp. At a guess the very next line probably answers my question :|
1396 xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
Comment 18•12 years ago
|
||
(In reply to Paul Theriault [:pauljt] from comment #17)
> Oh derp. At a guess the very next line probably answers my question :|
>
> 1396 xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
And this xhr really lives in gecko, not in the App.. so I doubt the App's AppCache has any control on this.
Assignee | ||
Comment 19•12 years ago
|
||
Review was conducted earlier in the week.
Two action items came out of the review:
** Add UI the show source of the app - there is a bug for this already (bug 827562)
** Storage permission could be granted by MITM to a hosted app not using SSL since it is allowed for hosted apps. This permissions grants unlimited storage, so the MITM could then try to fill up the disk. I'll raise a separate bug to discuss solutions to this further.
Comment 20•12 years ago
|
||
(In reply to Paul Theriault [:pauljt] from comment #19)
> Review was conducted earlier in the week.
>
> Two action items came out of the review:
> ** Add UI the show source of the app - there is a bug for this already (bug
> 827562)
I should note that bug targets the install prompt. We'll probably want to file an additional one for the settings apps perm UI as well.
marking this resolved fixed as the review happened
It does appear the following is follow-up
* Who :: What :: By when (Keep in mind all these things will be bugs that block the review bug, that blocks the feature bug)
Confirm the update UI for pure hosted apps (ie no appcacheache)
--> [jsmith] Just tested, no UI shown, update is automatically applied
Storage permission could be granted by MITM to a hosted app not using SSL. This grants unlimited storage, so the MITM could then try to fill up the disk.
Add UI the source of the app (install and app info section, under permission)
--> install prompt bug might be https://bugzilla.mozilla.org/show_bug.cgi?id=827562
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•