Bypassing App Lock [Firefox Lockwise - iOS]
Categories
(Lockwise Graveyard :: Security, defect)
Tracking
(Not tracked)
People
(Reporter: 1808ar.arvind, Assigned: st3fan)
References
Details
(Keywords: csectype-priv-escalation, reporter-external, sec-high, Whiteboard: [reporter-external] [client-bounty-form] [verif?])
Attachments
(1 file, 1 obsolete file)
|
4.21 KB,
patch
|
Details | Diff | Splinter Review |
Platform affected:
- App name: Firefox Lockwise
- App version: 1.7.3 (latest)
- OS: iOS (Tested environment: iOS 13.6)
- App Store URL: https://apps.apple.com/us/app/firefox-lockwise/id1314000270
Description:
Lockwise app "App Lock" feature allows the user to lock the app using Face / Touch ID. The "Auto Lock" timeout feature will lock the app automatically after user specified duration.
I set the timeout to "1 minute", so the app will lock automatically after 1 minute of inactivity (after I close the app). When I reopen the app after 1 minute or later, it prompts me to unlock before accessing the app.
But this feature does not work as intended. After 1 minute or LATER, if I change the device time to 1 hour backward and reopen the app, it allows me to access the app completely without unlocking (the app fails to prompt me to unlock).
NOTE: This issue also occurs if I change the device date to 1 day backward.
Impact:
An attacker can access all the passwords stored in the Lockwise app without unlocking the app lock by just reversing device date or time.
Steps to reproduce:
NOTE: PoC video attached.
- Install the Lockwise app.
- Open the app and login your account.
- Go to Settings, set "Auto Lock" to "1 Minute" (you can also select any other duration).
- Close the app.
- After 1 minute or LATER, change the device time to 1 hour backward (or) change the device date to 1 day backward.
- Now reopen the app (Now the app will not prompt to unlock and you can access the app completely).
Fix
The "Auto lock" feature works in this logic:
Lockwise app stores the app closed time (timestamp) when user closes the app. When user reopens the app, it compares current device time with the app closed time. If the difference is greater than (>) user specified duration (For example: 1 minute), then it will prompt the user to unlock.
If attacker changes the device time to app closed time / any earlier time and reopens the app, it fails to prompt to unlock because the current device time will be same / earlier than the app closed time.
The problem is using [NSDate().timeIntervalSince1970] (current time). Use [ProcessInfo.systemUptime] (device up time) for time interval calculation.
-> [NSDate().timeIntervalSince1970] - Returns current time in milliseconds.
-> [ProcessInfo.systemUptime] - Returns the amount of time the system has been awake since the last time it was restarted.
https://developer.apple.com/documentation/foundation/processinfo/1414553-systemuptime
Comment 3•6 years ago
|
||
Guessing sec-high because this defeats the whole point of having a password lockout, but on the other hand it does presuppose a local attacker who has access to your unlocked device which hopefully indicates a certain level of trust; sec-moderate might also be appropriate.
Updated•6 years ago
|
Comment 4•6 years ago
|
||
Unclear who owns this app now with recent reorg - removing needinfo from my account and requesting info/next steps from Jeremy Evans and David Bolter.
Comment 5•6 years ago
|
||
Wennie is LW back in your arena?
Comment 6•5 years ago
|
||
Re-routing NI to Stefan for awareness. Not sure we can/should get to this before EOL?
| Assignee | ||
Comment 7•5 years ago
|
||
Hi everyone. Quick update that we have set a plan in motion to ship a fix for this bug.
Arvind, thank you very much for this report and also for the suggested remediation. I will be working with engineering to implement a fix. I know some time has passed, but I would like to ask for some patience while we let this bug go through the process. This is still a sec-high report and I will also work with dveditz to officially confirm the bounty.
I'll keep people updated here. To set expectations - we have two build issues to work through before we can land this fix, and I expect that to happen in the coming week or two.
Updated•5 years ago
|
| Assignee | ||
Comment 8•5 years ago
|
||
The steps to reproduce also work in the iOS simulator.
- Run the app through Xcode in any Simulator
- Set auto lock to 1 minute
- Move to the Simulator home screen
- Wait a minute
- In your Mac's Date & Time settings, turn back time 🎶
- Bring Lockwise to the foreground
Expected is that Lockwise is still locked. In reality it unlocks since it's internal time-to-lock logic is flawed.
Fix incoming.
| Assignee | ||
Comment 9•5 years ago
|
||
| Assignee | ||
Comment 10•5 years ago
|
||
Attached the patch, which is being reviewed in a private fork on GitHub.
| Reporter | ||
Comment 11•5 years ago
|
||
Hi Stefan, thanks for fixing this issue. Sorry for the delay, just now I found that there is a issue in the fix.
ProcessInfo.processInfo.systemUptime- it will return milliseconds since boot, but not counting the time device spent in the sleep. This clock would pause when the device screen is turned OFF and resume only after the device screen is turned ON back.
Assume user sets the timeout to "12 hours", then the app will lock after 12 hours only if the user kept the device screen ON for 12 hours totally (after closing the app).
Issue scenario:
- Set "Auto Lock" to 1 minute.
- Close the app.
- Turn OFF the device screen.
- After 1 minute or later, turn ON the device screen.
- Now reopen the app, it won't prompt you to unlock.
To fix this issue, app should get device up time including the sleep time.
func uptime() -> time_t {
var boottime: timeval
let mib = [CTL_KERN, KERN_BOOTTIME]
var size = MemoryLayout.size(ofValue: boottime)
var now: time_t
var uptime: time_t = -1
time(&now)
if sysctl(mib, 2, &boottime, &size, nil, 0) != -1 && boottime.tv_sec != 0 {
uptime = now - boottime.tv_sec
}
return uptime
}
| Assignee | ||
Comment 12•5 years ago
|
||
Interesting! I need to give this a try because that is not what I experienced in my testing. The Telegram code is good for reference but it also depends on the system clock to get final uptime value. So I am not sure how much I like that. This patch was to avoid using the clock.
| Assignee | ||
Comment 13•5 years ago
•
|
||
I think what I will go with is actually clock_gettime(CLOCK_MONOTONIC_RAW, ...) - this is a simpler API. I'll verify with a test app that this is working correctly.
(Did find out that kern.boottime is adjusted when the system clock changes - but I think I simply prefer something simpler that does not touch the clock at all.)
| Assignee | ||
Comment 14•5 years ago
|
||
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 15•5 years ago
|
||
We have a 1.8.0-RC build on TestFlight. If this passes QA then we will ship it soon.
Comment 16•5 years ago
|
||
Verified fix on v1.8.0 (4249).
| Assignee | ||
Comment 17•5 years ago
|
||
This version is now rolling out over the coming days.
From an engineering perspective this is RESOLVED/FIXED.
Dan, can I ask you for next steps regarding this bug?
Comment 18•5 years ago
|
||
This bug appears to have been filed using the client bug bounty form yet did not have the bounty request flag. I don't see that it got removed so that's a bit disturbing. Adding the flag manually so the bounty committee can find and evaluate this one.
Dan, can I ask you for next steps regarding this bug?
- The patches landed so the bug can be marked FIXED, even if it hadn't shipped yet.
- you prepped an advisory at https://github.com/mozilla-lockwise/lockwise-ios/security/advisories/GHSA-xpfj-mwf5-rmpv (private for now)
- Updates are turned on, but so far at a less-than-100% rate
We should wait until we're comfortable turning updates to 100% (or close to it) before publishing the advisory, but that can be tracked in some PM-ish place and isn't usually done in the bug.
Updated•5 years ago
|
Updated•5 years ago
|
| Reporter | ||
Comment 19•5 years ago
|
||
Thanks so much for the reward.
| Assignee | ||
Comment 20•5 years ago
|
||
Arvind, we published the advisory at https://github.com/mozilla-lockwise/lockwise-ios/security/advisories/GHSA-xpfj-mwf5-rmpv
Would you like to be mentioned in it? It is easy to include a GitHub account or let me know what name you want me to put in there.
| Reporter | ||
Comment 21•5 years ago
|
||
Hi Stefan,
Yes, please mention me in the advisory.
My Github account: https://github.com/ar-arvind
Thanks so much.
| Reporter | ||
Comment 22•5 years ago
|
||
Hi Stefan,
My Github account is still not included in the advisory (https://github.com/mozilla-lockwise/lockwise-ios/security/advisories/GHSA-xpfj-mwf5-rmpv), can you please check it?
And also my name is not included in the Hall of Fame page (https://www.mozilla.org/en-US/security/bug-bounty/hall-of-fame/), am I eligible?
Thanks.
Updated•5 years ago
|
Updated•2 years ago
|
Description
•