Document Structure Integrity: A Robust Basis for Cross-Site Scripting Defense



Similar documents
Document Structure Integrity: A Robust Basis for Cross-site Scripting Defense

XSS-GUARD : Precise Dynamic Prevention of Cross Site Scripting (XSS) Attacks

Cross Site Scripting Prevention

A Tale of the Weaknesses of Current Client-side XSS Filtering

Protection, Usability and Improvements in Reflected XSS Filters

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

XSS-GUARD: Precise Dynamic Prevention of Cross-Site Scripting Attacks

Cross Site Scripting (XSS) and PHP Security. Anthony Ferrara NYPHP and OWASP Security Series June 30, 2011

Cross-Site Scripting

A Tale of the Weaknesses of Current Client-Side XSS Filtering

Acunetix Website Audit. 5 November, Developer Report. Generated by Acunetix WVS Reporter (v8.0 Build )

Web-Application Security

What about MongoDB? can req.body.input 0; var date = new Date(); do {curdate = new Date();} while(curdate-date<10000)

Defeating Script Injection Attacks with Browser-Enforced Embedded Policies

Attacks on Clients: Dynamic Content & XSS

Blackbox Reversing of XSS Filters

Towards Client-side HTML Security Policies

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

25 Million Flows Later - Large-scale Detection of DOM-based XSS

Robust Defence against XSS through Context Free Grammar

Finding Your Way in Testing Jungle. A Learning Approach to Web Security Testing.

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

Security Model for the Client-Side Web Application Environments

Stopping SQL Injection and. Manoranjan (Mano) Paul. Track: Operating Systems Security - Are we there yet?

Alhambra: A System for Creating, Enforcing, and Testing Browser Security Policies

Advanced XSS. Nicolas Golubovic

Finding XSS in Real World

HOD of Dept. of CSE & IT. Asst. Prof., Dept. Of CSE AIET, Lko, India. AIET, Lko, India

Web Application Guidelines

Towards Automated Malicious Code Detection and Removal on the Web

Check list for web developers

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

Client vs. Server Implementations of Mitigating XSS Security Threats on Web Applications

Project 2: Web Security Pitfalls

Universal XSS via IE8s XSS Filters

End-to-end Web Application Security

Cross Site Scripting (XSS) Exploits & Defenses. OWASP Denver, Colorado USA. The OWASP Foundation. David Campbell Eric Duprey.

Sidste chance for Early Bird! Tilmeld dig før d. 30. juni og spar DKK. Læs mere og tilmeld dig på

Hunting Cross-Site Scripting Attacks in the Network

Uploaded images filter evasion for carrying out XSS attacks

Noncespaces: Using Randomization to Enforce Information Flow Tracking and Thwart Cross-Site Scripting Attacks

Recommended Practice Case Study: Cross-Site Scripting. February 2007

HTTPParameter Pollution. ChrysostomosDaniel

Reliable Mitigation of DOM-based XSS

Exploitation of Cross-Site Scripting (XSS) Vulnerability on Real World Web Applications and its Defense

Network Security Web Security

An Empirical Analysis of XSS Sanitization in Web Application Frameworks

AMIT KLEIN, FORMER DIRECTOR OF SECURITY AND RESEARCH, SANCTUM

What is Web Security? Motivation

Chapter 1 Web Application (In)security 1

A Study on Dynamic Detection of Web Application Vulnerabilities

Chapter 4: Networking and the Internet

Web Application Security

An Efficient Black-box Technique for Defeating Web Application Attacks

Complete Cross-site Scripting Walkthrough

Defending against XSS,CSRF, and Clickjacking David Bishop

Detection of DOM-based Cross-Site Scripting by Analyzing Dynamically Extracted Scripts

(WAPT) Web Application Penetration Testing

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

Security Research Advisory IBM inotes 9 Active Content Filtering Bypass

CS 558 Internet Systems and Technologies

Relax Everybody: HTML5 Is Securer Than You Think

Secure Coding. External App Integrations. Tim Bach Product Security Engineer salesforce.com. Astha Singhal Product Security Engineer salesforce.

Introduction to Computer Security

Cross Site Scripting in Joomla Acajoom Component

Securing Server/Client side Applications against XSS attack via XSS-Obliterator

Analysis of Browser Defenses against XSS Attack Vectors

Precise client-side protection against DOM-based Cross-Site Scripting

Short notes on webpage programming languages

External Network & Web Application Assessment. For The XXX Group LLC October 2012

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

Sichere Webanwendungen mit Java

A Multi agent Scanner to Detect Stored XSS Vulnerabilities

Analysis and Enforcement of Web Application Security Policies

Countering Cross-Site Scripting in Web-based Applications

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

A Survey on Threats and Vulnerabilities of Web Services

Web and Security 1 / 40

Institutionen för datavetenskap

L-WMxD: Lexical based Webmail XSS Discoverer

AJAX and JSON Lessons Learned. Jim Riecken, Senior Software Engineer, Blackboard Inc.

SQL INJECTION IN MYSQL

Webapps Vulnerability Report

WEB ATTACKS AND COUNTERMEASURES

Intrusion detection for web applications

Protecting cookies against Cross-site scripting attacks using cryptography

Toward A Taxonomy of Techniques to Detect Cross-site Scripting and SQL Injection Vulnerabilities

A Pragmatic, Policy- Driven Framework for Protection Against Cross-Site Scripting

Preparing for the Cross Site Request Forgery Defense

XSS PROTECTION CHEATSHEET FOR DEVELOPERS V1.0. Author of OWASP Xenotix XSS Exploit Framework opensecurity.in

PathCutter: Severing the Self-Propagation Path of XSS JavaScript Worms in Social Web Networks

CROSS-SITE SCRIPTING BROWSERS PROTECTION ANALYSIS

Client-Side Cross-Site Scripting Protection

Instructions for Embedding a Kudos Display within Your Website

Revisiting XSS Sanitization

Ruby on Rails Secure Coding Recommendations

Study of Cross-Site Scripting Attacks and Their Countermeasures

Advanced Security for Systems Engineering VO 01: Web Application Security

A Survey on Web Application Security

A tale of the weaknesses of current client-side XSS filtering

Transcription:

Document Structure Integrity: A Robust Basis for Cross-Site Scripting Defense Yacin Nadji Illinois Institute Of Technology Prateek Saxena UC Berkeley Dawn Song UC Berkeley 1

A Cross-Site Scripting Attack Hi Joe, <img src= > <script src= > Cookies, Password Policy: ALLOW {a, a@href, img, img@src } Hi Joe, <img src= > <script src= > 2

Limitations of Server-side Sanitization <IMG SRC="javascript:alert('XSS') > <IMG SRC=JaVaScRiPt:alert('XSS')> <IMG SRC=java scrip&#1 16;:aler& #116;(&#39;XSS&# 39;)> Cookies, Password Policy: ALLOW {a, a@href, img, img@src } Hi Joe, <img src= > 3

Limitations of Server-side Sanitization Over 90 ways to inject JS [RSnake07] Multiple Languages» JS, Flash, CSS, XUL, VBScript Cookies, Password Hi Joe, <img src= > 4

A Different Approach Previous defenses: XSS is a sanitization problem Our view: XSS is a document structure integrity problem IMG IMG SRC SRC javascript: String 5

Concept of Document Structure div id STATIC DOCUMENT STRUCTURE div id DYNAMIC DOCUMENT STRUCTURE Joe; online Joe; online document.write() JAVASCRIPT DOCUMENT STRUCTURE 6

Document Structure Integrity (DSI) Definition: Given a server s policy P, Restrict untrusted content to allowable syntactic elements Policy in terms of client-side languages Central idea for DSI enforcement Dynamic information flow tracking (server & browser) Policy based parser-level confinement Default policy: Only leaf nodes untrusted 7

Talk Outline Power of DSI Defense: Examples Design Goals Architecture Implementation Evaluation Conclusion & Related Work 8

Talk Outline Power of DSI Defense: Examples Design Goals Architecture Implementation Evaluation Conclusion & Related Work 9

DSI Defense: A Powerful Approach DSI enforcement prevents Not just cookie-theft» Form injection for phishing [Netcraft08]» Profile Worms [Samy05, Yammaner06]» Web site defacement through XSS DOM-Based XSS (Attacks on client-side languages) Vulnerabilities due to browser-server inconsistency 10

Example 1: DOM-Based XSS DOM-based client-side XSS [Klein05] <div id= Joe; online > <div id= Joe; online > div + id Joe; online Joe online JAVASCRIPT DYNAMIC UPDATE 11

Example 1: DOM-Based XSS DOM-based client-side XSS [Klein05] <div id= Devil; <script>..</script> > <div id= Devil; <script>..</script> > JAVASCRIPT 12

Example 1: DOM-Based XSS DOM-based client-side XSS [Klein05] <div id= Devil; <script>..</script> > <div id= Devil; <script>..</script> > Devil script JAVASCRIPT.. DYNAMIC UPDATE 13

Example 2: Inconsistency Bugs Browser-Server Inconsistency Bugs IMG ONLOAD alert (1) <img onload=alert(1)> <img onload:=alert(1)> IMG onload:=alert(1) <img onload:=alert(1)> Assumed Parse Tree 14

Talk Outline Defense in Depth: Examples Design Goals Architecture Implementation Evaluation Conclusion & Related Work 15

Design Goals Clear separation between policy and mechanism No dependence on sanitization No changes to web application code Minimize false positives Minimizes impact to backwards compatibility Robustness Address static & dynamic integrity attacks Defeat adaptive adversaries 16

Mechanisms Client-server architecture Server Step 1: Identify trust boundaries in HTML response Step 2: Serialize» Encoding data & trust boundaries in HTML Client Step 3: De-serialize» Initialize HTTP response page into static document structure Step 4: Dynamic information flow tracking» Modified semantics of client-side interpretation 17

Talk Outline Defense in Depth: Examples Design Goals Architecture Implementation Evaluation Conclusion & Related Work 18

Approach Overview: Static DSI SERIALIZER DE-SERIALIZER <img src= > <script src= > <a href = > [[<img src= > <script src= >]] <a href = > img script SERVER P BROWSER 19

Approach Overview: Dynamic DSI SERIALIZER DE-SERIALIZER TAINT TRACKING <div id= Devil; <script>..</scri pt> > <div id= [[Devil; <script>..</scrip t>]] > div id Devil;<script>.. </script> SERVER BROWSER 20

Approach Overview: Dynamic DSI (II) SERIALIZER DE-SERIALIZER TAINT TRACKING <div id= Devil; <script>..</scri pt> > <div id= [[Devil; <script>..</scrip t>]] > id Devil script.. SERVER BROWSER 21

Serialization Design: Key Challenge Safety against an adaptive adversary <CONFINE> USER BLOG </CONFINE> <CONFINE> </CONFINE> <script> </script> </CONFINE> </CONFINE> 22

Serialization: Key Challenge Do not rely on sanitization <CONFINE ID= N5 ></CONFINE> <SCRIPT> document.getelementbyid( N5 ).innerhtml = USER BLOG What to disallow? ; </SCRIPT> 23

Serialization Design: Key Challenge Attack on sanitization mechanism for JS strings <CONFINE ID= N5 ></CONFINE> <SCRIPT> document.getelementbyid( N5 ).innerhtml = </SCRIPT> <SCRIPT> Attack ; </SCRIPT> 24

Markup Randomization Markup Randomization Mechanism independent of the policy Does not depend on any sanitization R [[00101 R ]]00101 Valid Nonces: 00101,11010,01110 Policy: ALLOW {a, a@aref... } 25

Markup Randomization Markup Randomization Mechanism independent of the policy Does not depend on any sanitization [[00101 R ]]00101 Valid Nonces: 00101,11010,01110 Policy: ALLOW {a, a@aref} [[00101 R ]]00101 OK! 26

Markup Randomization Markup Randomization Mechanism independent of the policy Does not depend on any sanitization [[00101 R ]]00101 Valid Nonces: 00101,11010,01110 Policy: ALLOW {a, a@aref} [[00101 R ]]10101 27

Browser-side Taint Tracking Dynamic DSI Client Language Interpreters enhanced Ubiquitous tracking of untrusted data in the browser 28

Talk Outline Advantages of DSI in Attack Coverage Design Goals Architecture Implementation Evaluation Conclusion & Related Work 29

Implementation Full Prototype Implementation DSI-enable server Utilized existing taint tracking in PHP [IBM07] DSI-compliant browser Implemented in KDE Konqueror 3.5.9 Client side taint tracking in JS interpreter of KDE 3.5.9 30

You are 0wned! 31

In a DSI-compliant Browser <script>alert(document.cookie)</script> 32

Talk Outline Advantages of DSI in Attack Coverage Design Goals Architecture Implementation Evaluation Conclusion & Related Work 33

Evaluation: Attack Detection Stored XSS attacks Vulnerable phpbb forum application 25 public attack vectors [RSnake07] 30 benign posts Results 100% attack prevention No changes required to the application No false positives 34

Evaluation: Real-World XSS Attacks 5,328 real-world vulnerabilities [xssed.com] 500 most popular benign web sites [alexa.com] Default Policy: Coerce untrusted data to leaf nodes Results 98.4% attack prevention False Negatives:» Due to exact string matching in instrumentation False Positives: 1%» Due to instrumentation for tainting (<title> on Slashdot) 35

Evaluation: Performance Browser Overhead 1.8% Server overhead 1-3% Static page size increase 1.1% 36

Related Work Client-server Approaches» BEEP [Jim07]» <jail> [Eich07]» Hypertext Isolation [Louw08] Client-side approaches» IE 8 Beta XSS Filter [IE8Blog]» Client-side Firewalls [Kirda06]» Sensitive Info. Flow Tracking [Vogt07] Server-side approaches» Server-side taint-based defenses [Xu06, Nan07, Ngu05, Pie04]» XSS-Guard [Bisht08]» Program Analysis for XSS vulnerabilities [Balz08, Mar05, Mar08, Jov06, Hua04] 37

Conclusion DSI: A fundamental integrity property for web applications XSS as a DSI violation Multifaceted Approach Clearly separates mechanism and policy Defeats adaptive adversaries Markup randomization Evaluation on a large real-world dataset Low performance overhead No web application code changes No false positives with configurable policies 38

Questions Thank you! 39

Client-Side Proxy www.site.com?user=joe user=joe Hi [[Joe]]! Hi Joe! 40

Markup Randomization: Adaptive Attacks Multiple valid parse trees [[ N1 [[ N3 ]] N1 [[ N2 ]] N3 ]] N2 [[ N1 [[ N3 ]] N1 [[ N2 ]] N3 ]] N2 OR [[ N1 [[ N3 ]] N1 [[ N2 ]] N3 ]] N2 41

Attack Coverage (II): Inconsistency Bugs Browser-Server Inconsistency Bugs Inconsistency Bugs Browser Processing Server Processing 42