Identifying vulnerabilities of SSL/TLS certificate verification in Android apps with static and dynamic analysis

https://doi.org/10.1016/j.jss.2020.110609Get rights and content

Highlights

  • Develop an automated tool called DCDroid to detect SSL/TLS vulnerabilities.

  • DCDroid is more effective and efficient than other related methods and tools.

  • DCDroid works with the combination of static and dynamic analysis.

  • Design a mechanism to avoid crashes when executing the Activity of vulnerable code.

  • Develop a tool to identify the traffic generated by an app.

Abstract

Many Android developers fail to properly implement SSL/TLS during the development of an app, which may result in Man-In-The-Middle (MITM) attacks or phishing attacks. In this work, we design and implement a tool called DCDroid to detect these vulnerabilities with the combination of static and dynamic analysis. In static analysis, we focus on four types of vulnerable schema and locate the potential vulnerable code snippets in apps. In dynamic analysis, we prioritize the triggering of User Interface (UI) components based on the results obtained with static analysis to confirm the misuse of SSL/TLS. With DCDroid we analyze 2213 apps from Google Play and 360app. The experimental results show that 457 (20.65%) apps contain potential vulnerable code. We run apps with DCDroid on two Android smart phones and confirm that 245 (11.07%) of 2213 apps are truly vulnerable to MITM and phishing attacks. We propose several strategies to reduce the number of crashes and shorten the execution time in dynamic analysis. Comparing with our previous work, DCDroid decreases 57.18% of the number of apps’ crash and 32.47% of the execution time on average. It also outperforms other three tools, namely, AndroBugs, kingkong and appscan, in terms of detection accuracy.

Introduction

Smartphones are now widely used in people’s daily life. Android has become the most popular mobile operating systems (OS), accounting for around 74.13% of the smart phone’s market in the world (Mobile Operating System, 2020). According to Google’s statistics, there are over 2.9 million Android apps that are downloaded for over hundreds of billions times from Google Play as of December 2019 (Google Play Store, 2020). These apps cover a range from life, entertainment to finance or business. In order to secure the transmission of sensitive data for avoiding data leakage or attacks, many apps use HTTPS (HTTP over Security Socket Layer (SSL)/Transport Layer Security (TLS)) protocol to transmit sensitive data (Google, 2020). Unfortunately, improper implementation of SSL/TLS certificates can lead to Man-In-The-Middle (MITM) attacks (Clark and van Oorschot, 2013) and phishing attacks (He et al., 2015). In the process of MITM attack or phishing attack, attackers impersonate the server to intercept and even modify app traffic to obtain sensitive data. In general, an attacker is not able to decrypt network traffic. However, if the client blindly trusts any certificate without checking the signatures, or does not verify the host name, or ignores the verification error prompts, the attacker can impersonate the server to gain the trust of the client using a fake certificate, and then decrypt the traffic to obtain sensitive data during the attack.

Existing efforts have been made on the detection of malicious apps. Our previous work detected malicious apps (Wang, Gao, Zhao, Li, Liu, Zhang, 2018, Su, Liu, Wang, Wang, 2019, Wang, Zhao, Gao, Xu, Xian, Li, Zhang, 2019, Xie, Wang, Wang, Liu, 2019), analyzed privacy leakage (Liu, Liu, Wang, Zhu, 2018, Liu, Liu, Zhu, Wang, Zhang, 2019) and detected (Wang, Battiti, 2006, Wang, Guyet, Quiniou, Cordier, Masseglia, Zhang, 2014, Wang, Zhang, Pitsilis, 2010, Wang, Liu, Pitsilis, Zhang, 2018, Xu, Guo, Su, Zheng, Liang, Wong, Wang, 2020, Wang, Guan, Zhang, Yang, 2006, Wang, He, Liu, Gombault, 2015, Feng, Wang, Zhu, Zhang, 2009, Wang, Guan, Zhang, 2008, Wang, Shang, He, Li, Liu, 2020, Guan, Wang, Zhang, 2009, Wang, Zhang, Gombault, Knapskog, 2009, Wang, Guan, Zhang, 2004, Wang, Zhang, Gombault, 2009) or prevented (Xu, Wang, Jiao, Li, Liang, Zheng, Lian, Xian, Gao, 2019, Li, Xu, Jiao, Li, Wang, Hu, Xian, Lian, gao, 2019, Wang, Guan, Zhang, 2004) intrusions with different methods. There also exist related work (Fahl, Harbach, Muders, Smith, Baumgärtner, Freisleben, 2012, Brubaker, Jana, Ray, Khurshid, Shmatikov, 2014, Sounthiraraj, Sahs, Greenwood, Lin, Khan, 2014, Liu, Zuo, Zhang, Guo, Xu, 2018) on Android MITM attacks caused by improper implementation of SSL/TLS in Android’s apps. However, these methods require manual analysis to confirm vulnerabilities. Most of the related work aimed at the detection of malicious apps, rather than the detection of vulnerabilities. They often focus on a specific kind of Android apps, and the vulnerabilities detected are not comprehensive enough. In addition, some existing work started Activity directly in the process of detection, which may lead to apps’ crash.

In order to solve these problems, in our previous work (Wang et al., 2019c), we propose an automatic method to detect apps with SSL/TLS certificate verification vulnerabilities. It contains the following steps: definition of the vulnerable code, detecting the vulnerability of Smali code and running app dynamically under the MITM attack with fake certificates. Finally, by analyzing the traffic between an app and the server to confirm the vulnerability (that is, an app is confirmed to have this kind of vulnerability when it is successfully attacked). However, we find that some apps crashed during the detect process, and some apps were run too long time. In addition, a number of false positives exist with our previous method. Through comprehensive analysis, we summarize the following reasons for the problems:

  • Some Activities of an app cannot start directly. They must be run in a certain order from one Activity to another.

  • Some apps have many similar UI elements, and these elements are different while the code logic is the same (such as some tabs).

  • Some HTTPS connections of an app are mixed with others because some apps are run in the background (such as some system services).

In order to deal with these problems and detect the vulnerabilities stably, fast and accurately, we re-design our tool called DCDroid (Detecting vulnerable Certificates in Android apps) that contains static analysis, dynamic analysis and traffic analysis. In static detection, we define vulnerable code, disassemble an app to get Smali code and search the code to locate the vulnerable point. We then get the entry point by analyzing the invocation relationship of the method. In dynamic detection, the apps are run under the guide of static analysis. An activity with vulnerable code does not start directly so that the tool is more stable in the detection. Besides, duplication is reduced in execution phase with some strategies. Next we set up proxy servers to carry out MITM attacks. We develop an app to capture traffic on the smart phone so that we can get the pure traffic of apps and reduce the false positives. With these measures, we have achieved higher accuracy, stability and execution efficiency.

We make the following contributions:

  • We develop an automated tool called DCDroid to detect SSL/TLS vulnerabilities with the combination of static and dynamic analysis. With DCDroid, we analyze 2213 apps and find that 457 apps are vulnerable through static analysis. After dynamic analysis we find that 245 apps are truly vulnerable. There are over 10% of apps that have vulnerabilities of SSL/TLS. We analyze the categories and version evolution of vulnerable apps and provide our suggestions to developers based on the detection results.

  • We start executing the Activity of the vulnerable code from the Main Activity of an app instead of starting it directly. By dynamic execution, DCDroid is more stable than previous work with few crashes. Compared with starting Activity directly, the number of crashes decreased by 3.39 (57.18%) times per app on average.

  • We reduce some meaningless execution during the detection processes. We detect vulnerable but similar views with some strategies, and the running time for each app decreases by 88 seconds (32.47%).

  • We develop an app to capture traffic on Android smart phones to mark the relationships between traffic and apps. We find that the traffic is more reliable in the experiments and we identify 3 false positives with DCDroid.

The remainder of this paper is organized as follows. In Section 2, we introduce the background. We introduce the research statement and main challenges in Section 3. In Section 4, we present DCDroid based on the static analysis and the dynamic analysis. We describe the data sets and give our experimental results in Section 5. In Section 6, we discuss the limitations of DCDroid. We introduce related work in Section 7. Finally we conclude this paper in Section 8.

Section snippets

Background

In this section, we first introduce the applications of SSL/TLS on Android, then the Android UI, and finally the network and MITM of Android.

Problem statement

In this section, we introduce the main challenges in this work.

Our method

In this section, we first introduce the framework of our method, then describe the static detection process, and finally introduce the dynamic detection process.

Experiments

We use a Windows 10 computer as the running environment, an Ubuntu 12.0 as the attack environment, and two Android 6 smart phones as the client environment.

Discussion and analysis

DCDroid implements automatic detection of digital certificate verification vulnerabilities with static detection and dynamic detection under the guidance of static detection. Although it has been demonstrated as effective, there are still limitations.

In static detection, we check the vulnerable code, such as the method that only has a simple instruction-return. However, some code may have complex implementation of the method and finally still does not conduct the verification. We cannot check

Related work

Information security has been widely studied. Privacy, such as identity privacy (Li, Shen, 2013, Li, Liu, Cheng, Qiu, Wang, Zhang, Zhang, 2018) or search privacy (Li et al., 2019a), has also been a research topic. Li and Shen (2013) proposed an effective rank-based attack model and algorithms for rank anonymization and hypergraph reconstruction, in the aim to privacy preserving for hypergraph-based data publishing. Li et al. (2019a) showed various privacy problems in forward and backward

Conclusion

In this work, we propose an effective method and develop a tool called “DCDroid” to identify the vulnerabilities in the implementation of SSL/TLS digital certificate verification in Android system. We analyze 960 apps from Google Play and 1253 apps from 360app with DCDroid. Extensive experimental results show that with initial static analysis, 457 (20.65%) apps contain potential security risks in the implementation of SSL/TLS and with further dynamic analysis 245 (11.07%) out of 2213 apps are

CRediT authorship contribution statement

Yingjie Wang: Methodology, Software, Validation, Writing - original draft, Visualization. Guangquan Xu: Methodology, Formal analysis. Xing Liu: Methodology, Software, Formal analysis. Weixuan Mao: Methodology, Validation, Visualization. Chengxiang Si: Formal analysis, Data curation. Witold Pedrycz: Methodology, Validation. Wei Wang: Conceptualization, Methodology, Formal analysis, Investigation, Writing - review & editing, Writing - original draft, Project administration, Funding acquisition,

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgements

The work reported in this paper was supported in part by Natural Science Foundation of China, under Grant U1736114, and in part by National Key R&D Program of China, under grant 2017YFB0802805.

Yingjie Wangis currently a M.S. student of the School of Computer and Information Technology, Beijing Jiaotong University, China. He received his B.S. degree from Southwest JiaoTong University, China, in 2017. His main research interests lie in mobile security.

References (77)

  • W. Wang et al.

    Botmark: automated botnet detection with hybrid analysis of flow-based and graph-based traffic behaviors

    Inf. Sci.

    (2020)
  • W. Wang et al.

    Constructing attribute weights from computer audit data for effective intrusion detection

    J. Syst. Softw.

    (2009)
  • X. Wang et al.

    Characterizing android apps’ behavior for effective detection of malapps at large scale

    Fut. Gener. Comp. Syst.

    (2017)
  • G. Xu et al.

    Am i eclipsed? a smart detector of eclipse attacks for ethereum

    Comput. Secur.

    (2020)
  • Activities, 2020....
  • AndroBugs, 2020....
  • Android Developer Training ś Security with HTTPS and SSL, 2020....
  • Androguard, 2020....
  • AndroidViewClient, 2020....
  • Android apktool, 2020....
  • Appium, 2020....
  • Appscan, 2020....
  • S. Arzt et al.

    Flowdroid: precise context, flow, field, object-sensitive and lifecycle-aware taint analysis for android apps

    ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’14, Edinburgh, United Kingdom - June 09 - 11, 2014

    (2014)
  • R. Bhoraskar et al.

    Brahmastra: driving apps to test the security of third-party components

    Proceedings of the 23rd USENIX Security Symposium, San Diego, CA, USA, August 20–22, 2014

    (2014)
  • C. Brubaker et al.

    Using frankencerts for automated adversarial testing of certificate validation in SSL/TLS implementations

    2014 IEEE Symposium on Security and Privacy, SP 2014, Berkeley, CA, USA, May 18–21, 2014

    (2014)
  • J. Clark et al.

    Sok: SSL and HTTPS: revisiting past challenges and evaluating certificate trust model enhancements

    2013 IEEE Symposium on Security and Privacy, SP 2013, Berkeley, CA, USA, May 19–22, 2013

    (2013)
  • F. Dong et al.

    Frauddroid: automated ad fraud detection for android apps

    Proceedings of the 2018 ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ESEC/SIGSOFT FSE 2018, Lake Buena Vista, FL, USA, November 04–09, 2018

    (2018)
  • N. Elenkov

    Android Security Internals: An In-Depth Guide to Android’s Security Architecture

    (2014)
  • S. Fahl et al.

    Why eve and mallory love android: an analysis of android SSL (in)security

    the ACM Conference on Computer and Communications Security, CCS’12, Raleigh, NC, USA, October 16–18, 2012

    (2012)
  • Fidder, 2020....
  • J. Gao et al.

    Poster: on vulnerability evolution in android apps

    2018 IEEE/ACM 40th International Conference on Software Engineering: Companion (ICSE-Companion)

    (2018)
  • M. Georgiev et al.

    The most dangerous code in the world: validating SSL certificates in non-browser software

    The ACM Conference on Computer and Communications Security, CCS’12, Raleigh, NC, USA, October 16–18, 2012

    (2012)
  • Google, H. a., 2020....
  • GnuTLS Transport Layer Security Library, 2020....
  • B. He et al.

    Vetting SSL usage in applications with SSLINT

    2015 IEEE Symposium on Security and Privacy, SP 2015, San Jose, CA, USA, May 17–21, 2015

    (2015)
  • Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile, 2020....
  • kingkong, 2020....
  • J. Li et al.

    Searchable symmetric encryption with forward search privacy

    IEEE Trans. Depend. Secure Comput.

    (2019)
  • Cited by (26)

    • Automatic mapping of configuration options in software using static analysis

      2022, Journal of King Saud University - Computer and Information Sciences
      Citation Excerpt :

      For example, in program analysis, the mapping between configuration options and read points is a necessary initial stage, but it is not automated. There is also existing work on malware detection and vulnerability detection using a static analysis (Wang et al., Apr 2021; Fan et al., 2017; Wang et al., 2019; Su et al., 2018; Wang et al., 2017), a dynamic analysis (He et al., 2019), or a hybrid approach (Liu et al., 2020; Wang et al., 2020; Wang et al., 2020). Orpreader (Andrzejak and Iacsa, 2018) locates configuration options using a manual specification of configuration classes and API calls and then infers configuration option names.

    • Behind the Scenes: Uncovering TLS and Server Certificate Practice of IoT Device Vendors in the Wild

      2023, Proceedings of the ACM SIGCOMM Internet Measurement Conference, IMC
    View all citing articles on Scopus

    Yingjie Wangis currently a M.S. student of the School of Computer and Information Technology, Beijing Jiaotong University, China. He received his B.S. degree from Southwest JiaoTong University, China, in 2017. His main research interests lie in mobile security.

    Guanquan Xureceived the Ph.D. degree from Tianjin University, in 2008. He is currently a Full Professor with the Tianjin Key Laboratory of Advanced Networking (TANK), College of Intelligence and Computing, Tianjin University, China. His research interests include cyber security and trust management. He is a member of CCF.

    Xing Liureceived the Ph.D. degree from School of Computer and Information Technology, Beijing Jiaotong University, China, in 2019. He received his B.S. degree from Beijing Jiaotong University in 2012. He visited the department of Computer Science and Engineering, The Pennsylvania State University, from October 2015 to October 2016. His main research interests lie in mobile security and privacy.

    Weixuan Maoreceived the B.S. degree in computer science and engineering and the Ph.D. degree in control science and engineering from Xi’an Jiaotong University, Xi’an, China, in 2009 and 2017, respectively. He is currently a Security Engineer with the National Computer Network Emergency Response Technical Team/Coordination Center of China (CNCERT/CC). His research interests include intrusion/malware detection, data driven security analysis, and program analysis.

    Chengxiang Sireceived the Ph.D. degree from the Institute of Computing Technology, Chinese Academy of Sciences, in 2012. He has been an Engineer with the National Computer Network Emergency Response Technical Team/Coordination Center of China, since 2012. His research interests include networks and information security.

    Witold Pedryczreceived the M.Sc., Ph.D., and the D.Sci. degrees from the Silesian University of Technology, Gliwice, Poland. He is a Professor and the Canada Research Chair of Computational Intelligence with the Department of Electrical and Computer Engineering, Faculty of Engineering, King Abdulaziz University, Jeddah, Saudi Arabia. He is also with the Systems Research Institute of the Polish Academy of Sciences, Warsaw, Poland. His current research interests include computational intelligence, fuzzy modeling and granular computing, and software engineering. He has published numerous papers in the above areas. He has also authored 15 research monographs covering various aspects of computational intelligence, data mining, and software engineering. Dr. Pedrycz was a recipient of the prestigious Norbert Wiener Award from the IEEE Systems, Man, and Cybernetics Society in 2007, the IEEE Canada Computer Engineering Medal 2008, the Cajastur Prize for Soft Computing from the European Centre for Soft Computing for “pioneering and multifaceted contributions to granular computing” in 2009, the Killam Prize in 2013, and the Fuzzy Pioneer Award 2013 from the IEEE Computational Intelligence Society. He was elected as a Foreign Member of the Polish Academy of Sciences in 2009 and a fellow of the Royal Society of Canada in 2012. He has been a member of numerous program committees of the IEEE conferences in the area of fuzzy sets and neurocomputing.

    Wei Wangis currently a full professor in the Department of Information Security, Beijing Jiaotong University, China. He is currently also affiliated with Computer, Electrical and Mathematical Sciences and Engineering Division, King Abdullah University of Science and Technology Saudi Arabia. He earned his Ph.D. degree in control science and engineering from Xi’an Jiaotong University, in 2006. He was a postdoctoral researcher in University of Trento, Italy, from 2005 to 2006. He was a postdoctoral researcher in TELECOM Bretagne and in INRIA, France, from 2007 to 2008. He was a European ERCIM Fellow in Norwegian University of Science and Technology (NTNU), Norway, and in Interdisciplinary Centre for Security, Reliability and Trust (SnT), University of Luxembourg, from 2009 to 2011. He has authored or coauthored over 90 peer reviewed papers in various journals and international conferences. He is an Editorial Board member of Computers & Security and a Young AE of Frontiers of Computer Science. His main research interests include mobile, computer and network security.

    View full text