<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Why Does Your Data Leak? Uncovering the Data Leakage in Cloud from Mobile Apps</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2019</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10119364</idno>
					<idno type="doi"></idno>
					<title level='j'>IEEE Symposium on Security and Privacy</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Chaoshun Zuo</author><author>Zhiqiang Lin</author><author>Yinqian Zhang</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Increasingly, more and more mobile applications(apps for short) are using the cloud as the back-end, in particularthe cloud APIs, for data storage, data analytics, message notification, and monitoring. Unfortunately, we have recently witnessedmassive data leaks from the cloud, ranging from personally identifiable information to corporate secrets. In this paper, we seek tounderstand why such significant leaks occur and design tools toautomatically identify them. To our surprise, our study revealsthat lack of authentication, misuse of various keys (e.g., normaluser keys and superuser keys) in authentication, or misconfiguration of user permissions in authorization are the root causes.Then, we design a set of automated program analysis techniquesincluding obfuscation-resilient cloud API identification and stringvalue analysis, and implement them in a tool called LeakScopeto identify the potential data leakage vulnerabilities from mobileapps based on how the cloud APIs are used. Our evaluationwith over 1.6 million mobile apps from the Google Play Storehas uncovered 15, 098 app servers managed by mainstream cloudproviders such as Amazon, Google, and Microsoft that are subjectto data leakage attacks. We have made responsible disclosure toeach of the cloud service providers, and they have all confirmedthe vulnerabilities we have identified and are actively workingwith the mobile app developers to patch their vulnerable services.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>The cloud has significantly changed the landscape of modern computing. It has been proven to be the go-to platform for data storage, data processing, data analytics, and data backup and recovery, due to its immense benefits such as being highly available, massively scalable, hugely cost-saving, and quickly deployable. The cloud is everywhere, and "the cloud presence is becoming a norm in almost 70% enterprises across the globe, and they have at least one application running on the cloud" <ref type="bibr">[34]</ref>.</p><p>With the rapid growth of cloud computing, there has also been a tremendous growth of mobile apps. From an end-user perspective, mobile apps can be considered the front-end of an Internet service with the cloud as the back-end. By using the cloud, service providers (e.g., news, weather, and shopping) do not have to worry about the scalability and availability of their back-end servers, and instead they can just focus on their core business logic and develop their mobile apps. Almost all of our daily used Internet services have their own dedicated mobile apps. As of today, there are more than five million mobile apps in only the Google Play Store and Apple App Store <ref type="bibr">[20]</ref>.</p><p>Unfortunately, with the use of the cloud as a mobile app back-end, we have also witnessed massive data leaks from the cloud recently, ranging from personal medical records to corporate secrets. For example, it was reported that insecure back-end databases of mobile apps were exposing an estimated 280 million sensitive user records including personally identifiable information (PII) such as user-names, passwords, emails, phone numbers, and locations <ref type="bibr">[36]</ref>. Such leakage also applies to high profile companies such as Verizon, which may have leaked 100MB of its corporate secrets from a publicly accessible Amazon S3 bucket <ref type="bibr">[33]</ref>.</p><p>A conventional wisdom is to get better security by using the cloud, but this has actually led to massive data leaks. Consequently, it has resulted in many questions to be answered. For instance, what are the root causes of data leaks in the cloud? Are they caused by cloud providers, app developers, or both? Can we systematically identify data leakage vulnerabilities in cloud services? How can they (i.e., both cloud providers and app developers) prevent them from happening again?</p><p>In this paper, we seek to perform a systematic study and answer these questions. Since we do not have lower-level access to how each cloud provider manages the customers' services, we can only analyze the front-end of the cloud services. One such front-end is mobile apps. Increasingly, we notice that more and more mobile apps are using cloud APIs for various services such as authentication, authorization, and storage, without directly setting up and managing those backend infrastructures. Therefore, by inspecting how the cloud APIs are used, we can understand how each mobile app manages its customer data and thus identify the data leakage vulnerabilities.</p><p>In particular, we first look into the typical APIs offered by cloud providers for mobile app development, and examine how app developers would develop their mobile apps and manage their security with these APIs. From this study, we uncover that a mobile app must perform an extra service authentication when communicating with the cloud back-end, such that the cloud provider knows which app issues the request and which resource this app aims to access. Improper management of user authentication and misconfiguration of user permissions in authorization are the root causes that lead to the various data leaks from the cloud. In our study, we find many cloud services suffer from such vulnerabilities.</p><p>Having discovered the root causes of the data leaks in the cloud, we also notice that it is possible to develop a principled approach to automatically identify these data leakage vulnerabilities by inspecting how mobile apps use the authentication keys and how servers handle users' requests. One challenge lies in how to make sure there is no leakage of customer data when performing our analysis, since we are a third party and we certainly must not access any of the customer data. Also, there are millions of mobile apps today, so we must design a scalable, automated, and efficient approach. We have addressed these challenges and built a tool called LeakScope with a set of program analysis techniques including obfuscation-resilient cloud API identification, string value analysis, and zero-data- l e a k a g e v u l n e r a b i l i t yi d e n t i fi c a t i o nt oa u t om a t i c a l l yl o c a t e c l o u dd a t a l e a k a g ev u l n e r a b i l i t i e s i n m o b i l ea p p s . W eh a v ee v a l u a t e d L e a k S c o p e w i t h 1 , 6 0 9 , 9 8 3m o b i l e a p p s . S u r p r i s i n g l y ,o u rt o o lh a su n c o v e r e d1 5 , 0 9 8u n i q u e m o b i l ea p p s(1 0o f t h emh a v eb e tw e e n1 0 0m i l l i o na n d 5 0 0 m i l l i o n u s e r s ) , w h o s e b a c k -e n ds e r v e r s-h o s t e di nc l o u d s s u c h a s Am a z o n AW S , G o o g l e F i r e b a s e , a n d M i c r o s o f t A z u r e-a r es u b j e c tt od a t al e a k a g ea t t a c k s . W eh a v e m a d e r e s p o n s i b l ed i s c l o s u r e t oa l lo f t h ec l o u dp r o v i d e r s ,a n d t h e y a l lh a v ec o n fi rm e d t h ev u l n e r a b i l i t i e s w e i d e n t i fi e d . W ea l s o r e l yo n t h em t of u r t h e rn o t i f y t h ea p pd e v e l o p e r sb ys e n d i n g t h em t h e l i s to f t h ev u l n e r a b l ea p p sa n ds om eo t h e rd e t a i l e d i n f o rm a t i o n . C l o u dp r o v i d e r sh a v es e r i o u s l yc o n s i d e r e do u r d i s c o v e r ya n dn o t i fi e dt h ev u l n e r a b l ea p pd e v e l o p e r s . T h e c l o u dp r o v i d e r sa r ea l s oa c t i v e l y w o r k i n go np a t c h i n gt h e i r s e r v i c e s , s om eo fw h i c hc a nb en o t i c e dp u b l i c l y ( e . g . ,u p d a t i n g t h eo f fi c i a ld o c um e n t a t i o n t oc o r r e c ta m i s g u i d e de x am p l e i n t h eSDK <ref type="bibr">[ 8 ]</ref> ) .I na d d i t i o n ,an um b e ro fp o p u l a r m o b i l ea p p s h a v ea l s ob e e np a t c h e da f t e rc l o u dp r o v i d e r sn o t i fi e d t h em .</p><p>I ns h o r t ,w e m a k e t h e f o l l o w i n gc o n t r i b u t i o n s .</p><p>&#8226;S y s t em a t i cs t u d y . W e m a k eafi r s ts t e p t o w a r d ss y s t ema t i cu n d e r s t a n d i n go fd a t al e a k si nt h ec l o u d ,a n do u r s t u d yh a s i d e n t i fi e d t h e r o o tc a u s e so f r e c e n tm a s s i v ed a t a l e a k s . &#8226;A u t om a t e dt e c h n i q u e s. W ed e v e l o pas e to fp r o g r am a n a l y s i st e c h n i q u e si n c l u d i n gn e wo b f u s c a t i o n -r e s i l i e n t c l o u dA P I i d e n t i fi c a t i o n ,s t r i n gv a l u ea n a l y s i s ,a n dz e r od a t a -l e a k a g ev u l n e r a b i l i t y i d e n t i fi c a t i o n t oa u t om a t i c a l l y l o c a t ec l o u dd a t al e a k a g ev u l n e r a b i l i t i e sf r om m o b i l e a p p s . &#8226;Em p i r i c a l e v a l u a t i o n s . W eh a v e e v a l u a t e do u r t e c h n i q u e s w i t h1 , ,v i r t u a lm a c h i n e so rd a t a b a s e s e r v e r s , f r omac l o u dp r o v i d e r ) . M o r e o v e r ,e v e na f t e r r e l e a s i n g t h ea p p , t h ee n t i r e s y s t emw o u l d r e q u i r en o n -t r i v i a le f f o r t s t oe n s u r e i t s s t a b i l i t y a n d s e c u r i t y .F u r t h e rm o r e ,w h e n a n a p pb e c om ep o p ul a r , t h e yw o u l dh a v e t om a i n t a i nh i g ha v a i l a b i l i t ya n d s c a l e t h e s y s t em t o a c c omm o d a t e ap o t e n t i a l l ym a s s i v e i n c r e a s e i nu s e r s .  A n y m i s t a k e s w i t ht h e s eo p e r a t i o n s w i l l l e a dt oa c c o u n tc om p r om i s e ss u c ha sd a t al e a k sa n dd a t a t am p e r i n g .I np a r t i c u l a r , w eh a v ei d e n t i fi e dtw o m a j o rt y p e s o fd a t a l e a k a g ev u l n e r a b i l i t i e s : m i s u s eo fv a r i o u sk e y s i na ut h e n t i c a t i o n ( &#167; I I I -A )a n dm i s c o n fi g u r a t i o no fu s e rp e rm i s s i o n s i na u t h o r i z a t i o n ( &#167; I I I -B ) .</p><p>A . M i s u s eo fV a r i o u sK e y s i nA u t h e n t i c a t i o n 1 p a c k a g e c o m . a p p n a m e 2 p u b l i c c l a s s I m a g e s H e l p e r { 3 p r i v a t e f i n a l S t r i n g s t o r a g e A c c o u n t K e y ; 4 p r i v a t e f i n a l S t r i n g s t o r a g e A c c o u n t N a m e ; 5 6 p r i v a t e I m a g e s H e l p e r ( C o n t e x t a r g 3 ) { 7 i n t v 0 = 2 1 3 1 0 9 9 7 1 3 ; 8 i n t v 1 = 2 1 3 1 0 9 9 7 1 2 ; 9 t h i s . s t o r a g e A c c o u n t N a m e = 1 0 U t i l s . g e t S t r i n g F r o m R e s o u r c e s ( t h i s . i m g C o n t e x t , v 0 ) ; 1 1 t h i s . s t o r a g e A c c o u n t K e y = 1 2 U t i l s . g e t S t r i n g F r o m R e s o u r c e s ( t h i s . i m g C o n t e x t , v 1 ) ;     anonymized on purpose. The code is used for downloading some images from the cloud storage. We can see that the key (at line 31) used in this app is an account key (by looking at its format at line 18), which means anyone with this key can access the entire storage allocated to this particular account.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>E v e n t h o u g h t h ea c c o u n tk e ya n dSA Sh a v ee n t i r e l yd i ff e r e n t f o rm a t sa n du s ec a s e s ,w efi n dd e v e l o p e r sa c t u a l l yh a v e m i s u s e d t h em .O b v i o u s l y ,d e v e l o p e r ss h o u l dh a v ee x c l u s i v e l y u s e dSA Si nt h ea p pa n dk e p tt h ea c c o u n tk e yc o n fi d e n t i a l . F o ri n s t a n c e , w h e nau s e ri st r y i n gt oa c c e s sap r i v a t efi l e f r om t h e m o b i l ea p p ,d e v e l o p e r ss h o u l da s s i g naSA S ,w h i c h h a st h e m i n im ump e rm i s s i o nt oa c c e s st h ep a r t i c u l a r fi l e s f o rt h i su s e r . H o w e v e ra c c o r d i n gt oo u re x p e r im e n t s , m a n y d e v e l o p e r sd i r e c t l yu s e t h e i ra c c o u n tk e y i n t h e m o b i l ea p p s . U n f o r t u n a t e l y ,t h ea c c o u n tk e yc a nb ee a s i l ye x t r a c t e db y a t t a c k e r s t h r o u g hr e v e r s ee n g i n e e r i n g .A ss h o w n i nF i g u r e2 , w ee x t r a c t e dc o d ef r omar e a l A n d r o i da p p , w h o s en am ei s</head><p>(II) Key Misuse in Azure Notification Hubs. With cloud APIs, developers can easily send messages to specific users or broadcast to all users. Microsoft Azure provides a notification hub with two APIs for message notification. As illustrated in Figure <ref type="figure">3</ref>, to use Azure Notification Hub, developers first need to register a channel, and then the mobile app just invokes the API to listen to the developer registered channel using a listening key; after that, the app server can push notifications to the channel registered in the Hub (using a full access key), which will further relay this message to all channel listeners. There are two keys involved:</p><p>&#8226; Full Access Key. The full access key works like a "root" key, and has full access to send or listen for notifications on the channel. An example of such a key is shown in the 3rd row of Table <ref type="table">II</ref>. &#8226; Listening Key. The listening key has limited privileges and can only listen to the notifications registered in a particular channel. The last row in Table <ref type="table">II</ref> shows an example of a listening key. Clearly, a listening key should only be used by the mobile app, whereas the full access key should only be used by app servers. However, we find that some developers are using full access keys directly in the mobile apps. While the key misuse in Azure Notification Hubs may not directly lead to data leakage attacks, we have to stress that once attackers extract the full access key they still have access to powerful capabilities. For example, they can easily push phishing messages to steal data from other app users.</p><p>(III) Key Misuse in AWS. Amazon AWS also provides a number of keys for mobile apps to access the AWS resources (e.g., the S3 storage) billed to the developers. One of the keys is the root access key (or root account key), which has full access to all of the resources under a particular AWS account. Since this root key has all privileges, it should be kept secret. Unfortunately, we also noticed this root key being used in mobile apps. Once an attacker extracts this root key, she has full access to the entire storage.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Misconfiguration of User Permissions in Authorization</head><p>In addition to the misuse of keys in authentication, misconfiguration of user permissions in authorization can also result in data leaks. Typically, authentication only tells the system who the user is, and it is authorization that decides which specific resources an authenticated user can access. Lack of authorization or incorrect configuration can make the authorization layer useless, thereby leading to data leaks. While misconfiguration of authorization is not a new problem and has been studied for many years, this problem becomes more critical when using cloud APIs. In particular, when developing mobile apps without cloud APIs, different developers can implement authorization systems in completely different ways. Even though vulnerabilities may be present, it is quite challenging for attackers to systematically exploit many diverse implementations. However, when developers are using cloud APIs, adversaries can easily launch attacks; since many developers are using the interfaces of only a few cloud services, attackers can just focus on these interfaces to systematically identify vulnerabilities.</p><p>Meanwhile, unlike in authentication, in which developers have a limited playground when using cloud APIs (e.g., the mistakes only come from key misuses), there are a variety of ways for developers to configure authorization, making the authorization configuration much harder and more error-prone. For instance, Google even provides a language for developers to specify the user permissions in authorization. It is not surprising that developers will make mistakes: we found (i) apps with Firebase that have misconfigured user permissions in the back-end. In addition, we found (ii) apps with AWS that suffer from this misconfiguration problem as well.</p><p>(I) Misconfiguration of User Permissions in Firebase. When using Firebase, developers have to define user-specific access control polices, i.e., the "rules". An example of such a rule is shown in Figure <ref type="figure">4</ref>. Note that Firebase is a real time database that organizes data in a hierarchy structure with JSON. According to this example rule, there is a node named "users" in the database: when a user attempts to access (read/write) one of its child nodes that has an associated $uid, the system will only grant access if the user's uid equals the $uid of the child node for this specific read and write operation. Unfortunately, we notice that not all developers follow the correct way to write the rules. For instance, as shown in Figure <ref type="figure">5</ref>, a developer can write rules to just ignore the checks, or just check whether a user is authenticated. These are obviously insecure rules, as they imply that any (authenticated) user has full access to the entire database.</p><p>(II) Misconfiguration of User Permissions in AWS. With AWS, Amazon provides Identity and Access Management (IAM) for user management and permission configurations. To securely access the resources billed to a particular mobile app developer, an IAM user needs to be created. The developer can configure the permissions for IAM users, and each IAM user can generate two secret access keys to access the specified resources. While using IAM users appears to be secure, developers may in fact over provision the permissions for an IAM user, such as granting full access to a particular storage, which will lead to data leaks.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IV. PROBLEM STATEMENT AND OVERVIEW</head><p>After the discovery of the root causes of the data leaks in the cloud, we would like to develop techniques to systematically identify the leaks. Since we do not have any access to the mBaaS cloud implementations (only to their SDKs and APIs), we can only start from the front-end of the services (i.e., the mobile apps) to inspect how mobile apps use the various keys and also infer the permission configurations based on server responses. Therefore, we must design a mobile app exclusive approach. In this section, we provide an overview of the problem we aim to solve and the solutions and insights we have. The detailed design and implementation of our tool is presented in the next section.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Problem Statement</head><p>As illustrated in Figure <ref type="figure">1</ref>, we notice that developers must embed the app key in the app, and then use it to invoke cloud mBaaS cloud APIs. The data leakage vulnerabilities we aim to identify are mainly caused by key misuse and permission misconfiguration. Therefore, the first problem we must solve is how to systematically identify various keys used by mobile apps.</p><p>At first it might appear trivial to identify the API keys used by mobile apps by inspecting each cloud API (e.g,. the CloudStorageAccount.parse API used at line 31 in Figure <ref type="figure">2</ref>). However, the keys might not be directly visible and could have gone through multiple string acquisitions (e.g., at line 9-12) and concatenations (e.g., at line 18-21). In addition, there are millions of mobile apps, so we have to design a scalable approach. Therefore, the second problem we must solve is how to identify the relevant key strings that are used by mobile apps.</p><p>Also, increasingly mobile apps are using obfuscation to thwart app reverse engineering and repackaging <ref type="bibr">[45]</ref>, <ref type="bibr">[43]</ref>, <ref type="bibr">[42]</ref>. It might be possible that app developers have obfuscated the APIs we aim to inspect. As such, we cannot simply scan the app code for API signatures (e.g., CloudStorageAccount.parse); instead, we must design an obfuscation-resilient approach. It would also be interesting to know whether obfuscated apps are vulnerable to data leaks, given the fact that app developers using obfuscation are potentially more aware of security issues. Therefore, the third problem we need to solve is how to design an obfuscation-resilient approach to identify cloud APIs and key strings of our interest.</p><p>Finally, after we have extracted the keys, we have to identify the type of each key (e.g., a root key or an app key). Once we have determined the types of the keys, we must also verify whether the apps have misused them without accidentally accessing any private data stored in the cloud. Similarly, we also must identify user permission misconfigurations during authorization without leaking any data. Therefore, the final problem we (as third-parties) must solve is to design a verification approach with zero dataleakage to confirm the existence of data leaks in the cloud.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Our Solutions</head><p>Recognizing the Keys by Cloud API Identification. To identify keys that are used by an app, we can actually infer them from the parameters of the well-known APIs that are used by the app. Note that each cloud provider has offered a set of APIs in their SDKs for mobile app development. As illustrated in Table <ref type="table">III</ref>, the APIs that take parameters with various keys are actually quite limited, and we acquire this list based on our best understanding of the corresponding SDKs. Therefore, if we are able to recognize these APIs, then we can identify the keys used by the app in the corresponding parameters.</p><p>However, the APIs listed in Table <ref type="table">III</ref> can be obfuscated. Interestingly, we find that there are often two strategies used in API obfuscation:</p><p>&#8226; Renaming names involved in the API, such as the subpackage name, class name, function name, and variable name, from the standard name to some meaningless characters. This is often achieved by some automated obfuscation tools (e.g., Dexprotector <ref type="bibr">[7]</ref>, Dexguard <ref type="bibr">[5]</ref>). &#8226; Removing the functions/APIs that are never used. Since the non-used functions/APIs can often reveal the packages and classes used by the app, removing these functions from the apps by automated tools (e.g., Proguard <ref type="bibr">[12]</ref>, <ref type="bibr">[15]</ref>) can further help hide the APIs of interest. Therefore, we propose to build an obfuscation-resilient function signature for each function in the APK (including its library) in order to identify the cloud APIs in Table <ref type="table">III</ref>. Our signature ignores the names of packages, classes, functions, and variables. Instead, a function's signature is the hash of the strings that are composed of the types of the parameters, local variables, and return values, as well as the signatures of callees.</p><p>Using String Analysis to Identify the Value of Keys. Having identified the APIs of our interest, we cannot directly extract the values of the corresponding parameters from the app code. For instance, we cannot directly extract the value of v0 from CloudStorageAccount.parse in Figure <ref type="figure">2</ref>, as this value is computed from multiple string operations. While we can use dynamic analysis to execute the app and extract the value at runtime, such an approach does not scale well, especially considering that we have millions of mobile apps. Therefore, eventually we decided to take a static analysis approach and propose a targeted string value analysis to identify the used keys. At a high level, our string value analysis can be considered a particular case of value set analysis <ref type="bibr">[24]</ref>. It involves backward slicing and string related operation analysis.</p><p>Zero-data-leakage Vulnerability Verification. After we have retrieved the values of the keys used by the cloud APIs, next we have to infer the types of the keys. For some cloud services (e.g., Azure Storage), app keys and root keys are in different formats (as shown in Table <ref type="table">II</ref>), and we can easily tell whether a key of our interest is a root key. However, for some other cloud services (e.g., AWS), app keys and root keys have the same format. To deal with this problem, a straightforward approach is to send a request to the server by using the key to access some root user exclusive data. If we are able to retrieve these data, then it implies there is a data leakage vulnerability. However, such an approach would violate the ethics of accessing private-sensitive data.   Fortunately, we have another observation: we notice that the server typically will return different response messages when accessing nonexistent data in the cloud with a root key versus a regular user key. As such, to verify whether a key is a root key, we will send a request to the cloud with the key to retrieve some nonexistent data. If the key is an app key, the return message is usually in the form of "permission denied", and if the key is a root key, the return message is usually something like "data not found". In either case, no real data is leaked, but we have inferred the types of the keys. We can also use the same approach to verify the authorization misconfigurations.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. DESIGN AND IMPLEMENTATION</head><p>We have built a tool called LeakScope to automatically detect data leakage vulnerabilities when given a mobile app. An overview of LeakScope is presented in Figure <ref type="figure">6</ref>. It consists of three key components: Cloud API Identification ( &#167;V-A), String Value Analysis ( &#167;V-B), and Vulnerability Identification ( &#167;V-C). In this section, we describe how we design and implement ( &#167;V-D) these components.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Cloud API Identification</head><p>It is important to identify the APIs used by an app, especially those listed in Table <ref type="table">III</ref>. As discussed in &#167;IV-B, we need to design an obfuscation-resilient approach to identify the cloud APIs. Fortunately, we notice that there are at least two invariants that are preserved regardless of the obfuscations for a given function (or method).</p><p>&#8226; The first invariant is the hierarchical structure (or the shape, the layer) of the types and package trees. Note that each class, method, parameter, and variable all have types (e.g., the type of arg5 is com.appname.Listeners.Callback at line 15 in Figure <ref type="figure">2</ref>). While the names of the types can be obfuscated (except the name of system types), the hierarchical structure of the types will not change. For instance, as shown in Figure <ref type="figure">7</ref>, type Callback is stored at the fourth layer starting from the package com. &#8226; The second invariant is the caller-callee relation in a method. For instance, method downloadImage will call functions such as StringBuilder.append and Util.isNetworkAvailable. We can build each callee's signature recursively, and then merge them to build the signature for the caller, namely downloadImage in this example. Therefore, if we can encode these two invariants and add them together to build a signature for a function (including APIs in linked non-system libraries), then we can just search for these signatures in the bytecode of mobile apps to find the cloud APIs we need. Inspired by LibScout <ref type="bibr">[23]</ref>, in which a Merkle hash tree is used to build a library signature (for 3rd party library detection in Android apps), we use the hash of the encoded invariants (i.e., the hierarchical structure of the types and package trees, and the caller-callee relation) as the function/API signature for the API detection. Note that we cannot directly use LibScout as it focuses on the detection of third-party libraries. In addition, LibScout only generates coarse-grained signatures for each class, whereas we have to generate fine-grained signatures for each function.</p><p>Generating Signatures for Each Function. More specifically, as shown in Algorithm 1, for a given function, we will generate a signature (GENFUNSIG) by using the MD5 hash of the encoded type string of (i) the function's belonging class (i.e., home class) (line 5-6), (ii) its arguments (line 7-8), (iii) its local variables (line 9-10), (iv) its return value (line 11-12), and (v) recursively all of its callees (line <ref type="bibr">[13]</ref><ref type="bibr">[14]</ref><ref type="bibr">[15]</ref><ref type="bibr">[16]</ref><ref type="bibr">[17]</ref><ref type="bibr">[18]</ref>. If a callee is an Android system function (not obfuscated), then we directly Algorithm 1 Function Signature Generation 1: Input: f0: target function; Cs: system classes; Fs: system functions 2: procedure GENFUNSIG(f0, Cs, Fs) 3:</p><p>fBuf &#8592; fBuf &#8746; TYPEENCODING(t0, t0, Cs)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>7:</head><p>for tp &#8712; GETPARAMETERTYPE(f0) do</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>8:</head><p>fBuf &#8592; fBuf &#8746; TYPEENCODING(t0, tp, Cs)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>9:</head><p>for tv &#8712; GETLOCALVARTYPE(f0) do 10:</p><p>fBuf &#8592; fBuf &#8746; TYPEENCODING(t0, tv, Cs)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>11:</head><p>tr &#8592; GETRETURNTYPE(f0) <ref type="bibr">12:</ref> fBuf &#8592; fBuf &#8746; TYPEENCODING(t0, tr, Cs)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>13:</head><p>for fi &#8712; GETCALLEE(f0) do</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>14:</head><p>if fi &#8712; Fs then</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>15:</head><p>L &#8592; L&#8746; name(fi, argType(fi), retType(fi)) <ref type="bibr">16</ref>: </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>31:</head><p>for ci &#8712; GETINTERFACES(ct) do</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>32:</head><p>L &#8592; L&#8746; TYPEENCODING(c h , ci, Cs)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>33:</head><p>tBuf &#8592; tBuf &#8746; SORT(L)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>34:</head><p>return tBuf add the name of this function including the type name of its arguments and return value to our type string (line 14-15).</p><p>To perform the string encoding (TYPEENCODING) of the hierarchical structure of the types and package trees (line 20-34), basically we take the home class (c h ) to which the type belongs, the target class (c t ), and system classes (C s ) as input to encode the target type c t . Note that in Java bytecode, all of the types are defined as classes. We directly return the string name of the type if c t is a system class (line 24-25) as its name cannot be obfuscated. Otherwise, we take the encoded string that combines the normalized relative path between c t and c h (line <ref type="bibr">[27]</ref><ref type="bibr">[28]</ref>, recursively the encoded string of the superclass of c t (line 29-30), and the interfaces of c t (line 31-33), as the final type string.</p><p>Note that to uniquely encode the type of a given class, we would like to use as much reliable information as possible. Again, we cannot use any of the class names (except the system classes) and we must normalize them. Since a class typically has a super class, we would like to include the type encoding of its superclass, recursively. Meanwhile, a class could have defined a number of interface functions <ref type="bibr">[19]</ref>. Note that an interface is a collection of empty functions (no implementation body). Any class implementing an interface will inherit these functions. That is why eventually our type encoding algorithm considers the name and path normalization, superclass, and class interfaces. We do not include other information in a class, such as its fields and methods, in the signatures since they can be removed by tools such as Proguard <ref type="bibr">[15]</ref>.</p><p>When performing the normalization, we replace any non-system defined names with the symbol 'X', similar to LibScout <ref type="bibr">[23]</ref>. In addition, our algorithm takes a normalized relative path into our type string. For instance, when processing the type encoding of the first argument of function downloadImage, whose home class is ImagesHelper, we take a normalized relative path to encode the type com.appname.Listeners.Callback. More specifically, according to Figure <ref type="figure">7</ref>, starting from the home class ImagesHelper, we reach com.appname.Listeners.Callback by ../Listeners/Callback.</p><p>After normalizing all non-system names into 'X', we get a normalized path with string "../X/X". Meanwhile, the superclass of com.appname.Listeners.Callback is actually java.lang.Object, which is a system class (cannot be obfuscated). Therefore, eventually, for the type encoding of arg5, we get the string "../X/X#java.lang.Object" where # denotes string concatenation. Similarly, we get a type string for its second argument, local variables, and callees, respectively. Together, we have created a unique hash for function downloadImage.</p><p>Identifying the Cloud API with the Signatures. With our GENFUNSIG algorithm, we generate signatures for all functions, including the cloud APIs (initially acquired from the SDK libraries) for a given app. We then search for the signatures of the cloud APIs in the mobile apps; if a signature matches, we identify the corresponding cloud API of our interest.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. String Value Analysis</head><p>Having identified the cloud APIs of our interest, we are then able to identify where each API is called and further pinpoint the parameters that contain the authentication keys in the mobile app. However, we are not be able to directly observe their values since we use static analysis. Therefore, we have to develop a targeted string value set analysis (VSA) <ref type="bibr">[24]</ref> to reveal the possible values of the keys. Note that VSA is a technique that analyzes the possible values for registers and memory addresses at the x86 binary code level. We cannot directly use it to solve our problem, and instead we have to customize it to reveal the string values in the context of mobile app bytecode. At a high level, our string value analysis needs to perform the following inter-procedural backward slicing and string value computation statically.</p><p>Inter-procedural Backward Slicing. Program slicing <ref type="bibr">[37]</ref> is a widely used program analysis technique and has been used to solve many important security problems such as software vulnerability diagnosis (e.g., <ref type="bibr">[38]</ref>) and automatic patch generation (e.g., <ref type="bibr">[35]</ref>, <ref type="bibr">[44]</ref>). In our string value analysis, we have to first identify the variables and instructions that are related to the computation of the final strings of our interest by applying backward slicing of the Java bytecode.</p><p>More specifically, the first step of our analysis is to build an intro-procedural control flow graph (CFG) for each method/function, where nodes represent the contiguously executed bytecode instructions and edges represent the control flow transfers within the function. Then starting from a variable of our interest, e.g., v0 of API CloudStorageAccount.parse, we iterate the instructions in the CFG backwards: if there are any variables that contribute to the computation of v0, we add them to our data dependence graph (DDG) and meanwhile push the involved instructions and variables into a string computation stack, which is an internal last-in-first-out data structure maintained by LeakScope that is used to track the order of the execution of the string operations that contribute to the final string values; if there is any function call, we perform a context-sensitive interprocedural analysis and recursively analyze the callees. We keep iterating the CFG until we reach a fixed point, namely when our DDG cannot be expanded further. In our running example in Figure <ref type="figure">2</ref>, all of the statements that are highlighted in red are involved in the computation for the string value v0 used at line 31.</p><p>String Value Computation. With the tracked DDG and string computation stack, next we need to compute the values of the final strings of our interest. Starting from the top of the string computation stack, we pop the involved variables and instructions based on the CFG and our DDG, and we forward execute the involved string operations based on the instruction semantics until the stack is empty or the string value is fully determined.</p><p>Forward execution is not real execution and is instead based on the API summaries of the string operations. For instance, if the involved instruction is a string append API, we perform the string append operation; if it is a getString, we know it is used to read a string from an xml file, and we then perform the read operation of the specified string from the xml file and return its result. Note that strings are system defined classes, and the corresponding APIs are not obfuscated. Back to our running example in Figure <ref type="figure">2</ref>, the last pushed variables on the stack are StorageAccountKey and StorageAccountName. Then, starting from there with our tracked DDG, we perform a forward string analysis to compute the value of this.StorageAccountName and this.StorageAccountKey at lines 9 and 12 by executing the API summary of getResources and getString (lines <ref type="bibr">[37]</ref><ref type="bibr">[38]</ref>. Next, we compute the value of v0 (line 17-21), v1, this.val$conStr, and finally the value of v0 at line 31.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Vulnerability Identification</head><p>After obtaining the keys identified by LeakScope, next we would like to detect data leakage vulnerabilities in the cloud services. The detection is cloud specific, and we have designed the following algorithms to detect key misuses and permission misconfigurations for services that use Azure, AWS, and Firebase.</p><p>(I) Detecting Key Misuses in Azure (Storage and Notification Hub). As discussed in &#167;III-A, if there are root keys or full access keys in mobile apps, then an attacker can easily use these keys to leak data. Therefore, we do not need to probe the back-end to confirm the vulnerabilities. As long as we identify root keys or full access keys in a mobile app, we know the cloud service is vulnerable.</p><p>(II) Detecting Key Misuses in AWS. An AWS root key has full access to the corresponding AWS account, which means all resources under that account can be accessed by an adversary if we identify a root key in an app. We found that a root key has the permission to get some AWS instance information with the following rest API: <ref type="url">https://ec2.amazonaws.com/?Action=Describe</ref> Instances&amp;InstanceId.1=X, where X is the ID of the target instance. In contrast, an app key does not have this permission. Therefore, to detect key misuses in AWS, we set X to be a nonexistent ID. When we send a request alone with the key identified, we will receive the error message "InvalidInstanceID" if the key is a root key or "UnauthorizedOperation" if the key is an app key.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>(III) Detecting Permission Misconfiguration in Firebase.</head><p>There are two typical permission misconfiguration rules as shown in Figure <ref type="figure">5</ref>: (a) no authentication check (the database is entirely open to anyone), and (b) no permission check (only checks whether the user is authenticated). We use the following algorithms to detect them:</p><p>&#8226; Detecting "Open" Database. When a developer mistakenly specifies a read policy as ".read": "true", then anyone can read the database. Firebase provides a REST API to access data from the database in a given "path". By setting the "path", a user can read specific data. If we set "path" to "root", then we can read the entire database. However, we do not have to read the entire database, as Firebase supports queries with the indexon field. If we set this field to a nonexistent value when attempting to read the "root" path, no data will leak, but we can still confirm the data leaks as the returned error message is different when the user has root read permissions. &#8226; Detecting No Permission Check. When a data record read policy is ".read": "auth != null", we must use an authenticated user in order to perform the indexon-based leakage testing. It would be a huge engineering challenge to register a legitimate user in each corresponding cloud service. Fortunately, we noticed that Firebase also provides a number of cloud APIs for user registration, e.g., by using email/password, phone number, Google/Facebook SSO, etc., in addition to developer customized registration methods. We therefore can directly invoke these Firebase APIs to register legitimate users in the corresponding service if the tested app has used them. After that, we authenticate the registered user and then perform the indexon-based test.</p><p>(IV) Detecting Permission Misconfiguration in AWS. AWS keys are used to access the specified resources under particular access control policies. In AWS, there are several types of resources. Among these resources, we only focus on the detection of permission misconfiguration of S3 Storage. Note that several recent high profile data leaks (e.g., <ref type="bibr">[33]</ref>) were from S3. To perform our test, we have to collect not only AWS keys, but also the S3 Storage names. Therefore, we have to apply our string value analysis for both of them. With the identified AWS keys and storage names, we directly invoke an AWS API HEAD Bucket <ref type="bibr">[9]</ref> to verify whether a key has permission to access the storage or not. If so, a data leak is detected.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Implementation</head><p>We have implemented LeakScope 1 atop dexlib2 [6] and soot <ref type="bibr">[16]</ref>. In particular, to implement our Cloud API Identification, we leverage dexlib2, a lightweight APK static analysis framework that allows easily parsing of dex files to build function signatures. We build our String Value Analysis atop Soot, a powerful framework for analyzing Java bytecode with particularly useful features such as data flow analysis. The Vulnerability Identification is quite straightforward; we just wrote a python script to send the requests and parse the 1 The source code of LeakScope is made available at <ref type="url">https://github.com/ OSUSecLab/LeakScope</ref>.  response. In total, LeakScope consists of around 6, 000 lines of our own Python and Java code.</p><p>VI. EVALUATION In this section, we present our evaluation result. We first describe our experiment setup including how we collect the mobile apps in &#167;VI-A, describe our detailed result in &#167;VI-B, and finally provide an analysis of the identified vulnerabilities and the false positives of our approach in &#167;VI-C.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Experiment Setup</head><p>Collecting the Mobile Apps. We focus on the Android apps published in Google Play. To obtain an app from Google Play, we have to provide the app package name. As such, we first developed a python script atop the scrapy <ref type="bibr">[14]</ref> framework to crawl for each app package name. After two weeks of crawling, we retrieved about 1.9 million app names in May 2017. Then we crawled the entire package contents of 1, 609, 983 free Android apps within two months. Note that we could not download all 1.9 million apps due to restrictions such as paid apps or certain apps only being available in certain countries. In total, these 1.6 million mobile apps consumed 15.42 TB of space on our hard drive.</p><p>Environment Setup. Our experiments were conducted on seven workstations, each equipped with Intel Xeon E5-2640 CPU with 24 cores and 96 GB memory and running Ubuntu 16.04. We do not need any real mobile devices since LeakScope is mostly a static analysis tool, and only the Vulnerability Identification component needs to communicate with the cloud servers using dynamic analysis. All of our experimental data including the target apps and intermediate results are stored in a Network Attached Storage with 34.90TB hard drive space.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Experiment Result</head><p>In total LeakScope spent 6, 894.89 single CPU computation hours analyzing these 1, 609, 983 apps, which consumes 2.56 TB of storage for storing the intermediate results. Among the tested apps, eventually LeakScope detected 15, 098 unique mobile apps (with 17, 299 vulnerabilities in total), whose cloud servers are subject to data leakage attacks. In the following, we present detailed results based on how each component of LeakScope performs.</p><p>1) Cloud API Identification: We first evaluated our Cloud API Identification with the tested 1, 609, 983 apps. Since our approach is obfuscation-resilient, it clearly works for non-obfuscated apps as well. In total, our Cloud API Identification generated 39, 617, 809, 277 function signatures and identified 107, 081 mobile apps that used some of the 32 cloud APIs of our interest. Among these apps, 21, 724 of them (20.29%) are obfuscated. Therefore, as reported in Table <ref type="table">IV</ref>, we separated our experimental results into two sets: apps without obfuscation (85, 357 apps), and apps with obfuscation, in order to understand whether obfuscated apps provide better protection against data leakage attacks.</p><p>We also reported the detailed distributions of the cloud services used by the mobile apps. In particular, among these 107, 081 apps, 4, 799 (4.48%) exclusively use Amazon AWS, 899 (0.84%) exclusively use Microsoft Azure, and 99, 186 (92.63%) exclusively use Google Firebase. There are also 3 apps that use both AWS and Azure, 1, 973 with AWS and Firebase, and 210 with Azure and Firebase. Interestingly, there are also 11 apps that use all three cloud services. The detailed breakdown for non-obfuscated and obfuscated apps are reported from the 4th to 7th column, respectively.</p><p>It is quite surprising that the vast majority (over 90%) of the mobile apps actually used Google Firebase for their back-end services, at least according to the results reported in Table <ref type="table">IV</ref>. We consulted with the Google Firebase team when we made our responsible disclosure. They informed us that part of the reason for this is that there may be a significant portion of mobile apps that have used Amazon's or Microsoft's clouds, but not their mBaaS clouds (e.g., they may use their IaaS clouds instead). Our mBaaS cloud API Identification cannot identify these clouds.</p><p>2) String Value Analysis: Among the 107, 081 apps, our String Value Analysis statically computed 631, 551 strings of the parameters of our interest, and our detailed performance results are reported in Table <ref type="table">V</ref>. In particular, we report the string parameters of our interest in the 2nd column, followed by the corresponding APIs to which each string parameter belongs in the 3rd column (the original definition of these APIs is presented in Table <ref type="table">III</ref> and Table <ref type="table">IX</ref> in the Appendix). Then for both non-obfuscated and obfuscated apps, we report how many of the corresponding APIs were called in the 4th and 8th columns, how many apps have called these APIs in the 5th and 9th columns, how many of the parameter strings had their values eventually resolved in the 6th and 10th, and the corresponding percentages in the 7th and 11th columns.</p><p>We can observe from Table <ref type="table">V</ref> that we are interested in a parameter called bucketName from 2 different sets of APIs in AWS. This is because we need bucketName to locate the corresponding S3 storage for authorization vulnerability verification. We are also interested in identityPoolId, which is used to detect the permission misconfiguration vulnerability in AWS, and accessKey and secretKey are also clearly of direct interest. For Azure, we are interested in parameters appURL, connectionString, and appKey. For Firebase, we are interested in google_app_id, google_api_key, firebase_database_url, and google_storage_bucket. The app may call each of these APIs one or more times at different places.</p><p>Based on how the strings are used by the app code, String Value Analysis has resolved the vast majority of the string values, as shown in the 7th and 11th column in Table <ref type="table">V</ref> for both non-obfuscated and obfuscated apps. It would also be interesting to understand why not all the parameter strings could be resolved by our String Value Analysis. Our further investigation revealed that there are two reasons for this. The first one is that many of the unresolved values of these parameters were actually retrieved from the Internet. This case is particularly common for Firebase, as Google actually   recommends that developers retrieve keys from the remote servers <ref type="bibr">[3]</ref>. Without dynamic analysis of the apps, we could not infer their values. The second reason is that some apps are using cryptographic functions to protect the string, which we cannot resolve with static analysis.</p><p>3) Vulnerability Identification: With the identified keys and strings of our interest, our 3rd component, Vulnerability Identification, then detects the vulnerabilities based on our zero-data-leakage policies described in &#167;V-C and has identified 17, 299 vulnerabilities in total. Note that one app may have multiple data leakage vulnerabilities, and we count the vulnerabilities based on the vulnerable services.</p><p>&#8226; Key Misuse Vulnerabilities. As discussed in &#167;III-A, these vulnerabilities mainly exist in the Azure and AWS clouds. Based on the app key value, and the format of the keys, we directly detect vulnerabilities in Azure if we notice that the app key is either an account key or full access key. The statistics of the vulnerable apps in Azure is presented in We can notice from Table <ref type="table">VI</ref> that the most vulnerable category (in terms of percentage) is from permission misconfiguration of the "Open" S3 Storage of AWS: 15.30% for non-obfuscated apps and 24.44% for obfuscated apps. It can be observed for Azure that obfuscated apps tend to be less vulnerable (13.89% vs. 20.51%). However, in AWS and Firebase, obfuscated apps are even more vulnerable (except the "Open" Database for Firebase). This is likely because the misconfiguration errors are product-specific and have less connection with the user's security expertise.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Vulnerability Analysis</head><p>Severity Analysis. Next, we would like to study the severity of the vulnerabilities among the mobile apps we discovered. We use the number of the downloads of the vulnerable apps to characterize the severity: the higher number of downloads, the more severe the vulnerability. To this end, we count the number of downloads of the vulnerable apps in each download category (e.g., between one billion to five billion). This result is reported in the last four columns of Table <ref type="table">VII</ref>. For the very popular apps (we define an app is very popular if its total number of downloads exceeds one million) that have used cloud APIs, 569 of them are subject to the data leakage attack. Among these apps, 10 of them have downloads between 100 million and 500 million, 14 with 50 million to 100 million, and 80 with 10 million to 50 million. Clearly, the data leakage vulnerabilities we studied are quite concerning. If an attacker has exploited them, then billions of sensitive data records could have been leaked.</p><p>Obfuscation vs. Non-Obfuscation. Since we are able to differentiate non-obfuscated and obfuscated apps, we also would like to understand the effect of obfuscation with respect to app security. It is interesting to observe that obfuscation is typically applied to top downloaded apps. As shown in Table VII: the higher number of downloads an app has, the more   likely it is obfuscated. We believe this is because developers of these apps are more likely to have a better security mindset. However, even though the apps might have been obfuscated, we can still detect their data leakage vulnerabilities. (In fact, many of the top apps detected as vulnerable are obfuscated, as shown in Table <ref type="table">VII</ref>). This is because our key techniques are obfuscation-resilient and regardless whether an app is obfuscated or not, we are still able to resolve the vast majority of the strings of our interest, as shown in the 7th and 11th column of Table <ref type="table">V</ref>. Therefore, obfuscation does not help developers defeat data leakage attacks; they must implement proper authentication and authorization in order to prevent these attacks.</p><p>False Positive Analysis. LeakScope first uses static analysis to identify strings of interest (e.g., various keys used by the app), and then uses dynamic analysis to confirm the data leaks by inspecting the responses to our leakage-probing requests. There are no false positives in determining whether the data stored in the cloud can be leaked. That is, for all the vulnerable apps we detected, their servers are subject to data leakage attacks. However, there might be cases in which developers may deliberately leave their data open. To really decide whether LeakScope has any false positives in this regard, we must look at the data itself. If the corresponding leaked data is not privacy sensitive, then it is a false positive.</p><p>To this end, we manually registered a user account from the app with the corresponding cloud server, and we reverse engineered both the app code and the network traffic to understand whether the data stored in the cloud is privacy sensitive or not. We could not confirm this with all of the apps data due to our limited man power and also the grand challenge of reverse engineering the obfuscated apps, so instead we only focused on the top 10 most popular vulnerable apps in which we have the best understanding from each of the tested clouds.</p><p>The detailed report for each of these apps and the data that can be leaked is reported in Table <ref type="table">VIII</ref>. Note that we would like to keep the app name anonymized since not all of them have been patched yet, and therefore we only report the name of the app (the 2nd column) shown in the Google Play if its vulnerabilities has been patched (as of May 2018, there are two apps whose servers have been patched.), followed by the app description and functionality (the 3rd column), whether this app has been obfuscated (the 4th column), the specific data that can be leaked from the cloud server for this particular app (the 5th column), and finally whether these data are privacy sensitive (the last column).</p><p>For the top 10 vulnerable apps that have used AWS, we notice that many of them store user photos: either user avatars or the photos taken by the users. There are also some other files such as videos and configurations. Interestingly, there are two news apps that use AWS for storage (but the news content is not stored in AWS). In particular, they allow users to report news such as a witnessed accident and in the meantime allow users to attach pictures or videos about the reported news. Clearly, an attacker could easily grab these files. We also have to stress that an attacker can tamper with the integrity of the files stored in AWS as well. We have similar observations for the vulnerable apps that use Azure. Most of the data are privacy sensitive, such as user photos, chat history, and videos. For instance, the 9th app, a car insurance related app, allows the users to take and upload a video for car inspection. We believe these files clearly should be protected.</p><p>Unlike AWS and Azure, which are mainly used by apps for storage, Firebase is a database that contains a variety of data records. As reported in the 5th column of Table <ref type="table">VIII</ref>, we summarize those data records according to their category such as user name, user ID, and user email. While most of the data are privacy sensitive, we notice there is one app that only stores music related data in the database. In particular, the 2nd app, a music related app, allows users to guess the information of songs. All the data in its database are related to the music, such as music ID, music download URL, and the singer. While it does not contain any privacy sensitive data, anyone could obtain the entire database with a single HTTPS request. We believe this is not what the developers have intended (e.g., a competitor could easily build a similar system with these data).</p><p>In summary, what LeakScope can automatically discover is the cases in which the data stored in the cloud back-end can be leaked. To really determine whether LeakScope has any false positives, both end-users and service providers would need to classify whether the data is of importance to them and is privacy sensitive or not. Currently, we do not have an automatic technique, though our manual classification with 30 vulnerable apps has shown that 86.7% of these apps' data is indeed privacy sensitive.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VII. DISCUSSION</head><p>Our study has uncovered tens of thousands of mobile apps that contain cloud data leakage vulnerabilities. Altogether, these apps have accumulated downloads of between 4 billion and 14 billion. As such, it is a very serious security problem. In this section, we discuss further why such vulnerabilities exist and the countermeasures ( &#167;VII-A), the limitations and future work ( &#167;VII-B), and finally how we handled ethics during our study ( &#167;VII-C).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Root Causes and Countermeasures</head><p>There are many reasons for the data leaks in the cloud. The first one is "security through obscurity". Developers may believe that no one could find their (root) keys. But unfortunately, with simple reverse engineering of the (obfuscated) mobile apps, an adversary can easily extract various keys and directly use them to communicate with the server. The second reason is the lack of security training when using the SDK. For instance, it is an absolute security disaster to use a root key to communicate with the server. It is also a huge mistake to not validate the user's identity when accessing particular resources.</p><p>In response, providing security training to developers is an immediate step to alleviate this problem. Cloud providers should clearly document various mistakes that developers could make and their consequences in their manuals, and most importantly provide the correct way (not the wrong way) to use the keys. In fact, very surprisingly, we discovered that an official example from Azure documentation had actually misused the root keys (instead of using the SAS keys) to communicate with the cloud back-end from the mobile apps. This also explains why there are so many key misuses in Azure.</p><p>More importantly, cloud providers should also offer better security tools and SDKs to help developers. For instance, the SDK should perform type checks, and the cloud back-end should also reject the incorrect use of the keys. The SDK should also make the security policy specification easier, especially for Google Firebase, where more templates or GUI interfaces could have been provided to make it easier for developers to follow. Finally, cloud providers could also develop security tools to detect data leaks (e.g., by checking for insecure access control policies in the cloud back-end periodically).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Limitations and Future Work</head><p>While LeakScope has detected many data leakage vulnerabilities in the cloud back-end from mobile apps, clearly it is not perfect and has many limitations. First, it has false negatives. This is because the detection of the vulnerability is based on the APIs listed in Table <ref type="table">III</ref>. If there are any other APIs that also involve app or developer credentials in their parameters, LeakScope will have missed the identification of these strings. For one of our future efforts, we would like to focus on on more systematically examining all of the APIs from cloud provider SDKs.</p><p>Second, our String Value Analysis does not recognize dynamically generated values, e.g., those received from remote servers, since we use static analysis without actually executing the apps. For instance, there are 404 apps from which LeakScope has failed to extract strings of our interest. Note that this also contributes to the false negatives. To handle these apps, we plan to use dynamic analysis to run the apps, hook the APIs of our interest, and extract the corresponding parameters. This is another future work of ours.</p><p>Third, due to ethics considerations ( &#167;VII-C), we only validated the data leakage vulnerabilities with our best efforts. For instance, we only identified 9, 023 no permission check vulnerabilities in Firebase. In fact, this is because we could only automatically register users with only 13, 506 out of the 101, 380 apps that used Firebase in our dataset. We should be able to identify more vulnerabilities if there are any other approaches to bypass the authentication for the remaining 87, 874 apps, or if there is collaboration from the cloud providers. Increasing the coverage of our analysis is the 3rd avenue for our future work.</p><p>Finally, LeakScope only focuses on the apps that use cloud APIs to develop the mobile apps. Clearly, there is a significant portion of the apps that have directly used other types of cloud services (e.g., the IaaS cloud) in their back-end. How to identify these apps and their vulnerable cloud services in a principled manner, as LeakScope has achieved for mBaaS, is another avenue for our future work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Ethics</head><p>Since our work aims to identify data leakage vulnerabilities in the cloud, we had to ensure that our research would not directly leak any of the customer data. As described in &#167;V-C, we took the ethics into consideration and designed a zero-dataleakage vulnerability identification approach by considering how the server would respond to a client request based on different user roles. Though this approach has limited the number of vulnerabilities we could identify, it is secure with respect to the customer data.</p><p>Moreover, we have made responsible disclosure to each of the cloud providers, and through them can reach the mobile app developers. All of the cloud providers are actively working on addressing the issues we reported. For instance, we have learned from Google that they have immediately warned the vulnerable Firebase users and are monitoring the vulnerability patching process, especially for the super popular apps (w/ between 100 and 500 million users).</p><p>Furthermore, over the past a few months, we have also been engaging with the cloud providers on how to detect, mitigate, and prevent these data leakage vulnerabilities. More importantly, as part of the consequences of our research, Google has planned to provide more developer-friendly SDKs when configuring the user permissions for authorization. Azure has corrected its documentation on how to use the right keys to communicate with the cloud in its recent git commits <ref type="bibr">[8]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VIII. RELATED WORK</head><p>Vulnerability Identification with Mobile Systems. Developing mobile apps is similar to developing traditional software in which developers could have made mistakes, thereby leading to various security vulnerabilities. Over the past many years, significant efforts have focused on identifying various vulnerabilities from mobile apps. Early efforts focused on identifying privacy leakage, since a user's GPS coordinates, address book, etc., can be accidentally leaked. TaintDroid <ref type="bibr">[28]</ref>, PiOS <ref type="bibr">[27]</ref>, and AndroidLeaks <ref type="bibr">[29]</ref> are examples of these efforts. They leveraged either dynamic analysis to track whether sensitive information (e.g., the address book) can be leaked, or static analysis to identify leakage.</p><p>In addition to privacy leaks from mobile apps, there are also other security vulnerabilities. For instance, component hijacking vulnerabilities <ref type="bibr">[32]</ref> allow an attacker to hijack the flow and perform unauthorized read and write operations, code injection vulnerabilities <ref type="bibr">[30]</ref> enable an attacker to inject malicious Javascript code into mobile apps, and hanging attribute references vulnerabilities <ref type="bibr">[21]</ref> allow a malicious app to acquire critical system capabilities. Correspondingly, a number of tools such as CHEX <ref type="bibr">[32]</ref> and Harehunter <ref type="bibr">[21]</ref> have been developed to identify them.</p><p>Most recently, there were also a number of efforts to identify server side vulnerabilities of mobile apps. For instance, there are password brute-forcing attacks <ref type="bibr">[47]</ref> if a server fails to track the number of user login attempts, shopping for free if a merchant server does not validate the payment information <ref type="bibr">[40]</ref>, SQL injection and server API misuse vulnerabilities if the servers do not check the requests from the apps <ref type="bibr">[46]</ref>, <ref type="bibr">[49]</ref>, and the use of insecure user tokens (e.g., no randomness) in server authorization <ref type="bibr">[48]</ref>. There are also corresponding tools such as AutoForge <ref type="bibr">[47]</ref> and AuthScope <ref type="bibr">[48]</ref> to identify them. Misconfiguration Vulnerability Detection. Complex software systems such as the mBaaS cloud are difficult to configure and manage, and consequently various configuration errors can be introduced. Incorrect access control configuration, such as the permission misconfiguration that LeakScope aims to discover will clearly lead to security vulnerabilities. Unlike the key misuse vulnerabilities, which are caused by mistakes from the app developers, permission misconfigurations are caused by system administrators.</p><p>To detect permission misconfiguration in access control systems (e.g., firewalls), FIREMAN <ref type="bibr">[41]</ref> uses symbolic model checking of the firewall configurations to infer policy violations and inconsistencies. In typical application systems (e.g., healthcare), Bauer et al. <ref type="bibr">[25]</ref> have applied association rule mining to the access control logs to infer the intended policies and the misconfigurations. In an enterprise network, Baaz <ref type="bibr">[26]</ref> infers the permission misconfiguration by monitoring updates to the access control metadata and looking at inconsistency among peers.</p><p>There are also numerous efforts to detect misconfigurations in software systems with configuration testing. ConfErr <ref type="bibr">[31]</ref> is a blackbox configuration testing tool, which exposes configuration errors by injecting spelling errors, structural errors, and semantic errors. ConfAid <ref type="bibr">[22]</ref> is a white box configuration diagnosis tool, which explores the control and data flows related to the erroneous behavior to specific tokens in configuration files. SPEX <ref type="bibr">[39]</ref> is also a white-box configuration testing tool, which generates configuration errors based on how the configuration parameter is read and used.</p><p>Being a blackbox testing tool, LeakScope only explores the differences in the server response messages to infer whether a cloud server has configured the user permissions correctly. We believe cloud providers can certainly go beyond blackbox testing, and instead they can develop whitebox approaches to proactively detect permission misconfigurations.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IX. CONCLUSION</head><p>We have studied the problem of why there have been so many recent private data leaks from the cloud, and we discovered that the misuse of various keys in mobile app authentication and misconfiguration of user permissions in authorization are the two root causes that can lead to the massive data leaks in the cloud. We have designed and implemented LeakScope to automatically identify the cloud services that can contain data leakage vulnerabilities from mobile apps. Our evaluation with over 1.6 million mobile apps from the Google Play Store has uncovered tens of thousands of vulnerable cloud services including those from Google, Amazon, and Microsoft. We have made responsible disclosure to each of the vulnerable service providers, and they have all confirmed the vulnerabilities we identified and are actively working with the mobile app developers to patch their vulnerable services.</p></div></body>
		</text>
</TEI>
