# PerHelper: Helping Developers Make Better Decisions on Permission Uses in Android Apps
## 3 A Taxonomy of Permission-Related Issues
### The Permission Gap Problem
#### 3.2.2 Permission Underprivilege  
In contrast to permission overprivilege, the issue of _permission underprivilege_ has not been raised very often. Generally, related functionalities in the app would be affected if certain permissions are missing. Furthermore, these apps may throw _SecurityException_ when it invokes an API method that requires a certain permission, but the developer has forgotten to declare it. This would lead to the app crashing, which is the last thing a developer wants to see. In order to explore this issue, we analyzed 958 popular apps from 10 app categories on Google Play. For each app, we first calculated the \(DPS\) for an app from the Android Manifest file. Then, we used methods in [12] to estimate the \(UPS\) for each app. Finally, we compared the differences between the two sets to determine whether permission underprivilege exists. The statistics on underprivileged apps are shown in Table 1. It is somewhat surprising to discover that more than 90% of apps are underprivileged; in particular, more than 98% of apps in the _ENTERTAINMENT_ category are underprivileged. On average, an underprivileged app uses nearly four permissions that are not declared. When we looked into this issue, we found that there were generally two reasons behind it: ignoring the permissions required by third-party libraries and using the wrong permissions. **Third-party libraries. ** Developers include third-party libraries in their apps to enrich the functionality or meet other purposes [36]. Third-party libraries have occupied a large portion of code in Android apps [50]. Third-party libraries of Android also follow the Android permission model, so developers are required to include permissions used by these libraries in the Android Manifest file as well. However, when developers declare permissions in the corresponding manifest file, they typically consider only their custom-written code, instead of the requirements of other libraries. Thus, it is possible that developers miss some permissions requested by third-party libraries, which would lead to permission underprivilege, whose implications for developers have been discussed above. Another phenomenon, first introduced in [51], is that some ad libraries may try to dynamically check certain permissions and make use of these permissions to invoke certain API methods if they \begin{table}
\begin{tabular}{l c c c} \hline \hline
**Category** & **\# of Underpriv.Apps** & **\% of Apps** &
\begin{tabular}{c} **Average \# of under Declared** \\ **Permissions** \\ \end{tabular} \\ \hline WALLPAPER & 90 & 84.1\% & 3.23 \\ \hline WIDGETS & 98 & 95.1\% & 4.60 \\ \hline BOOKS AND & 98 & 93.3\% & 3.43 \\ REFRENCE & 91 & 86.7\% & 3.48 \\ \hline BUSINESS & 91 & 86.7\% & 3.48 \\ \hline COMICS & 97 & 89.8\% & 3.06 \\ \hline EDUCATION & 94 & 89.5\% & 5.62 \\ \hline ENTERTAINMENT & 105 & 98.1\% & 3.84 \\ \hline FINANCE & 91 & 86.7\% & 3.53 \\ \hline LIFESTYLE & 101 & 96.2\% & 4.33 \\ \hline TOOLS & 93 & 88.6\% & 4.70 \\ \hline TOTAL & 958 & 90.8\% & 3.98 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Permission underprivilege analysis results. are available to the apps. For example, the app \"cn.leave.sdclean\" is a cleanness tool for the SD card. It does not declare any location permissions, but we find that there are some location-related API invocations in the libraries it contains, such as _\"baidu/mobstats\"_, _\"google/ads\"_, _\"imnobi\"_, and _\"kyview\"_. According to a recent study on ad libraries, 27% of apps among 63,105 apps have at least one permission used by the libraries, but unused by the apps' main logic [29]. This indicates that developers would need to declare extra permissions for third-party libraries after completing the declaration of their own code, which can be annoying and may cause mistakes. **Wrong permission usage. ** Another reason behind the permission underprivilege is that some permissions are not declared because of the carelessness of or mistakes by developers.