Nativeguard: Protecting Android Applications From Third-Party Native Libraries
Nativeguard: Protecting Android Applications From Third-Party Native Libraries
Native Libraries
interact with objects in the client process. Another set of in the Zlib library calls GetFieldID to obtain the JNI iden-
AIDL interface methods are hence provided for this purpose. tifier of a field.
More details are discussed in Section 5.3 and Section 5.4, re-
JNIEXPORT void JNICALL
spectively.
Java_java_util_zip_Inflater_initIDs
We next walk through the basic process of native code iso-
(JNIEnv *env, jclass cls){
lation in NativeGuard using a native method example from
...
libjni_filtershow_filters.so, a widely-deployed native
jfieldID strmID =
library for photo editing. The example we present is image-
(*env)->GetFieldID(env, cls, ‘‘strm’’, ‘‘J’’);
FilterVibrance_nativeApplyFilter, a native method that
...
applies the vibrance effect to a photo. The first step is to ex-
}
tract the original library and replace it with a proxy library.
The proxy library contains a proxy function for each native- In the above code, GetFieldID returns the identifier of
method implementation. The second step is to write/gener- the field “strm” in the Inflater class, which can later be used
ate mandatory components shown in dashed boxes in Fig- to read from or write to the field. Note that the first two
ure 2, put them in the two new applications, build and de- parameters of a native-method implementation are special:
ploy them respectively. The following steps outline what a JNI interface pointer, and a reference to the Inflater object
happens when the user starts the instrumented application or the Inflater class in the case of static native methods,
from the device. similar to this pointer in C++ or Java. The cls bolded in
(1) When the application is launched by the user, the client the code above is the reference to the Inflater class.
application is started first, which sends out an intent. After NativeGuard’s isolation, the implementation of ini-
The service application starts and responds to the in- tIDs is migrated to the service application. Hence when in-
tent. The client is then bound to the service. voked, cls in initIDs becomes the reference to the service
(2) When the application loads the native library, it loads class and is no longer the one that it is expecting.
the proxy version of libjni_filtershow_filters.so As briefly discussed in the preceding section, NativeG-
on the client side. uard’s solution is to introduce a stub library between the
(3) When the imageFilterVibrance_nativeApplyFilter na- Java code and the real native libraries in the service appli-
tive method is invoked, the control transfers to the proxy cation. The stub library maintains a proxy JNI interface
method. The proxy method performs a function call to pointer structure in the service application, but with func-
the corresponding AIDL interface method. tion pointers to the AIDL interface methods for JNI func-
(4) When the AIDL interface method for imageFilterVi- tions. When the stub function calls the real target function
brance_nativeApplyFilter is called, the control trans- (the last step discussed in Section 5.2), it passes the proxy
fers to the service application. The service application JNI interface pointer to the corresponding native library.
loads the stub library if it is not yet loaded and performs Hence, when native code in the isolated library invokes a
a native method call to the corresponding stub function. JNI function via the proxy interface pointer, the control is
(5) The stub function takes over the control and (a) uses transferred to an AIDL interface method, which performs
dlopen to load the real library in the service process if IPC and jumps back to the client application and the real
it has not been loaded; (b) uses dlsym to find the ad- JNI function is called. Note that opaque references must
dress of imageFilterVibrance_nativeApplyFilter in be retained so that correct objects could be retrieved when
the real library; and (c) performs a function call to the JNI function calls are redirected back to the client applica-
real target function. tion. In the example above, the value of cls is mandatory
to find the field ID and thus cannot be lost. In NativeGuard,
5.3 Supporting JNI Calls one more argument is added to the AIDL interface methods
Native code may use JNI functions to manipulate Java ob- for native method calls. When a proxy method calls to the
jects or call Java methods. For instance, the following native AIDL interface (step (2) in Section 5.2), it passes in this
method initIDs extracted from class java.util.zip.Inflater reference value. The reference is kept all the way down to
the native code in the service application so that all JNI droid_runtime, a system native library in Android. Since
calls within this context could be properly handled back in our purpose is to isolate untrusted, third-party native li-
the client application. braries, system libraries are considered trusted. Hence, when
The benefit of this design is threefold. First, isolated na- a native library is isolated in the service application and tries
tive code still follows the same syntax for invoking JNI func- to modify a Bitmap object via the NDK API, its behavior
tions and thus need not be aware of the isolation. Second, cannot be predicted, because the pointer cached can only be
only references are marshalled across processes, not Java interpreted in the client application and does not point to a
objects. This brings down the overhead caused by IPC as valid object in the service application.
object marshalling is very expensive. Also it makes the solu- To support these NDK API function calls after isolation,
tion source-code free, as reference marshalling in AIDL does NativeGuard intercepts an API invocation and marshalls re-
not depend on the implementation details of objects. Last, lated objects to the service application before the real API
no global references are necessary in the proxy libraries on function is run. For instance, if a sandboxed native library
the client side, as JNI function invocations in the service ap- invokes the libjnigraphics API, NativeGuard provides a
plication always stay within the context of a native-method fake libjnigraphics in the service application, which uti-
call, where local references are valid during the period. lizes the dedicated AIDL interface to transport the Bitmap
In addition, the proxy JNI interface provides a natural object from the client before calling the real API function.
place for performing runtime type checking on the JNI. As Correspondingly, updated Bitmap objects are marshalled
we have discussed, misuse of the JNI interface by the na- back when native code finishes its work on the pixels, specif-
tive code can cause confidentiality and integrity violations. ically, when it calls AndroidBitmap_unlockPixels, the API
Therefore, NativeGuard performs checks in the proxy JNI function that indicates the end of the native modification.
interface to ensure type safety of JNI calls. The implementa- We next make a few clarifications. First, we can easily
tion of these checks follows previous JNI checking systems, marshall Java objects like the Bitmaps as long as they sup-
including Arabica [22] and Jinn [12]. We omit a detailed port the Parcelable interface, which allows the system to
description. decompose objects into primitives that can cross the process
boundary. If not, then we have to implement the Parce-
5.4 Supporting NDK API Function Calls lable protocol for the object on our own, which may or
may not be difficult, depending on the composition of the
Ideally, native libraries interact only with Java code: they
object. Second, not all NDK libraries encounter the situa-
are not dependent upon each other albeit belonging to the
tion discussed in this section. Our prototype implementa-
same Android application. In this case, it is sufficient to
tion provides support for libjnigraphics, the library we
support only the JNI interface in our framework as native
discussed earlier, and the OpenSL ES native audio library.
libraries perform computation tasks and only communicate
with the rest of the program via the JNI interface. The re-
ality, however, is different when a few special NDK libraries 5.5 Managing Native Code Permissions
are involved. The basic idea of limiting privileges of native code in Na-
The NDK provides a set of API functions for native code tiveGuard is to better use the Android permission mech-
to fulfill various tasks. Besides traditional libc support, the anism. Following the principle of least privilege (POLP),
API also includes headers of OpenGL libraries for 3D ren- native libraries are isolated in another application with only
dering, libjnigraphics headers for bitmap pixel manipula- the minimum mandatory permission set granted. We next
tion, and so on. As a simple example, native code may discuss how the POLP principle is enforced in NativeGuard.
invoke AndroidBitmap_lockPixels implemented in libjn- Based on the guideline of the NDK and how native code
igraphics to grab the lock on a Java Bitmap object and is managed under current Android framework, we infer that
acquire a pointer to the pixel buffer of the object, through native code itself seldom requires any permission. First
which direct access to pixels is supported. In fact, many of all, the NDK may only be beneficial when used with
applications and libraries provide photo filter functionalities self-contained libraries that perform CPU-intensive opera-
based on API functions in libjnigraphics, including lib- tions [8], which are not likely to access system resources or
jni_filtershow_filters.so, the example library we intro- devices protected by permissions. Second, native code is not
duced in Section 5.2. allowed to interact directly with the system API and must
It turns out that in some NDK libraries, manipulation call back to Java via the JNI interface to visit protected re-
on Java objects is directly performed via native pointers, sources [7]. In this case, permissions are enforced on the API
rather than through the JNI interface. In these cases, Java calls, not native libraries; JNI function calls do not require
objects are only “wrappers” of native data structures, which any permission either. The only circumstance under which
are allocated in native methods implemented in system na- native code does require permissions is when native code di-
tive libraries. In the above example, the underlying im- rectly accesses system resources not protected by the system
plementation of AndroidBitmap_lockPixels first calls Get- API. For instance, a native library may open and write to a
IntField to obtain the value of an integer field, specifically, file on the SD card without calling back to Java, and hence
mNativeBitmap in the Java Bitmap object, then casts the requires the WRITE_EXTERNAL_STORAGE permission itself.
integer to a SkBitmap pointer, through which the Bitmap To the best of our knowledge, there is no official document
pixels can be directly modified. By further tracing down the or previous research that sheds light on how native func-
calling sequence, we find that the Bitmap object is created tions, library calls or NDK APIs are connected to the per-
by calling a native method nativeCreate, which (1) allo- mission model. Intuitively, native code’s access to protected
cates a new SkBitmap object; (2) casts the pointer value to resources is fulfilled by system calls and the permission check
an integer; and (3) caches the integer to the mNativeBitmap is performed in the Linux kernel. But it is hard to decide
field. nativeCreate, however, is implemented in liban- whether a system call requires an Android permission as it
AppOriginal.apk slight modifications to the launcher classes. Apktool can un-
apktool
pack an APK file into resources and smali code, a human-
readable format for the Dalvik bytecode, where the basic
AndroidManifest.xml Java Bytecode Other Resources Native Libraries information of the program, such as method names and na-
objdump tive method signatures, is available. It can also rebuild them
NDK Libs Needed into an APK file after some modifications. Second, we in-
Launcher Classes Other Classes corporate the objdump from the NDK toolchain, which can
Native Methods
Signatures dump an Android native library built by the toolchain to
reveal information regarding library dependency. The main
Code Generator
steps of the separation process are as follows.
(1) Apktool unpacks the input APK file.
ClientApp.apk ServerApp.apk
(2) The AndroidManifest.xml file is parsed to locate launcher
class(es).
Figure 3: Workflow of the Application Separator. (3) All smali files are analyzed to record signatures of native
methods.
(4) Native libraries are dumped to record the dependency
may be dependent on its parameters. As a simple example, to NDK libraries.
the system call open requires the WRITE_EXTERNAL_STORAGE (5) Based on information collected above, the code genera-
permission when opening a file on the SD card with the write tor generates extra AIDL interfaces and library code. It
access, but requires no permission when opening a private also adds mandatory smali code to the launcher class(es)
file of the application or opening a file on the SD card with for service binding.
the read-only access. Furthermore, since NativeGuard aims (6) In the end, two applications are built as the output.
to defend threats of untrusted native libraries in arbitrary NativeGuard is implemented in Java and is comprised of
Android applications from online stores, where source code about 2,000 lines of Java code and about 20 template files
of the native libraries is not available, it is even harder to for fast code generation. In addition, it incorporates apktool
find the minimum permission set efficiently solely from the 1.5.2 and objdump from the NDK Revision 8c. We choose
binary. Java as the implementation language because the package
Hence, we decide to follow a heuristic approach and by installer in Android is written in Java. Therefore, Native-
default grant no permission to the service application in Na- Guard can be incorporated into the package installer in the
tiveGuard. The approach is motivated by the observation future, which provides users a completely transparent solu-
that it is rare for legal native code to perform privileged tion for native code isolation.
operations, as it is a “bad practice” according to the NDK.
In fact, as we will present in Section 6, the heuristic works 6.2 Evaluation
with all real applications that NativeGuard has been tested We carried out a three-stage evaluation to fully test Na-
on (around 30 applications). On the other hand, the draw- tiveGuard’s functionality and performance. First, we cre-
back is that the approach does not support native code that ated an illegal native library that abuses granted permis-
requires privileged access to the devices. As a remedy, Na- sions to test the effectiveness of NativeGuard’s defense. Af-
tiveGuard also supports a configuration file through which a terwards, NativeGuard was tested on dozens of applications
developer can manually grant permissions to native libraries. in various categories that are among the most downloaded
applications in Google Play. For performance testing, it was
6. IMPLEMENTATION AND EVALUATION evaluated both on a representative benchmark suite and on
In this section, we first present the prototype implemen- a hand-crafted benchmark program. Experiments were con-
tation of NativeGuard. Then we discuss its evaluation, on ducted on a Nexus 4 smartphone running Android 4.3. All
both benchmark programs and real-world applications. performance numbers were averaged over 10 runs.
Functionality testing. We have manually created a test
6.1 Prototype Implementation native library, which directly accesses the location informa-
The thrust of this project, as we have discussed, is to de- tion of a phone without going through the Java side (assum-
sign a framework that isolates untrusted native libraries in ing the application has been granted the location-access per-
Android applications downloaded from online stores. Hence, mission). In Android, most system resources are protected
we implemented NativeGuard as an “application separator”, by privileged Java API methods, which are implemented in
which takes as input an APK package and generates two a trusted system process [7]. A typical native library has
APK files: the client and the service applications. As pre- to invoke the corresponding API method through method-
sented in Section 5, the client contains Java bytecode and invocation functions in JNI in order to access the privileged
other resources from the original application, the service iso- resource. In contrast, our test native library directly talks
lates native libraries and by default does not require any to the system process and obtains the location information
permission. In addition, NativeGuard also supports a con- without going through the Java API.
figuration file, where permissions can be manually granted The test library demonstrates that malicious native code
to the service application upon separation. can take advantage of permissions that are not really needed
Figure 3 shows the separation process in NativeGuard. to cause security violations. NativeGuard can improve this
At a high level, NativeGuard is composed of a code genera- situation. For the test native library, we used NativeGuard
tor, and two third-party tools. First, we utilize apktool [1], to isolate it into a service application with no permissions
an open-source tool for Android application reverse engi- and thus its access to the location information was denied
neering, to extract native-method information and to make due to lack of permissions.
Benchmark Size of Data Set Overhead Buffer Size Overhead Context Switches
jpeg 20 KB 17.16% (per millisecond)
lame 177 KB 1.12% 1KB 183.13% 31.89
2585 KB 0.87% 2KB 107.49% 25.98
tiff2bw 6662 KB 7.83% 4KB 55.02% 18.51
27873 KB 2.08% 8KB 34.36% 9.81
tiff2rgba 6662 KB 3.14% 16KB 26.64% 3.96
27873 KB 0.54%
tiffdither 2223 KB 14.37% Table 3: Extreme-case runtime overheads on the
9303 KB 1.40% Zlib benchmark application.
tiffmedian 6662 KB 5.11%
27873 KB 2.32%
In general, NativeGuard shows moderate overheads on
Table 2: Runtime overheads on MiBench bench- MiBench programs. The benchmarks all utilize native li-
marks. braries to perform CPU-intensive operations, such as im-
age compression and conversion, and thus do not frequently
make context switches. The result table also confirms the
Real-world applications testing. We collected a total correlation between the overhead and the context switch in-
of 30 applications from the official Google Play store to tensity: programs on large data sets show less performance
test NativeGuard’s functionality on real applications. The overheads, as they stay longer in the service application be-
applications are collected from different categories and are fore switching back. Since native libraries in MiBench pro-
on the “top” charts of the store in November 2013. Note grams are representative candidates for the Android NDK,
that tested applications are not strictly the overall top 30 NativeGuard is promising to incur modest overhead on iso-
ones, as we intended to exercise our framework on applica- lating a majority of native libraries in popular applications.
tions providing diverse functionalities and containing differ- Another important factor to evaluate on mobile devices
ent native libraries. Our framework succeeds on 28 out of is the overhead posed on memory and storage, which are
30 applications. It fails on two applications because of the both limited resources on smartphones. Although for an
apktool, which fails either in the disassembling stage be- application with native libraries, users with NativeGuard
fore separation or in the assembling stage after separation. now have to keep two applications running simultaneously,
Applications after separation are tested manually, as exist- the increase of memory utilization turns out to be moderate:
ing automatic testing tools that generate random inputs are NativeGuard introduces only 11.81% of memory overhead on
not sufficient for our purpose. Since we want to make sure the ported MiBench application, according to data reported
the native libraries are loaded and used during testing, it is by Android’s dumpsys tool. Moreover, NativeGuard shows
much safer to just manually play with the instrumented ap- a tiny 130KB increase on the size of the application, being
plications and exercise various functionalities provided. For only 7.11% of the original.
example, some applications require signing in before using But what if the isolated library does make frequent con-
any meaningful functions. In these cases, automatic testing text switches? To further understand the performance of
frameworks are more likely to fail in exercising native code. NativeGuard in extreme cases, we carried out another set of
During our testing, we could perceive slightly longer re- hand-picked benchmark programs. The programs compress
sponse delays in some applications and use cases. For ex- a medium-sized file stored on the device using the popular
ample, photo filters may take extra time to render a pic- Zlib library. When the user presses the start button on the
ture. But in general, NativeGuard introduces acceptable user interface, the Java side of the application divides the
overhead and does not affect the functionalities delivered by file into data segments of smaller sizes and passes a data
the applications. Details regarding evaluated applications segment through a buffer to Zlib, which performs the com-
are presented in Appendix A. pression and returns the result to the Java side. Then the
Java side passes the next segment of data. Hence, when the
Performance evaluation. For a security framework uti-
Zlib library is sandboxed, the size of the buffer is strongly
lizing process isolation, the runtime overhead of NativeG-
correlated to the performance overhead, as a smaller buffer
uard depends greatly on the intensity of context switches,
results in more frequent context switches between Java and
e.g. the frequency of IPC. If isolated native libraries are
native code. We conducted experiments with different buffer
typical “good candidates” for the NDK and do not involve
sizes and the results are presented in Table 3.
lots of context switches, the overhead caused by NativeG-
As shown in the table, the runtime increase of NativeG-
uard should be small.
uard on the Zlib benchmark demonstrates the similar trend:
We first evaluated NativeGuard on MiBench [9], a free and
as the buffer size increases, the performance overhead de-
open-source benchmark suite for embedded systems. The
creases. The performance penalty can be as high as near
suite provides six categories of benchmark programs for dif-
two times when extremely intense context switch happens.
ferent purposes in real-world applications, and testing data
In summary, the experiments demonstrate that the ap-
sets of various sizes. MiBench is not Android-ready. We
proach of process isolation brings security to untrusted na-
picked several benchmarks under the Consumer category (a
tive code, and with modest overhead on most real-world ap-
category for consumer devices, like PDAs and smartphones)
plications where context switches between Java and native
and ported them to Android. Table 2 presents the results.
code are not frequent.
7. RELATED WORK 19]), application repackaging and malware detection (e.g., [30,
We next discuss related work in two categories: techniques 24]), and privilege escalation attacks (e.g., [14, 15]). Though
for sandboxing untrusted components from a trusted envi- in a different context, AdSplit and AFrame are in spirit sim-
ronment, and previous studies on Android security. ilar to our framework, as they isolate advertising libraries
into separate processes [20, 28]. To display both the ad-
Untrusted code isolation. It is always desirable to iso- vertisement and the host application on the screen after
late untrusted code to prevent uncontrolled access or mali- separation, AdSplit follows an emulation approach to al-
cious compromise to the trusted environment and there have low two activities to share the screen, while AFrame sup-
been various approaches. Language-based isolation ensures ports embedded activities. Both of them require changes to
the security of untrusted code by utilizing static types [17] the system. In comparison, NativeGuard isolates native li-
or object-capability models [16, 11], but it is tied to a spe- braries into a service application that does not interact with
cific language. Isolation based on virtual machines regu- the user, avoiding unnecessary modifications to the Android
lates untrusted code by building a safety-oriented platform framework. Moreover, a number of systems have been de-
(e.g., [3]), which is a clean solution but incurs severe perfor- signed to improve the permission system’s granularity and
mance penalty. In comparison, NativeGuard utilizes hardware- flexibility (e.g., [18, 32]). These studies increase the power
based process isolation, which has long been used in various of the permission model, but requires changes to the system.
operating systems to isolate untrusted components [4, 23]. They also risk overprompting users to make security-related
Process isolation suffers from high performance overhead decisions. By contrast, our framework reuses the current
with frequent interprocess communication, but can provide permission model, where users still receive the same infor-
flexible and robust isolation if used with clever optimiza- mation when installing applications.
tions. For instance, Codejail isolates untrusted libraries into
a jailed process and incurs acceptable overhead on libraries
that are tightly coupled with the main program [26]. 8. FUTURE WORK
With regard to sandboxing untrusted native code in for- Some parts of NativeGuard can be improved. The next
eign function interfaces, NativeGuard is similar to several step is to incorporate NativeGuard into the Android package
previous frameworks. Klinkoff et al. designed a system installer. NativeGuard is currently implemented as a com-
that sandboxes unmanaged native code in the .NET frame- mand line tool, which genereates APK packages according
work [10], but relies on a kernel add-on module to control to user commands. If integrated into the Android package
system calls in untrusted code. Robusta adopts software- installer, it would bring conveniece to end users; they can
based fault isolation (SFI) [25] and puts native libraries in download, isolate native libraries, and perform installation
Java programs into an SFI sandbox [21]. In terms of per- in a streamlined process.
formance, it compares favorably to other sandboxing frame- We also plan to explore techniques that efficiently de-
works thanks to SFI, but relies on nontrivial modification to cide the minimum permission requirement of native binaries.
the internal of a Java Virtual Machine. Arabica improves Currently our framework relies on a heuristic, which worked
Robusta and achieves JVM-portability through clever use well in our multistage evaluation, but cannot support legiti-
of the Java Virtual Machine Tool Interface (JVMTI) [22], mate libraries that do require permissions. Since native code
which, unfortunately, is not available for the Dalvik Virtual may directly access some system resources through system
Machine on Android. On the contrary, NativeGuard reuses calls, it would be a good starting point to build a permission
Android’s permission model and does not need support for map to connect system calls to permission requirements.
special interfaces or plug-ins, hence is ready to deploy on
any Android system.
9. CONCLUSIONS
Android safety and security. As the most widely-adopted
smartphone OS worldwide, Android has attracted much at- Although the Android platform has a sophisticated secu-
tention from academia in recent years. A couple of empirical rity architecture for Java code, native libraries are uncon-
studies provided more complete view of Android application trolled. Given the increasing popularity of Android devices
security and its permission model. For example, Enck et al. and insufficient research, native libraries pose pressing chal-
designed a Dalvik decompiler ded and performed analysis on lenges to the security of the Android ecosystem. In this pa-
1,100 Android applications [6]. Their work produced many per, we have proposed NativeGuard, a security framework
findings, some of which might lead to ways of exploiting that isolates native libraries into a non-privileged applica-
Andrioid. Felt et al. established a mapping between the tion. NativeGuard requires no change to the Android sys-
Android API and the permissions, and shed light on the tem, nor does it require access to an application’s source
pervasive overprivilege problem in Android applications [7]. code. It incurs modest runtime overhead on tested real-
PScout utilizes static analysis to further improve the com- world applications, in which interprocess communication is
pleteness of the mapping and reveals the state of the art in not intensive. We believe that our study is a good starting
newer Android versions [2]. Their work is a strong motiva- point for future security research on native code in Android.
tion of NativeGuard as many applications are overprivileged
with security-critical permissions, which are not needed by Acknowledgments
native libraries. Recent studies have presented various sys-
tems (e.g., TaintDroid [5] and VetDroid [29]) to detect user We thank anonymous referees of WiSec ’14 for detailed com-
privacy and information leaks, which increased the overall ments on an earlier version of this paper. This research is
security of Android, but left native libraries unmonitored. supported by US NSF grants CCF-1217710, CCF-1149211,
Much work has been performed to address various aspects and a research award from Google.
of Android security, for example, advertisements (e.g., [20,
10. REFERENCES
[1] android-apktool. [21] J. Siefers, G. Tan, and G. Morrisett. Robusta: Taming the
https://code.google.com/p/android-apktool/. native beast of the JVM. In 17th CCS, pages 201–211, 2010.
[2] K. W. Y. Au, Y. F. Zhou, Z. Huang, and D. Lie. Pscout: [22] M. Sun and G. Tan. JVM-portable sandboxing of Java’s
Analyzing the android permission specification. pages native libraries. In 17th European Symposium on Research
217–228, 2012. in Computer Security (ESORICS), pages 842–858, 2012.
[3] R. S. Cox, S. D. Gribble, H. M. Levy, and J. G. Hansen. A [23] M. M. Swift, M. Annamalai, B. N. Bershad, and H. M.
safety-oriented platform for web applications. In IEEE Levy. Recovering device drivers. In USENIX Symposium on
Symposium on Security and Privacy (S&P), pages Operating Systems Design and Implementation (OSDI),
350–364, 2006. pages 1–16, 2004.
[4] J. R. Douceur, J. Elson, J. Howell, and J. R. Lorch. [24] T. Vidas and N. Christin. Sweetening android lemon
Leveraging legacy code to deploy desktop applications on markets: Measuring and combating malware in application
the web. In USENIX Symposium on Operating Systems marketplaces. In Proceedings of the Third ACM Conference
Design and Implementation (OSDI), pages 339–354, 2008. on Data and Application Security and Privacy, CODASPY
[5] W. Enck, P. Gilbert, B.-G. Chun, L. P. Cox, J. Jung, ’13, pages 197–208, 2013.
P. McDaniel, and A. N. Sheth. Taintdroid: An [25] R. Wahbe, S. Lucco, T. Anderson, and S. Graham. Efficient
information-flow tracking system for realtime privacy software-based fault isolation. In ACM SIGOPS
monitoring on smartphones. In USENIX Symposium on Symposium on Operating Systems Principles (SOSP),
Operating Systems Design and Implementation (OSDI), pages 203–216, New York, 1993. ACM Press.
2010. [26] Y. Wu, S. Sathyanarayan, R. H. Yap, and Z. Liang.
[6] W. Enck, D. Octeau, P. McDaniel, and S. Chaudhuri. A Codejail: Application-transparent isolation of libraries with
study of android application security. In 20th Usenix tight program interactions. In 17th European Symposium
Security Symposium, pages 21–21, 2011. on Research in Computer Security (ESORICS), pages
[7] A. P. Felt, E. Chin, S. Hanna, D. Song, and D. Wagner. 859–876, 2012.
Android permissions demystified. In 18th CCS, pages [27] Z. Yang, M. Yang, Y. Zhang, G. Gu, P. Ning, and X. S.
627–638, 2011. Wang. Appintent: Analyzing sensitive data transmission in
[8] Google. Android ndk. http: android for privacy leakage detection. In 20th CCS, 2013.
//developer.android.com/tools/sdk/ndk/index.html. [28] X. Zhang, A. Ahlawat, and W. Du. AFrame: Isolating
[9] M. Guthaus, J. Ringenberg, D. Ernst, T. Austin, advertisements from mobile applications in Android. In
T. Mudge, and R. Brown. Mibench: A free, commercially Proceedings of the 29th Annual Computer Security
representative embedded benchmark suite. In Workload Applications Conference, 2013.
Characterization, 2001. WWC-4. 2001 IEEE International [29] Y. Zhang, M. Yang, B. Xu, Z. Yang, G. Gu, P. Ning, X. S.
Workshop on, pages 3–14, 2001. Wang, and B. Zang. Vetting undesirable behaviors in
[10] P. Klinkoff, E. Kirda, C. Kruegel, and G. Vigna. Extending android apps with permission use analysis. In 20th CCS,
.NET security to unmanaged code. Internation Journal of 2013.
Information Security, 6(6):417–428, 2007. [30] W. Zhou, X. Zhang, and X. Jiang. Appink: Watermarking
[11] A. Krishnamurthy, A. Mettler, and D. Wagner. android apps for repackaging deterrence. In 8th ACM
Fine-grained privilege separation for web applications. In Symposium on Information, Computer and
Proceedings of the 19th International Conference on World Communications Security, pages 1–12, 2013.
Wide Web (WWW ’10), pages 551–560, 2010. [31] Y. Zhou, Z. Wang, W. Zhou, and X. Jiang. Hey, you, get
[12] B. Lee, M. Hirzel, R. Grimm, B. Wiedermann, and K. S. off of my market: Detecting malicious apps in official and
McKinley. Jinn: Synthesizing a dynamic bug detector for alternative android markets. In Network and Distributed
foreign language interfaces. In PLDI, pages 36–49, 2010. System Security Symposium(NDSS), 2012.
[13] S. Liang. Java Native Interface: Programmer’s Guide and [32] Y. Zhou, X. Zhang, X. Jiang, and V. W. Freeh. Taming
Reference. Addison-Wesley Longman Publishing Co., Inc., information-stealing smartphone applications (on android).
1999. In Proceedings of the 4th International Conference on
[14] L. Lu, Z. Li, Z. Wu, W. Lee, and G. Jiang. Chex: Statically Trust and Trustworthy Computing, pages 93–107, 2011.
vetting android apps for component hijacking
vulnerabilities. pages 229–240, 2012.
[15] T. Markmann, D. Gessner, and D. Westhoff. Quantdroid:
APPENDIX
Quantitative approach towards mitigating privilege A. EVALUATION OF APPLICATIONS
escalation on android. In IEEE International Conference
on Communication, pages 2144–2149, 2013. Detailed information about applications evaluated in Sec-
[16] A. Mettler, D. Wagner, and T. Close. Joe-E: A tion 6 is shown in Table 4. Notice that a “*” besides the
security-oriented subset of Java. In Network and version number or the size of an application indicates that
Distributed System Security Symposium(NDSS), 2010. the version or the size of that application varies with differ-
[17] G. Morrisett, D. Walker, K. Crary, and N. Glew. From ent devices, and the number shown in the table is the one
System F to typed assembly language. ACM Transactions for our testing device and system. There is no information
on Programming Languages and Systems, 21(3):527–568,
May 1999.
for native libraries in PlayKids, because apktool fails to dis-
[18] M. Nauman, S. Khan, and X. Zhang. Apex: extending assemble the application. For DJ Studio 5, we include its
android permission model and enforcement with native libraries and dependencies in the table, but apktool
user-defined runtime constraints. In 5th ACM Symposium fails to rebuild the application after disassembling. Further
on Information, Computer and Communications Security, experiments show that the failure is not resulted from the in-
2010. strumentation of NativeGuard, as apktool fails to build the
[19] P. Pearce, A. P. Felt, G. Nunez, and D. Wagner. Addroid: application even without any change after disassembling.
Privilege separation for applications and advertisers in
android. In 7th ACM Symposium on Information,
Computer and Communications Security, 2012.
[20] S. Shekhar, M. Dietz, and D. S. Wallach. AdSplit:
Separating smartphone advertising from applications. In
21th Usenix Security Symposium, 2012.
Category App Version Size Native Libraries Needed
NDK Libraries
Photography Snap Camera HDR 2.1.4 5.3M libjni eglfence.so
libjni filtershow filters.so libjnigraphics.so
libjni mosaic.so
Photo Editor by Aviary 3.1.1 10M libaviary moalite.so
libaviary native.so libjnigraphics.so
libexif extended.so
Photo Editor 1.3.13 1.9M libIUDeskImageFilter.so libjnigraphics.so
libIUDeskJpegCodec.so libjnigraphics.so
Social Snapchat 4.0.20* 7.5M* libphotoeffect.so libjnigraphics.so
ooVoo 2.0.4 21M libovmedia-v7a.so libjnigraphics.so
libGLESv2.so
Badoo - Meet New People 2.27.3* 19M libScanPay.so
Communication WhatsApp Messenger 2.11.109 11M libframeconv.so
AntiVirus Security 3.4.2.1* 9.5M* libdeng.so
Handcent SMS 5.3 6.0M libhccommon.so
libmms2gif.so
libspeex.so
Tools Brightest Flashlight Free 2.4.1 1.2M libndkmoment.so
GO Keyboard 1.9.11 5.3M libMFtInput.so
Android Terminal Emulator 1.0.53 456k libjackpal-androidterm4.so
Shopping eBay 2.5.0.31* 10M* libredlaser.so
Walgreens 4.1 18M libaviary moalite.so
libaviary native.so libjnigraphics.so
libexif extended.so
Out of Milk Shopping List 4.1.6* 8.9M* libscanditsdk-android-3.4.0.so
Games Pou 1.4.8 16M libsonic.so
Farm Story: Thanksgiving 1.9.6.3 16M libs8.so
Cartoon Camera 1.99 1.0M libgpuimage-library.so
Business Box 2.3.0* 11.3M* libleveldb.so
Call Blocker 4.2.46.20 3.9M libNqCrypto.so
Olive Office Premium (free) 1.0.89 19M libchmjni.so
libpdfjni.so libjnigraphics.so
Books & Reference Cool Reader 3.1.2-34 6.7M libcr3engine-3-1-0.so libGLESv1 CM.so
Audible for Android 1.5.3* 9M* libAAX SDK.so
Ancestry 2.2.335* 5.7M* libNativeTreeViewer.so
Education Mathway 1.0.3 13M libmonodroid.so
PlayKids 1.1.1 17M N/A N/A
Music & Audio iHeartRadio 4.10.0* 7.7M* libaacarray.so
Bandsintown Concerts 4.3.2.1 10M libdeezer.so
DJ Studio 5 5.0.8 11M libaudio-jni.so
Lifestyle AroundMe 4.2.4 5.2M libcountry-database.so