Showing posts with label permission. Show all posts
Showing posts with label permission. Show all posts

Thursday, September 7, 2017

Thoughts about enhancing application permission control

Thoughts about enhancing application permission control



It occurred to me and (a lot of other people, as will be shown) that with Android applications, it may be useful to extend permission management for installed applications to enable logging/auditing or finer grained control. I remembered seeing some application which provided some of that functionality, but was unsure of exact details. Since this area of Android just might be suitable for me to try some enhancements, it seemed appropriate to explore the following points:

  • What existing solutions or ideas are available for extending Androids permission system? What are their principles of operation?
  • How does the Android system enforce Application permissions, and where is the relevant component in its source code?
  • What can malware do with regard to application permissions

The existing application / modification and how these work

It turns out that there have been a couple of similar attempts to enhance permissions on android, below listed in no particular order:
  • PDroid, made by xda-developers.com community members. Consists of Android source patches and controlling user application. The patches modify system services which provide data for telephony, location and similar API calls (TelephonyManager, LocationManager, ...), creating wrappers for these components. The wrapper components check for application-set rules for handling permissions or logging. Patches (source) available, but application is closed-source.
  • Cyanogenmod had modifications in the system components and application (UI) for revoking specific permissions to applications. Applications behaved as though the permission was not requested at install time by the application, and may crash. Theese extensions are no longer present in newer versions (since they caused applications to misbehave, become incompatible, etc.)
  • papers Android Permissions Demystified, APEX, and a few other referenced therein. These enhancements have different approaches, goals or implementations which are described well in the respective papers, but do not have source code available.
  • a few proprietary or commercial tools such as LBE Privacy Guard

Identifying components in Android system which grant permissions when application does an action which requires permission

Androids developer documentation on permissions outlines general situations when permissions are necessary: API calls for activity or services, accepting data from other applications (receiving broadcasts) or providing it (content providers).

The documentation also shows actual permissions required for calls to certain parts of the API. A somewhat useful representation of this is the permission map  which was created from the API as part of the Android Permissions Demystified project mentioned above.

The aforementioned papers Android Permissions Demystified and APEX provide a description of how the permissions are checked, around page 3, or pages 5, 6, section 4, for the two papers respectively. A summary of this follows. When an application calls an API method, the call is propagated through Androids inter-process communication to the system service which can service the API request (example: LocationManagerService provides location). The system component classes must check for permissions regarding to the action, using methods such as checkPermission, enforcePermission from Context (be it Activity, Service or other context). The actual decision is done in the PackageManagerService which grants or denies permissions depending on those requested at install time.

How simple malware might be done, relating to permission management

Some permissions in the Android system are broad, while others are fine-grained. An example of broad permission is the INTERNET permission, which allows any socket access. Malicious applications might claim to be using the permissions for some legitimate and benign task, while in reality that permission allows it to do additional malicious functionality.


download file now

Read more »