XSS-GUARD : Precise Dynamic Prevention of Cross Site Scripting (XSS) Attacks Prithvi Bisht (http://cs.uic.edu/~pbisht) Joint work with : V.N. Venkatakrishnan.

Slides:



Advertisements
Similar presentations
Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems © 2002, Predictive Systems.
Advertisements

Nick Feamster CS 6262 Spring 2009
Ben Livshits and Úlfar Erlingsson Microsoft Research.
Appeared in 30 th IEEE Symposium on Security and Privacy, May Authors: Mike Ter Louw and V.N. Venkatakrishnan Dept. of Computer Science: University.
Path Cutter: Severing the Self-Propagation Path of XSS JavaScript Worms in Social Web Networks Yinzhi Cao, Vinod Yegneswaran, Phillip Porras, and Yan Chen.
PathCutter: Severing the Self- Propagation Path of XSS JavaScript Worms in Social Web Networks Yinzhi Cao §, Vinod Yegneswaran †, Phillip Porras †, and.
Using Replicated Execution for a More Secure and Reliable Browser Authors: Hui Xue, Nathan Dautenhahn, Samuel T. King University of Illinois at Urbana.
©2009 Justin C. Klein Keane PHP Code Auditing Session 5 XSS & XSRF Justin C. Klein Keane
An Evaluation of the Google Chrome Extension Security Architecture
By Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, and Giovanni Vigna Network and Distributed System Security(NDSS ‘07)
JShield: Towards Real-time and Vulnerability-based Detection of Polluted Drive-by Download Attacks Yinzhi Cao*, Xiang Pan**, Yan Chen** and Jianwei Zhuge***
Ben Livshits and Weidong Cui Microsoft Research Redmond, WA.
Web 2.0 security Kushal Karanjkar Under guidance of Prof. Richard Sinn.
Blackbox Reversing of XSS Filters Alexander Sotirov ekoparty 2008.
S CRIPT G ARD Automatic Context-Sensitive Sanitization for Large-Scale Legacy Web Applications Prateek Saxena UC Berkeley David Molnar Microsoft Research.
1 Document Structure Integrity: A Robust Basis for Cross-Site Scripting Defense Prateek Saxena UC Berkeley Yacin Nadji Illinois Institute Of Technology.
Leveraging User Interactions for In-Depth Testing of Web Applications Sean McAllister, Engin Kirda, and Christopher Kruegel RAID ’08 1 Seoyeon Kang November.
1 RAKSHA: A FLEXIBLE ARCHITECTURE FOR SOFTWARE SECURITY Computer Systems Laboratory Stanford University Hari Kannan, Michael Dalton, Christos Kozyrakis.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Leveraging User Interactions for In-Depth Testing of Web Application Sean McAllister Secure System Lab, Technical University Vienna, Austria Engin Kirda.
Handling Security Threats in Kentico CMS Karol Jarkovsky Sr. Solution Architect Kentico Software
Chapter 6: Hostile Code Guide to Computer Network Security.
Automatic Creation of SQL Injection and Cross-Site Scripting Attacks 2nd-order XSS attacks 1st-order XSS attacks SQLI attacks Adam Kiezun, Philip J. Guo,
JShield: Towards Real-time and Vulnerability-based Detection of Polluted Drive-by Download Attacks Yinzhi Cao*, Xiang Pan**, Yan Chen** and Jianwei Zhuge***
Vulnerability-Specific Execution Filtering (VSEF) for Exploit Prevention on Commodity Software Authors: James Newsome, James Newsome, David Brumley, David.
Cross-Site Scripting Vulnerabilities Adam Doupé 11/24/2014.
Prithvi Bisht, Timothy Hinrichs, Nazari Skrupsky, Radoslaw Bobrowicz, V.N. Venkatakrishnan University of Illinois at Chicago, USA ACM CCS (Oct,2010) Prithvi.
+ Websites Vulnerabilities. + Content Expand of The Internet Use of the Internet Examples Importance of the Internet How to find Security Vulnerabilities.
NDSS 2007 Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, Giovanni Vigna.
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
Automatically Hardening Web Applications Using Precise Tainting Anh Nguyen-Tuong Salvatore Guarnieri Doug Greene Jeff Shirley David Evans University of.
BLUEPRINT: Robust Prevention of Cross-site Scripting Attacks for Existing Browsers Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago.
Business Computing 550 Lesson 6. 2 Security Threats on Web Sites Issues and vulnerabilities 1.Illegal Access and Use (Hacking the system or users exposing.
AMNESIA: Analysis and Monitoring for NEutralizing SQL- Injection Attacks Published by Wiliam Halfond and Alessandro Orso Presented by El Shibani Omar CS691.
1 Detecting and filtering XSS using Positive Security Logic Ofer Rotberg David Movshovitz.
Preventing Web Application Injections with Complementary Character Coding Raymond Mui Phyllis Frankl Polytechnic Institute of NYU Presented at ESORICS.
nd Joint Workshop between Security Research Labs in JAPAN and KOREA Profile-based Web Application Security System Kyungtae Kim High Performance.
CANDID : Preventing SQL Injection Attacks Using Dynamic Candidate Evaluations V. N. Venkatakrishnan Assistant Professor, Computer Science University of.
Detecting Targeted Attacks Using Shadow Honeypots Authors: K.G. Anagnostakis, S. Sidiroglou, P. Akritidis, K. Xinidis, E. Markatos, A.D. Keromytis Published:
nd Joint Workshop between Security Research Labs in JAPAN and KOREA Marking Scheme for Semantic- aware Web Application Security HPC.
Cross Site Scripting and its Issues By Odion Oisamoje.
By Davide Balzarotti Marco Cova Viktoria V. FelmetsgerGiovanni Vigna Presented by: Mostafa Saad.
University of Central Florida The Postman Always Rings Twice: Attacking & Defending postMessage in HTML5 Websites Ankur Verma University of Central Florida,
Presented By: Chandra Kollipara. Cross-Site Scripting: Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Trevor Jim Nikhil Swamy Michael Hicks Defeating Script Injection Attacks with Browser-Enforced Embedded Policies Jason FroehlichSeptember 24, 2008.
Module: Software Engineering of Web Applications Chapter 3 (Cont.): user-input-validation testing of web applications 1.
WebWatcher A Lightweight Tool for Analyzing Web Server Logs Hervé DEBAR IBM Zurich Research Laboratory Global Security Analysis Laboratory
EECS 354: Network Security Group Members: Patrick Wong Eric Chan Shira Schneidman Web Attacks Project: Detecting XSS and SQL Injection Vulnerabilities.
Speaker: Hom-Jay Hom Date:2009/10/20 Botnet Research Survey Zhaosheng Zhu. et al July 28-August
Saner: Composing Static and Dynamic Analysis to Validate Sanitization in Web Applications Davide Balzarotti, Marco Cova, Vika Felmetsger, Nenad Jovanovic,
WebShield: Enabling Various Web User Defense Techniques without Client Side Modifications Yan Chen Lab for Internet and Security Technology (LIST) Northwestern.
By Collin Donaldson. Hacking is only legal under the following circumstances: 1.You hack (penetration test) a device/network you own. 2.You gain explicit,
Introduction SQL Injection is a very old security attack. It first came into existence in the early 1990's ex: ”Hackers” movie hero does SQL Injection.
COMP9321 Web Application Engineering Semester 2, 2017
Javascript worms By Benjamin Mossé SecPro
Module: Software Engineering of Web Applications
An Introduction to Web Application Security
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
World Wide Web policy.
BrowserShield: Vulnerability-Driven Filtering of Dynamic HTML
Automatic and Precise Client-Side Protection against CSRF Attacks
University of Illinois at Chicago
Detecting Targeted Attacks Using Shadow Honeypots
University of Illinois at Chicago
University of Illinois at Chicago
Protecting Against Common Web Application Vulnerabilities
Exploring DOM-Based Cross Site Attacks
Cross-Site Scripting Attack (XSS)
Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago
Presentation transcript:

XSS-GUARD : Precise Dynamic Prevention of Cross Site Scripting (XSS) Attacks Prithvi Bisht ( Joint work with : V.N. Venkatakrishnan Systems and Internet Security Laboratory Department of Computer Science University of Illinois, Chicago USA

XSS attacks : number one threat …and the trend continues...  Second half of 2007 : 80% of all attacks were XSS  January 2007 : 70% web applications are vulnerable [source : Simple attacks lucrative targets  alert(‘xss’); CVE Vulnerabilities 2004CVE Vulnerabilities 2006

Attacker controlled code can steal sensitive information or perform malicious operations. A typical XSS attack Claim prize Vulnerable bank web application Client browser name=[evilCode]... [evilCode]... Response page... evilCode executed!...

Objective Automated prevention of XSS attacks : server side Robust against subtle attacks Efficient Automated Transformation Vulnerable web application Safe web application

Outline of this talk Introduction Web application transformation technique Robust script identification at server side XSS-GUARD  Examples  Evaluation results Related work and summary

HTML page : A web application’s view Page generated by output statements in a control path. Web application’s view : intended regions & others  Other regions could lead to unintended script code. Web application User Input name= xyz write( “hi” ) write( name ) write( [code] ) hi xyz [ code ] HTML page Output statements not influenced by user inputs produce programmer intended script code/data Others may produce unintended script code

HTML page : A browser’s view Browser does not differentiate between injected and programmer intended scripts. Browser’s view : a collection of script code & data. write( “hi” ) write( name ) write( [code] ) hi [evilCode] [code] name= [evilCode] Browser data code Web application HTML page

A complete view An effective defense would require both these views! hi [evilCode] [code] HTML page Web application Browser data code intended other intended Web application view Knows intentions Browser view Knows scripts

Idea If a web application knows intended scripts and all the scripts (including injected) for a generated HTML page, it can remove unintended scripts. Question : How to compute intended scripts?

write( [code] )write( realPage, [code] ) write( name ) write( realPage, name ) write( “hi” )write( realPage, “hi” ) Replicate output statements uninfluenced by user inputs to create shadow page. Other output statements replicated but act on benign inputs (as intended). Computing intended code Web application name= xyz Real HTML page name_c = aaa write( shadowPage, name_c ) Shadow HTML page hi xyz [code] hi aaa [code] data code data code write( shadowPage, “hi” ) write( shadowPage, [code] )

Computing intended code…cont. Real page contains injected script, but shadow retains only intended script. For a real page, its shadow page has intended scripts. Web application name = [xssCode] Real HTML page name_c = aaaaaaaa Shadow HTML page hi [xssCode] [code] hi aaaaaaa [code] data code data code write( realPage, “hi” ) write( shadowPage, name_c ) write( realPage, name ) write( realPage, [code] ) write( shadowPage, “hi” ) write( shadowPage, [code] )

Shadow page captures intended code Real HTML page = output statements with user inputs Shadow HTML page = mirror above output statements with benign user inputs Transform web application to create shadow (intended) page for each real page  Define “benign input” for each “real input”.  Mirror the “actual input” processing on “benign input”.  Replicate output statements with above processed inputs. For details on transformation, please refer to  CANDID: Preventing SQL Injection Attacks using Dynamic Candidate Evaluations, S. Bandhakavi, P. Bisht, P. Madhusudan, V.N. Venkatakrishnan, ACM CCS 2007, submitted to ACM TISSEC 2008

Idea Revisited If a web application knows intended scripts and all scripts (including injected) for a generated HTML page, it can remove unintended scripts. Question : How to compute intended scripts? - By computing shadow pages. Question : How can application identify all scripts? What about filters?

Filters effective first layer...but lack context Ineffective against subtle cases  MySpace Samy worm used eval(‘inner’ + ‘HTML’) to evade “innerHTML” filter. Large attack surface  tags and URI schemes, attributes, event handlers, alternate encoding... Filters analyze inputs without their context of use. Alternate scheme: find scripts in output (HTML page)  Inputs embedded in context of use in HTML page write( “<scri”) write(“pt>”) <scri pt> filter OK Not OK HTML page

How Firefox identifies scripts? Lexical analysis component identifies tokens. HTML tag based processing identifies scripts in:  External resource download e.g.,  Inlined scripts/event handlers e.g.,  URI schemes that can have scripts e.g., javascript/data hi xyz [code] HTML page Browser Lexical Analysis HTML Tag based processing Code identification scheme Code Execution Module

Leveraging browser’s code identification mechanism A browser performs precise identification of scripts. Robust  alternate encodings  large attack surface Our approach leverages this at the server side.  Modifications record all scripts in real HTML page. hi xyz [code] Real HTML page contains all scripts Modified Lexical Analysis Modified HTML Tag based processing identifies all scripts

[code] XSS-GUARD : End – to - End Safe web application Transformed web application HTTP request... aaaaaa [code]... [code] real page shadow page real page shadow page ≈ ≈ Removal of injected code... aaaaaa [code]... [code]... [code] Verified real page

XSS-GUARD : intended scripts All intended scripts in real page have equivalent scripts in shadow page. Web application name = xyz hi xyz [code] Real page hi [code] name_c = aaa aaa code Shadow page ≈ write( shadowPage, name_c ) write( realPage, “hi” ) write( realPage, name ) write( realPage, [code] ) write( shadowPage, “hi” ) write( shadowPage, [code] )

XSS-GUARD : Attack prevention Injected script in real page does not have equivalent script in shadow page, and is removed. Web application name =... name_c = aaaaaaaaaaaaaaaaa hi [code] hi [code] aaaaaaaaaaaaaaaa code Shadow page data ≈ Real page write( shadowPage, name_c ) write( realPage, “hi” ) write( realPage, name ) write( realPage, [code] ) write( shadowPage, “hi” ) write( shadowPage, [code] )

XSS-GUARD : Subtle attack case Any unintended addition to existing scripts is successfully prevented. web application name = aa;evil(…); name_c = aaaaaaaaaa x = aa; evil(...); Real page Shadow page code ≈ x = aaaaaaaa write( shadowPage, name_c ) write( realPage, “ x = ” ) write( realPage, name ) write( realPage, “ ” ) write( shadowPage, “ x=” ) write( shadowPage, “ ” )

Effectiveness Evaluation Against real world exploits Defended 32 applicable exploits out of 92 : R. Hansen XSS cheatsheet. False negatives : non-Firefox attacks, Type 0 attacks  Current implementation can be extended  initial experiments : Defended 35 / 56 non-Firefox attacks CVE /5121JSPWikidefended CVE Tomcat HTML Managerdefended CVE Tomcat Host Managerdefended CVE /3384/2449 CVE Tomcat Example Web Applications defended

Performance Evaluation Performance overhead (response time) Parse tree comparison is rarely done : in presence of attacks, or scripts embedding user inputs. These numbers indicate worst case performance –  Negligible network latency in experiments (LAN setup)  Can be further improved by limiting the transformation to only relevant statements. Exploits from CVE5 – 24 % Varied response sizes (1KB – 75KB) 3 – 14 % Parse tree comparison of scripts (1 – 5) 37 – 42 %

Some Related Work Vulnerability analysis: find vulnerable source-sink pairs e.g., saner: Livshits et al. Usenix 2005, Pixy N. Jovanovic et al. S&P2006, Y. Xie et al. Usenix 2006, D. Balzarotti et al. CCS Useful but limited to detection Server side solutions: filter based or track taint & disallow at sink : W. Xu et al. Usenix 2006, … Centralized defense but do not know all scripts Client side solutions: Firewall like mechanisms to prevent malicious actions at client Noxes E. Kirda, et al. SAC 2006, P. Vogt et al. NDSS 2007 User controlled protection but do not know intended scripts Client-Server collaborative solutions: Clients enforce application specified policies BEEP T. Jim, et al. WWW 2007, Tahoma R. Cox et al. S&P 2006, Browsershield C. Reis et al. OSDI 2006 Can determine intended and all scripts but deployment issues

Contributions and future work A robust server side solution to prevent XSS attacks. A mechanism to compute programmer intended code, useful in defending other code injection attacks. Leveraged browser’s mechanisms at server side. Thanks for your attention! Questions?