Skip to content
Access control Disclosed report Intermediate CVE-2019-15615

Bypassing Passcode/Device credentials

The Nextcloud Android app's app lock could be bypassed in two ways: by launching a search intent via ADB, or by changing the device time to the app's last closed time. An attacker with physical access could access the app without entering the passcode.

arvind-hacker Follow

Originally disclosed on HackerOne

  • Triaged in 36 hours
  • Fixed in 6 days
  • Disclosed after 14 months

Assume user have set "App passcode" to "Passcode/Device credentials". So whenever user opens the app, it will prompt to unlock before accessing the app. Unfortunately there is a issue, attacker can able to bypass the lock easily in two ways.

Setup

  1. Install NextCloud app and Log in.
  2. Go to Settings and set "App passcode" to "Passcode/Device credentials".

How to bypass?

  • Bypassing the lock using ADB

Reproduce steps

1.Execute the below command in command Prompt.

adb shell am start com.nextcloud.client/com.owncloud.android.ui.activity.FileDisplayActivity

2.It will open the app and prompt to unlock, now don't close the app and execute the below command.

adb shell am start -a android.intent.action.SEARCH com.nextcloud.client/com.owncloud.android.ui.activity.FileDisplayActivity

Now it will open the app again, but this time it will not prompt to unlock (You can able to use the app without unlocking).

  • Bypassing the lock by changing device time

By default the app lock timeout is 5 seconds, so when the user close and reopens the app within 5 seconds, it will not prompt to unlock.

Source code - https://github.com/nextcloud/android/blob/master/src/main/java/com/owncloud/android/authentication/PassCodeManager.java

Java
   private boolean passCodeShouldBeRequested(Long timestamp) {
        return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT &&
            visibleActivitiesCounter <= 0 && isPassCodeEnabled();
    }

In the above code, it checks whether user opened the app within 5 seconds or not by comparing the current timestamp and app closed timestamp. So attacker (Who knows the app closed time) can bypass this lock easily by changing the device time to app closed time.

Reproduce steps

  1. Open the app and unlock.
  2. Close the app and note the app closed time (For instance, it is 10:00 AM).
  3. After 5 seconds or later (For instance, at 11:00 AM), open the app, it will prompt to unlock.
  4. Now change the device time to app closed time (For instance, 10:00 AM).
  5. Now open the app, it will not prompt to unlock.

Fix

Don't Use System.currentTimeMillis(), use SystemClock.elapsedRealTime() (Now attacker can't able to bypass the lock even if the app closed time is known). Refer http://sangsoonam.github.io/2017/03/01/do-not-use-curenttimemillis-for-time-interval.html

Tested envirnoment

App version: 3.9.0 Android version(s): 6.0, 8.1

Impact

An attacker can easily access the victim Nextcloud app without unlocking "Passcode/Device credentials" lock.

The original report as published on HackerOne, by arvind-hacker. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the app lock logic relies on activity lifecycle and system time, which can be manipulated.

Impact

An attacker with physical access can access the victim's Nextcloud app without unlocking the passcode.

What the attacker needed

Physical access to the device; ADB access or ability to change device time

The fix

The app should use SystemClock.elapsedRealTime() instead of System.currentTimeMillis() for time intervals.

How it was found

  1. Install NextCloud app and log in.
  2. Set 'App passcode' to 'Passcode/Device credentials'.
  3. Execute ADB command to start FileDisplayActivity.
  4. Execute ADB command to start SEARCH intent on FileDisplayActivity.
  5. Observe app opens without passcode prompt.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The app has a lock screen that asks for a passcode when you open it. The report shows two tricks to get past that lock: one uses a computer command to open a different part of the app, and the other changes the phone's clock so the app thinks it was just closed. Both let someone use the app without knowing the passcode.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.