a physical device. We argue that modern smartphone
users not only want to secure their mobile device but
in many cases, there are also specific applications and
data that need to be strongly secured. In order to un-
derstand this argument, a use case is described.
Let us assume that Alice has an Android device
which has several applications, some of which re-
quire strong authentication, e.g. banking applica-
tions. Moreover, Alice may often share her device
with daughter Carol to let her play or browse the In-
ternet. Android may support more than one users.
However, this feature is not often used due to usabil-
ity issues and because in the case of Carol, shoulder
surfing cannot be avoided.
Due to her job, Alice comes in contact with many
people on a daily basis, and quite often she has to un-
lock her device in front of them. Therefore, Alice
fears that her unlock PIN/pattern (and possibly other
credentials) may have been disclosed through shoul-
der surfing. Moreover, Alice would like to have con-
trol of some web pages and apps to avoid possible
issues, from posting something inappropriate on a so-
cial network to messing with her bank account.
Based on the above, Alice wants to be able to au-
thenticate on a device easily, avoiding shoulder surf-
ing attacks. Additionally, Alice wants to be able to
share her device with Carol, yet lock some apps and
possibly web pages so that her daughter cannot access
them. In terms of implementation, we opt for a light
solution so that the device must not be rooted but use
existing and native mechanisms.
We argue that the above could be solved by pro-
viding some context awareness to an app that controls
access to the device. In this case, context awareness
refers to the ability of an app to infer:
• Which user has authenticated.
• Which are the running apps.
• Which web page the user wants to browse.
From the questions above, only the first one can be
answered. Regarding running applications, Google
has removed the getRunningTasks method of
ActivityManager as of API level 21 to avoid apps
surveying users and more importantly to prevent
malicious apps from timely overlaying other apps
(e.g. banking) and harvesting credentials. While
in the literature there are several ways to determine
the foreground app (Chen et al., 2014; Bianchi
et al., 2015; Alepis and Patsakis, 2017), yet all
of them have been deprecated in AOSP. Never-
theless, Google as of Android Lollipop, allows
developers to use two methods to get usage statis-
tics or detect the foreground app. More precisely,
they may either use the UsageStatsManager API
which requires the PACKAGE_USAGE_STATS system
permission and allows an app to collect statistics
about the usage of the installed apps, or use the
AccessibilityService API which requires the
BIND_ACCESSIBILITY_SERVICE system permission.
Notably, both these permissions are “more than
dangerous” permissions. In the first case though,
Android does not allow apps to derive anything
else apart from aggregated statistics about the us-
age of the installed apps. In this regard, an app
that has been granted this permission may collect
aggregated usage data for up to 7 days for daily
intervals, up to 4 weeks for weekly intervals, up to
6 months for monthly intervals, and finally up to
2 years for yearly intervals, always depending on
the chosen interval. In the second case, using the
AccessibilityService, which includes handling
the onAccessibilityEvent() callback and check-
ing whether the TYPE_WINDOW_STATE_CHANGED
event type is present, one may determine when the
current window changes. It is important to note that
Google has warned developers about this permission,
that she will remove apps from the Play Store if
they use accessibility services for “non-accessibility
purposes” (Android Police, 2017).
Finally, regarding web pages, it is worthwhile
to notice that since Nougat apps may not access
any content of /proc/ beyond /proc/[pid]/ where
[pid] is their own pid. Therefore, access to
/proc/net/tcp6 is not possible which would allow
an app to infer the domain that another app tries to ac-
cess. Hence, the only available ways to intercept the
network usage seem to be by re-routing the network
traffic through a local proxy or a VPN. Either of these
cases introduces its own security and trust constraints.
For instance, the use of a local proxy implies that self-
signed certificate must be installed with the latter trig-
gering a security notification in Android and implying
further trust issues. In both cases (local proxy/VPN)
one has access to all the user’s unencrypted traffic.
4 PROPOSED SOLUTION
In this section, we describe our proposed solution re-
garding the resulting application. It should be noted
that the backend of our app implements a specific
use case of our online service, also called “SmartPat-
tern”, which works as an authorization/authentication
mechanism of a service that allows protecting any ex-
ternal resource through “Smart Patterns” (using an
API, Oauth2 or JWT). At present, the app focuses
on securely locking specific apps inside the Android
ecosystem. The OS itself could adopt the described
ICISSP 2019 - 5th International Conference on Information Systems Security and Privacy
148