On Message-Level Security
Total Page:16
File Type:pdf, Size:1020Kb
On Message-Level Security Christian Mainka (Place of birth: Hattingen, Germany) Dissertation zur Erlangung des Grades eines Doktor-Ingenieurs der Fakultät für Elektrotechnik und Informationstechnik an der Ruhr-Universität Bochum 1st. Supervisor: Prof. Dr. Jörg Schwenk Ruhr-University Bochum 2nd. Supervisor: Prof. Dr. Joachim Posegga University of Passau Bochum, 20th December 2016 Author contact information: [email protected] This thesis was submitted to the Faculty of Electrical Engineering and Infor- mation Technology of Ruhr-University Bochum on December the 20th, 2016 and defended on March the 28th, 2017. Examination committee: Prof. Dr. Thorsten Holz Ruhr-University Bochum Committee Chair Prof. Dr. Jörg Schwenk Ruhr-University Bochum 1st. Supervisor Prof. Dr. Joachim Posegga University of Passau 2nd. Supervisor Prof. Dr. Dorothea Kolossa Ruhr-University Bochum Committee Member Prof. Dr. Markus Dürmuth Ruhr-University Bochum Committee Member Abstract The advent of message-level security raised with the upcoming popularity of multi-party application architectures, in which securing messages only during transport does not fulfill the demands. Security features are directly added to the exchanged messages so that they can be forwarded to further entities with- out losing their protection, even if an untrusted party is involved in between. This thesis analyzes message-level security in two widely-used application areas: web services and Single Sign-On (SSO). Through the described methodology, numerous security issues in various software libraries and websites were identi- fied, reported and fixed. The first part of the thesis analyzes the security of SOAP-based web services. This work found novel attack techniques with the focus on automatic detection and circumvention of existing countermeasures. With WS-Attacker, a software developed in this context, the first fully-automatic penetration test software for web service security is designed and implemented. Its application led to the discovery of numerous vulnerabilities in well-known web service frameworks, such as Apache CXF, and in the IBM DataPower Security Gateway. The issues were reported to the developers and the implementation flaws were fixed. The second part of the thesis examines the security of SSO systems. Generic attack concepts applicable to arbitrary SSO protocols are developed and then applied to the protocols (1.) OpenID, (2.) OpenID Connect, and (3.) Security Assertion Markup Language (SAML). These attack concepts are based on a newly introduced SSO Attacker Paradigm which is founded by the question whether the Identity Provider (IdP) in an SSO protocol can always be viewed as a Trusted Third Party (TTP). The research results in this thesis show that in modern SSO systems, an attacker may integrate his malicious IdP and, thus, they reveal that the answer is no. The malicious IdP can then be used for the detection of security vulnerabilities and for their exploitation. Based on the SSO Attacker Paradigm, the attack techniques are evaluated. Vulnerabilities are identified in different OpenID, OpenID Connect, and SAML implementations. The security of widespread systems, such as Software-as-a- Service Cloud Providers (SaaS-CPs), can be broken. We show how to success- fully log in to foreign accounts, read out local files stored on the server, and to efficiently execute Denial-of-Service (DoS) as well as complex Server-Side Request Forgery (SSRF) attacks. The work described in this thesis influenced the development of many web service frameworks and SSO systems. Within this context, attacks on the spe- cification of OpenID Connect are shown that allow to break the main target of the protocol – the authentication of the End-User – regardless of the underly- ing implementation. A countermeasure has been proposed in collaboration with the official OAuth and OpenID Connect workgroups of the Internet Engineering Task Force (IETF). Due to the attacks, the specifications of OAuth and OpenID Connect are currently being updated and adjusted. Kurzfassung Die vorliegende Dissertation beschäftigt sich mit dem Thema Nachrichtensicher- heit in Webservices und Single Sign-On (SSO) Systemen. Durch die in der Dis- sertation beschriebene Methodologie sind zahlreiche Sicherheitslücken in ver- schiedenen Softwarebibliotheken und Webseiten identifiziert, gemeldet und be- hoben worden. Im ersten Teil der Dissertation wird die Sicherheit von SOAP-basierten Web- services untersucht. Es werden neuartige Angriffstechniken mit dem Fokus auf automatischer Erkennung und Umgehung von existierenden Gegenmaßnahmen vorgestellt. Mithilfe der in diesem Rahmen entwickelten Software WS-Attacker ist es möglich, vollautomatische Penetrationstests durchzuführen. Dadurch kon- nten zahlreiche Schwachstellen in bekannten Webservice-Frameworks wie Apache CXF, sowie im IBM DataPower Security Gateway festgestellt werden. Diese sind den Herstellern gemeldet und durch die Mithilfe des Autors behoben wor- den. Im zweiten Teil der Dissertation wird die Sicherheit von SSO Systemen un- tersucht. Es werden generische Angriffskonzepte entwickelt, die anschließend auf die Protokolle (1.) OpenID, (2.) OpenID Connect und (3.) SAML angewen- det werden. Diese Konzepte beruhen auf einem neuen Angriffsparadigma, das durch die Dissertation eingeführt wird. Das Paradigma basiert auf der Frage, ob der Identity Provider (IdP) in einem SSO Protokoll stets als vertrauenswürdige dritte Partei angesehen werden kann. Die Dissertation zeigt, dass diese Frage verneint werden muss, da in modernen SSO Protokollen ein Angreifer seinen eigenen, bösartigen IdP verwenden kann. Dieser kann für das Auffinden von Schwachstellen (Vulnerability Detection) und für dessen Ausnutzung (Vulnera- bility Exploitation) verwendet werden. Auf Basis des Paradigmas werden die entwickelten Angriffstechniken evaluiert. Dabei werden Schwachstellen in verschiedenen OpenID, OpenID Connect und SAML Implementierungen identifiziert. Die Sicherheit von weit verbreiteten Systemen, wie Software-as-a-Service Cloud Anbietern, konnte gebrochen wer- den. Es wird gezeigt, wie die Anmeldung in fremden Accounts, das Auslesen von lokalen auf dem Server gespeicherten Dateien, effiziente Denial-of-Service sowie komplexe Server-Side-Request-Forgery Angriffe erfolgreich durchgeführt werden konnten. Im Rahmen der Dissertation werden darüber hinaus Angriffe auf die Spe- zifikation von OpenID Connect gezeigt. Diese ermöglichen es, das Hauptziel des Protokolls – die Authentifizierung des Endbenutzers – unabhängig von der genutzten Implementierung zu brechen. Gemeinsam mit den offiziellen OAuth- und OpenID Connect-Arbeitsgruppen der Internet Engineering Task Force (IETF) ist eine Gegenmaßnahme entwickelt worden. Auf Grund der Angriffe werden die Spezifikationen von OAuth und OpenID Connect zurzeit erneuert und angepasst. Acknowledgements This work is the result of a four-year journey of intensive research. Without the support of many people, it would not have been possible. First, I want to thank my supervisor Jörg Schwenk. He gave me all the freedom, support, and excellent advises to improve and refine my investigations. Working for him was a real pleasure. I would like to thank all my colleagues at the Chair for Network and Datase- curity (NDS). Especially, I want to thank Juraj Somorovsky for introducing me into the world of XML Security and web services, and for all the nice places in the world that I could visit with him. A very special thanks to Vladislav Mladenov, who showed me the amazing world of SSO attacks. Without him, it would have been impossible to break all the protocols. I further want to thank Marcus Niemietz, for all the fruitful discussions and introducing me to XSS and web security; Dennis Felsch for maintaining the incredible cloud infrastructure and for all the coffee; Florian Feldmann for all the late-night office discussions (when all the other people have left) and for whisky; Furthermore, I want to thank all my research co-authors and my students for making it possible to write all these awesome research papers. Last but not least, I want to thank my parents, my brother, and my girlfriend Janine. Without their continuous support in every situation, this work would have been impossible. Contents 1 Introduction 1 1.1 Topics and Contributions . 2 1.2 Publications . 4 1.2.1 Publications Contributing to Chapter 2 . 4 1.2.2 Publications Contributing to Chapter 3 . 6 1.2.3 Other Publications . 7 2 Web Services Security 9 2.1 XML and DTD Parsing Security . 10 2.1.1 XML Foundations . 10 2.1.2 Denial-of-Service . 13 2.1.3 File System Access . 16 2.1.4 Server-Side Request Forgery . 18 2.1.5 Additional Attack Techniques . 18 2.2 Web Service Foundations . 18 2.2.1 Processing a Web Service Request on Server Side . 19 2.2.2 XML Security . 20 2.2.3 Web Services Security . 20 2.3 WS-Attacker – Penetration Testing Tool for Web Services Security 22 2.3.1 Web Services Attacks . 23 2.3.2 Concept for a Web Services Penetration Testing Tool . 27 2.3.3 WS-Attacker – Implementation Details . 29 2.3.4 Evaluation . 35 2.3.5 Summary . 37 2.4 Denial-of-Service Penetration Testing on Web Services . 37 2.4.1 XML-based Denial-of-Service Attacks . 38 2.4.2 Automatic Testing of Denial-of-Service Attacks for Web Services . 39 2.4.3 Evaluation . 45 2.4.4 Summary . 47 2.5 Adaptive and Intelligent Fully-Automatic Detection of Denial-of- Service . 47 2.5.1 Denial-of-Service Complexity . 48 2.5.2 Design . 50 2.5.3 Implementation . 51 2.5.4 Practical Evaluation . 54 2.5.5 Summary . 57 2.6 How to Break XML Encryption – Automatically . 57 2.6.1 Attacks on XML Encryption . 59 2.6.2 Automatic XML Encryption Attack . 63 2.6.3 Practical Evaluation . 67 2.6.4 Summary . 72 2.7 Related Work . 72 2.8 Conclusions . 74 vii Contents 3 Single Sign-On Security 75 3.1 Conceptual Overview on Single Sign-On Protocols . 77 3.1.1 Protocol Phases . 77 3.1.2 SSO Token . 78 3.2 Single Sign-On Protocol Classification . 79 3.2.1 OAuth-Family Protocols . 80 3.2.2 Other SSO Protocols . 82 3.2.3 Summary . 83 3.3 How to Analyze SSO? . 84 3.4 Using Malicious IdPs for Analyzing SSO .