330 likes | 452 Vues
This paper discusses mutation-based Cross-Site Scripting (mXSS) attacks, a sophisticated method targeting well-secured web applications. It covers various XSS types—reflected, stored, DOM-based—and demonstrates how attackers exploit innerHTML mutations to bypass security measures. The authors present mitigation techniques for server and client-side vulnerabilities, analyze attack surfaces of popular web applications, and evaluate the effectiveness of existing defenses. The study highlights the complexities of HTML handling and emphasizes the importance of robust sanitization methods to prevent mXSS attacks.
E N D
mXSS Attacks: Attacking well-secured Web-Applicationsby using innerHTML Mutations Mario Heiderich, JörgSchwenk, TilmanFrosch, Jonas Magazinius, and Edward Z. Yang. ACM CCS (November, 2013)
OUTLINE • XSS • mXSS • Exploits and Attack Surface • Mitigation Techniques • Evaluation • Related Work and Conclusion
OUTLINE • XSS • mXSS • Exploits and Attack Surface • Mitigation Techniques • Evaluation • Related Work and Conclusion
Cross-Site Scripting (XSS) • Reflected XSS • Maliciously manipulated parameters • Stored XSS • User contributed content stored on the server • DOM XSS(XSS of the third kind) • JavaScript library http://www.collinjackson.com/research/xssauditor.pdf
Solutions for XSS • Server-side solutions • Encoding, replacement, rewriting. • Client-side solutions • IE8 XSS Filter • Chrome XSS Auditor • Firefox NoScript extension
OUTLINE • XSS • mXSS • Exploits and Attack Surface • Mitigation Techniques • Evaluation • Related Work and Conclusion
mXSS • Mutation-based Cross-Site-Scripting https://cure53.de/fp170.pdf
mXSS - At the time of testing • Impact on IE, Firefox, Chrome • Webmail Clients • Bypass HTML Sanitizers • HTML Purifier • htmLawed • OWASP AntiSamy • jSoup • kses • Led to subsequent changes in browser behavior.
innerHTML / outerHTML • An HTML element's property • Creating HTML content from arbitrarily formatted strings • Serializing HTML DOM nodes into strings http://www.jb51.net/article/16585.htm
Mutation • Trigger the mutation
Browser Model http://www.cs.berkeley.edu/~dawnsong/papers/2011%20systematic%20analysis%20xss
innerHTML-Access • Access to the innerHTMLproperties • from (parent) element nodes • HTML editor • contenteditable attribute • document.execCommand() • Print preview
OUTLINE • XSS • mXSS • Exploits and Attack Surface • Mitigation Techniques • Evaluation • Related Work and Conclusion
Exploits • innerHTML-access • Backtick {` } • XML Namespace(xmlns) • CSS Escapes/Misfit Characters
Exploits – Backtick and XMLNS • Backtick {` } • XML Namespace
Exploits – CSS • CSS specifications propose CSS escapes • v\61lue = value • Mutation • 'val\27ue‘ => ‘val’ue’
Exploits – CSS Recursive Decoding • Bypass some of HTML filters with recursive decoding
Exploits – CSS Escapes in Property Names • Terminate the style attribute
Exploits – Entity-Mutation in non-HTML Documents • MIME type • text/xhtml • Attacker may abuse MIME sniffing
Exploits – Entity-Mutation in non-HTML context of HTML documents • SVG tag, fixed
Attack Surface • A mutation event occur when • 74.5% of the Alexa Top 1000 websites to be using inner-HTML-assignments.
Attack Surface • JavaScript libraries • 65% of the top 10,000 websites • 48.87% using jQuery • Webmails • Microsoft Hotmail, Yahoo! Mail, Redi Mail, OpenExchange, Round-cube, etc.. • Bug reports were acknowledged • HTML sanitizers • Add new rules for known mutation effects
OUTLINE • XSS • mXSS • Exploits and Attack Surface • Mitigation Techniques • Evaluation • Related Work and Conclusion
Mitigation Techniques(Server-side) • HTML • Appending a trailing whitespace to text ? • CSS • Disallow any of the special characters • Percent-escaping for parentheses and single quotes in URLs • Implemented to HTML Purifier(CSS)
Mitigation Techniques(Client-side) • TrueHTML • A script • Overwrites the getter methods of the innerHTML • XMLSerializer DOM object • Changes the HTML handling into an XML-based processing • Low performance impact compared to filtering innerHTML-data
OUTLINE • XSS • mXSS • Exploits and Attack Surface • Mitigation Techniques • Evaluation • Related Work and Conclusion
Evaluation - Size • http archive • Average transfer size of a web page • 1,200kb(52kb by HTML, 214kb by JavaScript) • TrueHTML • 820 byte of code
Evaluation - Time • VM1 • Intel Xeon X5650 CPU 2.67GHz, 2GB RAM • Ubuntu 12.04 Desktop, Mozilla Firefox 14.0.1 • VM2 • Inter Core2Duo CPU 1.86GHz, 2GB RAM • Ubuntu 12.04 Desktop, Mozilla Firefox 16.0.2 • Proxy Server to inject TrueHTML • Navigation Timing API
Evaluation - Time • Network Testing Top 10,000 • Overhead 0.01%~99.94% • Local Testing 1
Evaluation - Time • Local Testing 2 • <p>…(1kb)…</p> • Scale to 1,000 elements
OUTLINE • XSS • mXSS • Exploits and Attack Surface • Mitigation Techniques • Evaluation • Related Work and Conclusion
Related Work • Abusing Internet Explorer 8's XSS Filters • Browser Security Handbook • The Tangled Web: A Guide to Securing Modern Web Applications (book) • XSSAuditor bypasses from sla.ckers.org. • Towards Elimination of XSS Attacks with a Trusted and Capability Controlled DOM (PhD thesis, Ruhr-University Bochum, 2012)
Conclusion • Problematic and mostly undocumented browser behavior • “Well-formed HTML is unambiguous” is false • Defensive tools and libraries must gain awareness of the additional processing layers that browsers possess.