Client-Side Cross-Site Scripting : Exploitation, Detection, Mitigation, and Prevention
Cross-Site Scripting (XSS) is a code injection vulnerability commonly found in web applications. In fact, XSS is the most prevalent web vulnerability and a constant problem of the Web platform since its birth in the 1990s. Despite more than two decades of research and thousands of publications on the topic, XSS is still an omnipresent and unsolved issue today.
In the year 2000, when Cross-Site Scripting was formally described for the first time [25], it was believed to be a server-side problem, which consisted of two variants - reflected and persistent XSS. However, since then, XSS evolved towards the client-side. In 2005 Amit Klein discovered the client-side variant DOM-based XSS or how he named it - the XSS of the third kind. Until today, most researchers distinguish three different kinds of XSS. Over the course of the years, XSS has shifted more and more towards the client-side. In fact, all newly discovered XSS variants in recent years are client-side variants such as Universal XSS, Plugin-based XSS, Persistent DOM-based XSS, Same- Origin Method Execution, Mutation-based XSS, Expression-based XSS, Content-Sniffing XSS, Gadget-based XSS, etc. This development is fueled by the evolution of the browser and hints at the fact that XSS is deeply rooted in the Web platform. Many existing research papers, however, aim at solving XSS on the application level.
In this thesis, we show that XSS is a fundamental problem of the Web platform that should be addressed at the platform level. XSS vulnerabilities are omnipresent in modern applications, because they are rooted in the underlying protocols and APIs. String-to-code conversions are causing these injection vulnerabilities. At the same time these string-to-code conversions are baked into the HTTP protocol and the main browser APIs. The current environment makes it hard for developers to create web applications free of Cross-Site Scripting vulnerabilities. The problem of XSS has not been solved, because these root causes have never been addressed in the last 20 years. To solve the XSS problem, the core of the Web platform needs to be changed.
In this thesis, we propose changes to the Web platform to solve client-side XSS. We do so in four parts:
First, the thesis provides an in-depth introduction to Cross-Site Scripting. It explores this vulnerability class’s ongoing evolution, summarizes the various vulnerability types and attacks, and finally analyzes mitigation and prevention techniques.
Second, the thesis explores client-side XSS on the Web. To do so, we study the real- world prevalence and nature of both persistent and reflected client-side XSS variants via two empirical studies. In the first one, we show that the introduction of persistent browser APIs enables persistent vulnerability variants that are wide-spread in practice. Additionally, we investigate reflected client-side XSS. To do so, we present a taint- tracking-based toolchain capable of detecting client-side XSS issues with a zero false- positive rate. Based on this tool, we conducted an empirical study on the prevalence of client-side XSS within the Alexa top 5000 web pages. This study discovered more than 6000 unique client-side XSS vulnerabilities on roughly 10 % of the investigated sites. The high number of detected vulnerabilities suggest that current prevention techniques are not suitable for real-world web applications.
Third, we demonstrate that current XSS mitigation techniques are ineffective in practice. Instead of preventing vulnerabilities, mitigation techniques aim at preventing exploitation of a vulnerability. To analyze these techniques, we first present a security analysis of Chrome’s XSS auditor and demonstrate that it can be circumvented in a fully automated fashion on at least 80 % of real-world, vulnerable web applications. Furthermore, we present a novel code-reuse attack technique that is able to circumvent all existing application- and infrastructure-level XSS mitigation techniques. Via a large- scale empirical study, we demonstrate that almost all modern frameworks, libraries, and applications are prone to these attacks. Based on these results, we conclude that mitigation techniques are becoming less effective in modern, real-world web applications.
Last, we propose a new way of addressing the problem of client-side XSS: Instead of focusing on mitigation techniques and application-level defenses, we propose a new type system for JavaScript addressing the root cause on the web-platform-level. To do so we adopt Kern’s statically enforced safe types proposal [85]. However, we trans- form it’s compiler-based checks into a runtime enforcement system. Using our approach, we replace unsafe legacy APIs with typed, secure alternatives. Through our system, the browser APIs become secure-by-default and it is possible to enforce type contracts throughout complex applications. Given an XSS-safe type contract, it becomes impossible for a developer to introduce XSS vulnerabilities. Our mechanism has been adopted by Chromium-based web browsers and thus widely available on the Web. For backward compatibility, we additionally provide a polyfill library.
Cross-Site Scripting (XSS) ist eine Code Injection Verwundbarkeit, die häufig in web Anwendungen gefunden wird. XSS ist eine der am weit verbreitetsten web Verwundbarkeiten und ein konstantes Problem der web-Plattform seit ihrer Geburt in den 1990ern. Trotz mehr als zwei Jahrzehnten an Forschung und tausenden Veröffentlichungen zu diesem Thema, ist XSS bis heute immer noch allgegenwärtig und ungelöst.
Im Jahr 2000, als XSS zum ersten Mal formal beschrieben wurde[25], glaubten Forscher, dass XSS ein serverseitiges Problem sei, welches aus zwei Varianten besteht: reflektiertes und persistentes XSS. Jedoch stellte sich schnell heraus, dass XSS auch auf der client Seite existiert. Im Jahr 2005 entdeckte Amit Klein die clientseitige Variante DOM- based XSS, oder wie er sie nannte - XSS der dritten Art. Bis heute unterscheiden die meisten Forscher diese drei Arten von XSS. Im Laufe der Jahre bewegte sich das XSS Problem immer mehr hin zur client Seite. Tatsächlich sind alle neu entdeckten XSS Varianten in den vergangenen Jahren clientseitige Varianten, wie zum Beispiel Universal XSS, Plugin-based XSS, Persistent DOM-based XSS, Same-Origin Method Execution, Mutation-based XSS, Expression-based XSS, Content-Sniffing XSS, Gadget-based XSS, usw. Diese Entwicklung wird hauptsächlich durch die Weiterentwicklung des Browsers befeuert und deutet darauf hin das XSS Verwundbarkeiten ihren Ursprung in der web- Plattform haben. Viele existierende Publikationen versuchen jedoch das XSS Problem auf der Anwendungsebene zu lösen.
In dieser Arbeit zeigen wir, dass XSS ein grundlegendes Problem der web-Plattform ist und dass dieses Problem daher auf der Plattform ebene gelöst werden muss. XSS Verwundbarkeiten sind deshalb so omnipräsent in modernen Anwendungen, weil ihre Ursache in den zugrundeliegenden Protokollen und APIs verwurzelt ist. String-zu-code Konvertierungen verursachen diese Injection Verwundbarkeit. Gleichzeitig sind diese String-zu-code Konvertierungen fester Bestandteil des HTTP Protokolls als auch der meist verwendeten Browser APIs.
Das aktuelle Design der web-Plattform macht es Entwicklern schwer sichere web Anwendungen zu erstellen, die frei von XSS Verwundbarkeiten sind. Das XSS Problem wurde bisher nicht gelöst, weil die Ursachen in den letzten 20 Jahren nie adressiert wurden. Um XSS zu lösen, muss die web-Plattform grundlegend verändert werden.
In dieser Arbeit schlagen wir Änderungen zur web-Plattform vor, um clientseitiges XSS zu lösen. Wir tun dies in vier Abschnitten:
Zuerst gibt diese Arbeit eine umfangreiche Einführung zum Thema Cross-Site Script- ing. Die Arbeit beleuchtet die grundlegende Entwicklung dieser Verwundbarkeit, fasst die verschiedenen Verwundbarkeitsklassen und Angriffe zusammen, und stellt gängige Präventions- und Abwehrmassnahmen vor.
Der zweite Teil der Arbeit untersucht clientseitiges XSS im web. Hierzu präsentieren wir zwei empirische Studien zur Verbreitung von persistenten und reflektierten clientseitigen XSS Verwundbarkeiten. In der ersten Studie demonstrieren wir wie die Einführung einer persistenten Browser API zuvor unbekannte persistente XSS Varianten ermöglicht, die auch weitverbreitet in Praxis sind. Zusätzlich untersuchen wir reflektierte clientseitige XSS Verwundbarkeiten in einer empirischen Studie. Hierzu stellen wir ein taint-tracking-basiertes Werkzeug vor, das in der Lage ist clientseitige XSS Verwundbarkeiten
ohne Fehlalarme zu erkennen. Mit Hilfe dieses Werkzeugs, führen wir eine empirische Studie zur Verbreitung von XSS Verwundbarkeiten in den Alexa Top 5000 web Seiten durch. Hierbei entdeckten wir mehr als 6000 verschiedene clientseitige XSS Verwundbarkeiten auf ungefähr 10 % aller untersuchten web Seiten. Die hohe Anzahl an entdeck- ten Verwundbarkeiten legt nahe, dass aktuelle Präventionsmechanismen unpraktikable sind.
Drittens, zeigen wir, dass aktuelle Angriffsabwehrmechanismen in der Praxis ineffektiv sind. Anstatt Verwundbarkeiten zu verhindern, setzen diese Abwehrmechanismen darauf, Angriffe auf eine existierende Verwundbarkeit zu stoppen. Um diese Mechanismen zu untersuchen, präsentieren wir zuerst eine Sicherheitsanalyse zum XSS Filters des Chrome Browsers. Dabei zeigen wir, dass der Filter in 80 % der F ̈alle voll automatisch umgangen werden kann. Darüberhinaus, stellen wir eine neue code-reuse Angriffstechnik vor, die in der Lage ist alle existierenden XSS Abwehrmechanismen zu umgehen. Mittels einer empirischen Studie zeigen wir, dass fast alle modernen Frameworks, Bibliotheken und Anwendungen fu ̈r diesen Angriff anfällig sind. Basierend auf diesen Resultaten, schlussfolgern wir, dass Abwehrmassnahmen in modernen web Anwendungen weniger wirksam sind.
Daher schlagen wir eine neue Lösung fu ̈r das clientseitige XSS Problem vor. Anstelle von Abwehrmassnahmen und Lösungen auf der Applikationsebene, schlagen wir ein neues Typsystem für JavaScript vor um die Ursache des Problems in der web-Plattform zu lösen. Hierzu adaptieren wir Kerns Safe Types System [85], das auf statischer Code- Analyse basiert. Jedoch transformieren wir die statischen, Compiler-basierten Prüfungen in ein System, das die Prüfungen zur Laufzeit vornimmt. Mithilfe dieses Systems ersetzen wir unsichere APIs mit sicheren Alternativen und ermöglichen es einen type contract in einer komplexen Anwendung durchzusetzen. Mit einem sicheren type contract wird es unmöglich unabsichtlich eine XSS Verwundbarkeit in eine Anwendung einzubauen. Unser Mechanismus wurde bereits in Chromium-basierten Browsern eingebaut und ist daher fu ̈r die breite Masse verfügbar. Um mit älteren und anderen Browsern kompatibel zu sein, stellen wir darüber hinaus eine Polyfill Bibliothek zur Verfügung.
Preview
Cite
Access Statistic

Rights
Use and reproduction:
All rights reserved