Too Quiet in the Library: an Empirical Study of Security Updates in Android Apps’ Native Code
Total Page:16
File Type:pdf, Size:1020Kb
Too Quiet in the Library: An Empirical Study of Security Updates in Android Apps’ Native Code Sumaya Almanee? , Arda Unal¨ ? , Mathias Payery , and Joshua Garcia? ? University of California Irvine, fsalmanee, unala, [email protected] y EPFL, [email protected] Abstract—Android apps include third-party native libraries to We argue that security implications in native libraries are increase performance and to reuse functionality. Native code is even more critical for three main reasons. First, app developers directly executed from apps through the Java Native Interface add native libraries but neglect to update them. The reasons for or the Android Native Development Kit. Android developers add precompiled native libraries to their projects, enabling their this may include concerns over regressions arising from such use. Unfortunately, developers often struggle or simply neglect updates, prioritizing new functionality over security, deadline to update these libraries in a timely manner. This results in pressures, or lack of tracking library dependencies and their the continuous use of outdated native libraries with unpatched security patches. This negligence results in outdated or vul- security vulnerabilities years after patches became available. nerable native libraries remaining in new versions of apps. To further understand such phenomena, we study the security Second, native libraries are susceptible to memory vulnerabil- updates in native libraries in the most popular 200 free apps on Google Play from Sept. 2013 to May 2020. A core difficulty ities (e.g., buffer overflow attacks) that are straight-forward to we face in this study is the identification of libraries and their exploit. Third, and contrary to studies from almost 10 years versions. Developers often rename or modify libraries, making ago [11], [44], native libraries are now used pervasively in their identification challenging. We create an approach called mobile apps. To illustrate this point, we analyzed the top 200 LibRARIAN (LibRAry veRsion IdentificAtioN) that accurately apps from Google Play between Sept. 2013 and May 2020. We identifies native libraries and their versions as found in Android apps based on our novel similarity metric bin2sim. LibRARIAN obtained the version histories of these apps from AndroZoo [2] leverages different features extracted from libraries based on totaling 7;678 versions of those 200 top free apps. From these their metadata and identifying strings in read-only sections. apps, we identified 66;684 native libraries in total with an We discovered 53=200 popular apps (26:5%) with vulnerable average of 11 libraries per app and a maximum of 141 for versions with known CVEs between Sept. 2013 and May 2020, one version of Instagram. with 14 of those apps remaining vulnerable. We find that app developers took, on average, 528:71±40:20 days to apply security To better understand the usage of third-party native libraries patches, while library developers release a security patch after in Android apps and its security implications, we conduct 54:59 ± 8:12 days—a 10 times slower rate of update. a longitudinal study to identify vulnerabilities in third-party native libraries and assess the extent to which developers I. INTRODUCTION update such libraries of their apps. In order to achieve this, we make the following research contributions: Third-party libraries are convenient, reusable, and form an • We construct a novel approach, called LibRARIAN integral part of mobile apps. Developers can save time and (LibRAry veRsion IdentificAtioN) that, given an unknown effort by reusing already implemented functionality. Native binary, identifies (i) the library it implements and (ii) its third-party libraries are prevalent in Android applications version. Furthermore, we introduce a new similarity-scoring (“apps”), especially social networking and gaming apps. These mechanism for comparing native binaries called bin2sim, two app categories—ranked among the top categories on which utilizes 6 features that enable LibRARIAN to dis- Google Play—require special functionality such as 3D ren- tinguish between different libraries and their versions. The dering, or audio/video encoding/decoding [14], [26], [40], features cover both metadata and data extracted from the [33], [38]. These tasks tend to be resource-intensive and are, libraries. These features represent elements of a library thus, often handled by native libraries to improve runtime that are likely to change between major, minor, and patch performance. versions of a native library. The ubiquity of third-party libraries in Android apps in- • We conduct a large-scale, longitudinal study that tracks creases the attack surface [35], [39] since host apps expose security vulnerabilities in native libraries used in apps over 7 vulnerabilities propagated from these libraries [20], [37]. An- years. We build a repository of Android apps and their native other series of previous work has studied the outdatedness and libraries with the 200 most popular free apps from Google updateability of third-party Java libraries in Android apps [9], Play totaling 7;678 versions gathered between the dates of [4], with a focus on managed code of such apps (e.g., Java or Sept. 2013 and May 2020. This repository further contains Dalvik code). However, these previous studies do not consider 66;684 native libraries used by these 7;678 versions. native libraries used by Android apps. Prior work [30], [24], [21], [1] has measured the similarity between binaries. However, these approaches identify semantic this section, we describe each of these three major steps of similarities/differences between binaries at the function-level, LibRARIAN. with the goal of identifying malware. LibRARIAN, orthog- onally, is a syntactic-based tool which computes similarity Unknown between two benign binaries (at the file-level) with the goal Lib Versions of identifying library versions with high scalability. Identified LibRAry veRsion Library We utilize LibRARIAN and our repository to study (1) IdentificAtioN (LibRARIAN) Versions LibRARIAN’s accuracy and effectiveness, (2) the prevalence Known Lib of vulnerabilities in native libraries in the top 200 apps, and Versions (3) the rate at which app developers apply patches to address vulnerabilities in native binaries. The major findings of our Fig. 1: LibRARIAN identifies versions of native binaries from study are as follows: Android apps by using our bin2sim similarity-scoring tech- • For our ground truth dataset which contains 46 known nique to compare known (ground-truth dataset) and unknown libraries with 904 versions, LibRARIAN correctly identifies versions of native binaries. 91:15% of those library versions, thus achieving a high identification accuracy. A. Feature Vector Extraction • To study the prevalence of vulnerabilities in the top 200 apps Our binary similarity detection is based on the extraction in Google Play, we use LibRARIAN to examine 53 apps of features from binaries combining both metadata found with vulnerable versions and known CVEs between Sept. in Executable and Linkable Format (ELF) files as well as 2013 and May 2020. 14 of these apps remain vulnerable and identifying features in different binary sections of the library. contain a wide-range of vulnerability types—including de- All shared libraries included in Android apps are compiled into nial of service, memory leaks, null pointer dereferences, or ELF binaries. Like other object files, ELF binaries contain a divide-by-zero errors. We further find that libraries in these symbol table with externally visible identifiers such as function apps, on average, have been outdated for 859:17 ± 137:55 names, global symbols, local symbols, and imported symbols. days. The combination of high severity and long exposure This symbol table is used (1) during loading and linking and of these vulnerabilities results in ample opportunity for (2) by binary analysis tools [16] (e.g., objdump, readelf, attackers to target these highly popular apps. nm, pwntools, or angr [36]) to infer information about the • To determine developer response rate of applying security binary. fixes, we utilize LibRARIAN to analyze 40 apps, focusing To distinguish between different libraries and their versions, on popular third-party libraries (those found in more apps) we need to identify differencing features. To that end, we de- with known CVEs such as FFmpeg, GIFLib, OpenSSL, fine a set of six features inherent to versions and libraries. Five WebP, SQLite3, OpenCV, Jpeg-turbo, Libpng, and XML2, features represent ELF metadata, these features are used to between Sept. 2013 and May 2020. compute the similarity score between two binaries as described We find that app developers took, on average, 528:71±40:20 in Section II-B, hence, we refer to these features as Metadata days to apply security patches, while library developers Features. Orthogonally, we leverage strings extracted from the release a security patch after 54:59±8:12 days—a 10 times .rodata section of an ELF object, which we refer to as Version slower rate of update. These libraries that tend to go for Identification Strings. This feature complements the similarity long periods without being patched affect highly popular score from the first set of features. We either use it to verify apps with billions of downloads and installs. the correctness of the version or as a fallback if the similarity • We make our dataset, analysis platform, and results available to existing binaries in our ground-truth dataset is low (see online to enable reusability, reproducibility, and others to Section II-C). build upon our work [25]. Table I shows the list of all LibRARIAN features. The features include: (i) five Metadata Features based on exported II. LibRARIAN and imported functions, exported and imported globals, and library dependencies; and (ii) one Data Feature which is Figure 1 shows the overall workflow of LibRARIAN. applied as a second factor to either substitute the Metadata LibRARIAN identifies unknown third-party native libraries Features, in case the reported similarity score is low, or to and their versions (Unknown Lib Versions) by (1) extracting confirm the reported score.