Security Smells Pervade Mobile App Servers
Total Page:16
File Type:pdf, Size:1020Kb
Security Smells Pervade Mobile App Servers Pascal Gadient Mohammad Ghafari Marc-Andrea Tarnutzer University of Auckland Oscar Nierstrasz Auckland, New Zealand Software Composition Group, University of Bern [email protected] Bern, Switzerland ABSTRACT channels has been built into recent releases of the Android ecosys- 3 [Background] Web communication is universal in cyberspace, and tem. Generally speaking, the existing literature has covered the security risks in this domain are devastating. [Aims] We analyzed transmitted payload by using client-side static [5] and dynamic the prevalence of six security smells in mobile app servers, and analysis techniques [12], server side analyses of web service source we investigated the consequence of these smells from a security code [9] as well as connection properties, e.g., the URL [16] or perspective. [Method] We used an existing dataset that includes two-factor authentication [13]. Another topic that has received 9 714 distinct URLs used in 3 376 Android mobile apps. We exercised extensive attention is that of hard-coded credentials in apps that these URLs twice within 14 months and investigated the HTTP may allow adversaries unrestricted access to the relevant infras- headers and bodies. [Results] We found that more than 69% of tested tructure [11, 15]. apps suffer from three kinds of security smells, and that unprotected Unfortunately, the server configurations of off-the-shelf applica- communication and misconfigurations are very common in servers. tion servers have received much less attention. A recent work has Moreover, source-code and version leaks, or the lack of update identified eight web API security smells, but did not assess their policies expose app servers to security risks. [Conclusions] Poor prevalence [3]. These smells are symptoms in the code that signal app server maintenance greatly hampers security. the prospect of a security vulnerability [4]. In this work we assess app servers that are used for communicating with mobile apps. We CCS CONCEPTS investigated the presence of six app server security smells, and the corresponding server maintenance activity based on the dataset • Security and privacy ! Web application security. that contains 9 714 distinct URLs that were used in 3 376 apps. We KEYWORDS address the following research questions: RQ1: What is the prevalence of the server side security smells in security smells, web communication, mobile apps the web communication of mobile apps? We found 231 URLs from ACM Reference Format: 44 apps that leak the source code of the web service implementa- Pascal Gadient, Marc-Andrea Tarnutzer, Oscar Nierstrasz, and Mohammad tion if processing errors occur. We can further confirm that most Ghafari. 2021. Security Smells Pervade Mobile App Servers. In ACM / IEEE app servers communicate with apps over insecure HTTP connec- International Symposium on Empirical Software Engineering and Measure- tions [10], and fail to enforce use of the HTTP strict transport ment (ESEM) (ESEM ’21), October 11–15, 2021, Bari, Italy. ACM, New York, security policy. Finally, we found that on average almost every NY, USA, 10 pages. https://doi.org/10.1145/3475716.3475780 second app server suffers from version information leaks. 1 INTRODUCTION RQ2: What is the relationship between security smells and app server maintenance? In particular, we are interested in configura- Globally accessible, reliable, and scalable web services are on the tion changes, because they provide insights into established main- 1 rise, with more than 24 000 currently known public web APIs. Like- tenance processes of mobile app servers. Based on the collected wise, native apps are starting to decline while web apps arise that HTTP header information from two measurements over 14 months, 2 depend on application servers. Additionally during the past years, we evaluated what software changes are introduced by system ad- the complexity of developing a web-enabled app has massively ministrators. We observed that servers are usually set up once and arXiv:2108.07188v1 [cs.CR] 16 Aug 2021 increased due to the growing number of involved application frame- never touched again, yielding severe security risks. For instance, works, programming languages, and supported device categories, criminals can attack outdated app servers by exploiting vulnerabil- e.g., desktops, notebooks, tablets, smartphones, and wearables. ities listed in public databases or illicit websites. On the positive Web communication has already received much attention in side, we noted that version upgrades are much more common than the security community, leading to improved tool support. For ex- version downgrades, and that developers occasionally use Cloud- ample, programs exist that can continuously monitor web APIs flare to protect their infrastructure against adversaries, especially to ensure that an app remains compliant with the API specifica- for non-JSON-based app servers. tion [14], and tool support to mitigate insecure communication In summary, this work reveals the prevalence of insecure app 1https://www.programmableweb.com/apis/directory server configurations accessed by Android mobile apps, and their 2https://www.forbes.com/sites/victoriacollins/2019/04/05/why-you-dont-need-to- maintenance protocol. The list of apps that we analyzed in this study make-an-app-a-guide-for-startups-who-want-to-make-an-app/ is available online,4 and we share the aggregated data for research ESEM ’21, October 11–15, 2021, Bari, Italy 2021. ACM ISBN 978-1-4503-8665-4/21/10...$15.00 3https://developer.android.com/training/articles/security-config https://doi.org/10.1145/3475716.3475780 4https://doi.org/10.6084/m9.figshare.14981061 ESEM ’21, October 11–15, 2021, Bari, Italy Pascal Gadient, Marc-Andrea Tarnutzer, Oscar Nierstrasz, and Mohammad Ghafari purposes on request due to the contained sensitive information sensitive user data. Issue: The access to sensitive data or actions is such as credentials, API keys, and email addresses. not restricted by a sane authentication mechanism such as a user The remainder of this paper is organized as follows. We report name and password pair, instead, easy-to-forge identifiers or no on app server security smells relevant for this work in Section 2. identification data at all are used to secure the access. Symptom: We describe the dataset used for our app server investigations in A server does not respond with the status code 401 Unauthorized Subsection 3.1. We provide the prevalence of app server security or 403 Forbidden. In other words, the server successfully responds smells in Subsection 3.2, and we shed light on server infrastructure without asking for any credentials. maintenance in Subsection 3.3. Finally, we recap the threats to validity in Section 4, and we summarize related work in Section 5. 2.5 Missing HTTPS redirects We conclude this paper in Section 6. We found servers that do not redirect clients to encrypted connec- 2 SECURITY SMELLS IN APP SERVERS tions although they would have been supported. Issue: App servers do not redirect incoming HTTP connections to HTTPS when legacy In this section, we briefly explain six of the eight security smells apps try to connect. Symptom: For an HTTP request, a server does that we identified in previous work [3]. The two remaining security not deliver an HTTP 3xx redirect message which points to the smells, i.e., Credential leak and Embedded languages are not within corresponding HTTPS implementation of the web application. For the scope of this study, because they require a deep understanding an HTTPS request, a server delivers a HTTP redirect message. of the app and the context where they occur. 2.6 Missing HSTS 2.1 Insecure transport channel HTTP header information is used to properly set up the connec- Web communication relies on HTTP or HTTPS; both variants exist tion by specifying various communication parameters, e.g., the in app server configurations. Issue: HTTP does not provide any acceptable languages, the used compression, or the enforcement of security; neither the address, nor the header information or the HTTPS for future connection attempts, a feature which is called payload are encrypted. Symptom: The URL begins with http://. HTTP Strict Transport Security (HSTS). HSTS provides protection against HTTPS to HTTP downgrading attacks, i.e., when a user 2.2 Disclosure of source code once accessed a web resource in a secure environment (at home Error messages leak valuable information regarding the implemen- or work), the client knows that the resource needs to be accessed tation of a running system. Issue: Error messages that include the only through HTTPS. If this is not possible, e.g., at an airport at relevant stack trace are transmitted as plain text in the server’s which an attacker tries to perform MITM attacks, the client will message response body. Such a message reveals information like display a connection error. Hence, HSTS should be used in combi- the used method names, line numbers, and file paths disclosing nation with HTTP to HTTPS redirects, because the HSTS header the internal file system structure and configuration of the server. is only considered to be valid when sent over HTTPS connections. Symptom: The returned HTTP body contains a stack trace or a code Issue: Servers either do not leverage the HSTS feature, or they snippet that shows the problematic code. The structure of such do not use the recommended parameters. Symptom: A server does data depends on the used framework, however terms related to not deliver the HTTP HSTS header Strict-Transport-Security: application crashes are common, e.g., “stack,” “trace,” and “error.” max-age=31536000; includeSubDomains for an HTTPS request. 2.3 Disclosure of version information 3 EMPIRICAL STUDY Besides useful connection parameters, HTTP headers leak infor- For this empirical study we evaluated all URLs from the dataset mation regarding the software architecture and configuration of a according to the security smell symptoms described in the previ- running system.