Copyright by Martin Hristov Georgiev 2015
Total Page:16
File Type:pdf, Size:1020Kb
Copyright by Martin Hristov Georgiev 2015 The Dissertation Committee for Martin Hristov Georgiev certifies that this is the approved version of the following dissertation: On the (In)security of Service APIs Committee: Vitaly Shmatikov, Supervisor Brent Waters Emmett Witchel Lili Qiu XiaoFeng Wang On the (In)security of Service APIs by Martin Hristov Georgiev, B.S., M.S.C.S. DISSERTATION Presented to the Faculty of the Graduate School of The University of Texas at Austin in Partial Fulfillment of the Requirements for the Degree of DOCTOR OF PHILOSOPHY THE UNIVERSITY OF TEXAS AT AUSTIN August 2015 Dedicated to my parents. Acknowledgments I would like to thank my family for their continuous support and encourage- ment throughout the years. My father taught me how to identify good opportunities in life and how to evaluate and prioritize my goals. My mother instilled persever- ance in me and taught me to always strive for the best. My brother taught me time management and organizational skills. I am also forever indebted to my adviser, Vitaly Shmatikov, for his invalu- able help and guidance throughout my PhD. He taught me how to identify important research problems and design novel solutions for them. He also taught me the art of presenting my work to both experts in my field of research and a general audience. Outside of research and academia, I have also learned numerous life skills from him. Thus, I consider myself very fortunate to have him as my PhD adviser. I very much appreciate my dissertation committee members for taking the time to evaluate my research and provide me with comprehensive feedback. Thanks to their thoughtful comments, I greatly improved the quality of my dissertation. Special thanks go to Brent Waters for bringing up the inherent insecurities in short URLs. This idea was one of the prerequisites that empowered the research described in the last chapter of my dissertation. v I want to thank Nona Sirakova for being my emotional support in the tough- est times of my PhD. In addition to being an excellent inspirational character for me, she also taught me mindfulness. I thank Suman Jana for introducing me into computer security research in my first semester of graduate school. I am also grateful to my fellows at The Univer- sity of Texas at Austin: Hongkun Yang, Chad Brubaker, Amir Houmansadr, Reza Shokri, Yuanzhong Xu, Tyler Hunt and Jianyong Meng for our discussions about research, the life of a PhD student, etc. I would like to thank Sanford Miller, Bogdan Petrenko and Sandeep Mitra for guiding my interests in Mathematics and Computer Science throughout my college years. The trio also inspired me to pursue a PhD degree. Finally, I want to say big thank you to my Mathematics teachers: Daniela Zhekova and Stefka Stoilkova for spending countless hours teaching me problem solving skills. I owe it to them that I managed to get the maximum score on many university entrance exams and thus have the opportunity to choose the direction of my personal and professional development. vi On the (In)security of Service APIs Martin Hristov Georgiev, Ph.D. The University of Texas at Austin, 2015 Supervisor: Vitaly Shmatikov Today’s systems abstract the implementation details of common services such as secure client-server communication, access to native device resources (e.g. camera), access to cloud-stored files and folders, etc. by exposing a set of applica- tion programming interfaces (service APIs) to applications and software packages. In this dissertation, we analyze service APIs exposed by modern systems across all layers of the software stack and demonstrate that they are too complex for developers to understand and use correctly. Instead of providing high-level ab- stractions such as authorization and authentication, they provide low-level details such as callbacks, options and flags. As a result, service APIs used in security- critical software often end up being misconfigured and exposing sensitive users’ data to botnet, Web and network attackers. To demonstrate the pervasiveness of the problem, we perform the first sys- tematic analysis of insecure usage of service APIs in modern software developed and maintained by both individual developers and large software companies. vii First, we analyze the perils and pitfalls of low-level service APIs for estab- lishing secure network channels. SSL/TLS (Secure Sockets Layer/Transport Layer Security) is currently the de facto standard for secure Internet communication; its security against active network attackers depends on properly validating server certificates at connection establishment. Unfortunately, our analysis shows that SSL/TLS APIs are often poorly understood and used. As a consequence, server certificate validation is completely broken in many security-critical applications and libraries, and thus exposes users’ data to network attackers. Second, we study the software stack employed by modern hybrid applica- tions. Hybrid apps combine the features of Web apps and “native” apps. Like Web apps, they are implemented in platform-independent languages such as HTML5 and JavaScript. Like native apps, they have direct access to local device resources such as file system and camera. We demonstrate that the frameworks on top of which hybrid apps are developed do not properly compose the access-control poli- cies governing the Web half and the local half of the app. The Web half runs in a browser instance, created by the framework at application initialization time, and is confined by the browser’s same origin policy. The local half is governed by the access-control policy of the operating system. Unfortunately, improper composi- tion of the two types of access-control policies at the framework layer effectively subjects the applications to “fracking” attacks—foreign-origin Web content (e.g., ads) included into hybrid apps can drill through the layers of the software stack and steal user’s contacts list, text messages, photos, etc. viii Third, we analyze service APIs exposed by today’s Web-based application platforms. This new class of platforms provide browser-like runtime environments to support Web-based applications. Such apps run outside the traditional Web browser and enjoy direct access to native objects such as files and GPS. However, unlike the service APIs exposed by hybrid frameworks, this category of service APIs is exposed by the platforms themselves, effectively eroding the distinction be- tween desktop, mobile, and Web-based software. Unfortunately, we demonstrate that the access-control models used by Web-based application platforms are inade- quate. As a result, when applications request access to sensitive resources for their own code, they unintentionally enable it for untrusted third-party code, too. Fourth, we study server-side service APIs exposed by some of today’s cloud services and demonstrate that many of them are vulnerable to scanning and thus leak users’ data. For example, we show that cloud storage providers that allow users to share files and folders via short URLs and support APIs for easy account traversal end up exposing their users to large-scale privacy and security breaches. To address the vulnerabilities plaguing today’s service APIs, we suggest that new principled service APIs be designed, implemented and deployed at all levels of the software stack. Unlike the old APIs, the new service APIs must provide sim- ple interfaces through which developers can easily specify their high-level security objectives such as confidentiality and authentication. In this dissertation, we implement two new principled mechanisms for en- forcing security in service APIs used by Web code of modern hybrid and Web-based ix apps. We also provide recommendations for improving the security of SSL/TLS APIs and APIs for managing cloud-stored files. Our first prototype system is called NOFRAK. It introduces a new technique for protecting native-access APIs in hybrid apps from “fracking” attacks. NOFRAK is platform-independent and requires no changes to the code of existing apps. Our second system is POWERGATE. In its core, POWERGATE is a new access-control mechanism for protecting APIs to native objects in Web-based ap- plications from unauthorized access. POWERGATE enables application developers to write well-defined access-control policies with explicit principals such as “appli- cation’s own local code” and “third-party Web code”. x Table of Contents Acknowledgments v Abstract vii List of Tables xvi List of Figures xvii List of Snippets xix List of Algorithms xxi Chapter 1. Introduction 1 1.1 Threat Model . .3 1.2 Architecture of modern software applications . .6 1.2.1 Client-side service APIs . .7 1.2.1.1 Low-level service APIs . .8 1.2.1.2 Service APIs in the middleware . 10 1.2.1.3 Service APIs in the application layer . 12 1.2.2 Server-side service APIs . 15 1.3 Towards principled service APIs . 18 1.3.1 Design . 19 1.3.2 Implementation . 20 1.3.3 Testing . 21 1.3.4 Backward compatibility . 22 1.4 Contributions and impact . 23 xi Chapter 2. Validating SSL Certificates in Non-Browser Software 27 2.1 Introduction . 27 2.2 Overview of our results . 30 2.3 Overview of SSL . 34 2.3.1 Threat model . 34 2.3.2 SSL certificate validation . 34 2.4 SSL abstractions . 37 2.4.1 SSL libraries . 38 2.4.2 Data-transport libraries . 44 2.5 SSL in non-browser software . 47 2.6 Experimental testbed . 51 2.7 Misunderstanding the SSL API . 53 2.7.1 Amazon Flexible Payments Service (PHP) . 53 2.7.2 PayPal Payments Standard and PayPal Invoicing (PHP) . 54 2.7.3 PayPal IPN in Zen Cart . 55 2.7.4 Lynx . 56 2.7.5 Apache HttpClient . 57 2.7.6 Trillian . 59 2.7.7 Rackspace . 60 2.7.8 TextSecure .