Copyright © 2009 - The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

Nick Feamster CS 6262 Spring 2009
HTML Basics Customizing your site using the basics of HTML.
Cross Site Scripting (XSS)
Past, Present and Future By Eoin Keary and Jim Manico
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike.
XSLT 11-Apr-17.
Creating Stronger, Safer, Web Facing Code JPL IT Security Mary Rivera June 17, 2011.
A NTI S AMY J AVA I NTRODUCTION Wang Wenjun June 2011.
©2009 Justin C. Klein Keane PHP Code Auditing Session 5 XSS & XSRF Justin C. Klein Keane
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
WebGoat & WebScarab “What is computer security for $1000 Alex?”
Lecture 2 Page 1 CS 236, Spring 2008 Security Principles and Policies CS 236 On-Line MS Program Networks and Systems Security Peter Reiher Spring, 2008.
Blackbox Reversing of XSS Filters Alexander Sotirov ekoparty 2008.
Input Validation For Free Text Fields Project Members: Hagar Offer &Ran Mor Academic Advisor: Dr Gera Weiss Technical Advisors: Raffi Lipkin & Nadav Attias.
Good & Bad Websites. From WEB 1. Submit one bad or ugly web site or web interface. This is ugly website because there are.
The OWASP Foundation Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under.
Lecture 16 Page 1 CS 236 Online Cross-Site Scripting XSS Many sites allow users to upload information –Blogs, photo sharing, Facebook, etc. –Which gets.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike.
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Javascript and the Web Whys and Hows of Javascript.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
DIY Web Development Hand Code Your Own Page (For Free!) by Bryan Brown, Indiana University Bloomington SLIS.
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.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
BLUEPRINT: Robust Prevention of Cross-site Scripting Attacks for Existing Browsers Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago.
CSS Sprites. What are sprites? In the early days of video games, memory for graphics was very low. So to make things load quickly and make graphics look.
Unit 1 – Web Concepts Instructor: Brent Presley. ASSIGNMENT Read Chapter 1 Complete lab 1 – Installing Portable Apps.
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.
XP Dreamweaver 8.0 Tutorial 3 1 Adding Text and Formatting Text with CSS Styles.
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.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
 Two types of malware propagating through social networks, Cross Site Scripting (XSS) and Koobface worm.  How these two types of malware are propagated.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Copyright 2007, Information Builders. Slide 1 Understanding Basic HTML Amanda Regan Technical Director June, 2008.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2013.
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. 1 RubyJax Brent Morris/
Introduction To Web Application Security in PHP. Security is Big And Often Difficult PHP doesn’t make it any easier.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Web Applications Testing By Jamie Rougvie Supported by.
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 OWASP License. The OWASP.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Advanced Topics Lecture 8 Rachel A Ober
Trevor Jim Nikhil Swamy Michael Hicks Defeating Script Injection Attacks with Browser-Enforced Embedded Policies Jason FroehlichSeptember 24, 2008.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
Getting Started with HTML. HTML  Hyper Text Markup Language  HTML isn’t a program language, its known as a markup language  A Markup language has tags.
+ Publishing Your First Post USING WORDPRESS. + A CMS (content management system) is an application that allows you to publish, edit, modify, organize,
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
JQUERY AND AJAX
1 XSL Transformations (XSLT). 2 XSLT XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. XSLT uses XPath.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
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.
Introduction to.
Javascript worms By Benjamin Mossé SecPro
Google’s Gruyere1 : An XSS Example Presented by: Terry Gregory
Building Secure ColdFusion Applications
An Introduction to Web Application Security
Web Programming A different world! Three main languages/tools No Java
XML Problems and Solutions
Computer communications
Cross-Site Scripting Attack (XSS)
Cross Site Request Forgery (CSRF)
Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago
Presentation transcript:

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike 2.5 License. To view this license, visit The OWASP Foundation ShmooCon 2009 Washington, DC. – February AntiSamy – and Scrubbr picking a fight with xss Arshan Dabirsiaghi, OWASP Peasant Director of Research, Aspect Security (301)

ShmooCon 2009 – Washington, DC – Feb 2009 who am i? Name Arshan Dabirsiaghi (gesundheit) Trade Security hobbyist & developer Job Director of Research at Aspect Security Side Job Liverpool fan (go gerrard!) OWASP ISWG and AntiSamy Political Affiliation Plutocrat Quote “poor people are crazy; i’m eccentric”

ShmooCon 2009 – Washington, DC – Feb 2009 samy vs arshan  aka good vs evil,  sammy hagar vs david lee roth  ryu vs ken  …an old age old battle 3

ShmooCon 2009 – Washington, DC – Feb 2009  Taller, better looking  Persian (exotic)  More chest hair  Amazing in the sack  Lots of friends  Criminal record  Iranian (call DHS)  Untested in the sack  A lot of notoriety and street cred  Can’t get friends the old fashioned way, has to hack them 4 Arshansamy

ShmooCon 2009 – Washington, DC – Feb 2009 stored xss – the arsenic in the well  attacker submits sticky (persisted) input to the app (e.g., blog comment/user profile)  i mention the input contains JS? whoops  later, some random peasant comes along and views the profile or blog comment  application displays comment/profile to user browser and JS inside it gets exec’d instead of displayed on browser  hours later, a seagull donkey punches an angry pirate to death (totally unrelated)

ShmooCon 2009 – Washington, DC – Feb 2009 the story of samy (1 of 2)  myspace™ is one giant advertisement banner that has a hidden social networking site inside of it (like an easter egg)  you setup a profile, pics, etc. for other people to see  samy wanted an xss worm in his own profile that made the reader his friend and new source of worm

ShmooCon 2009 – Washington, DC – Feb 2009 the story of samy (part 2 of 2)  myspace did well not to let any JS through  samy used ‘ java\nscript ’ since ‘ javascript ’ was filtered out, String.fromCharCode(34) to generate a double quote, etc.  10 hours – 560 friends, 13 hours – 6400, 18 hours – 1,000,000, 19 hours – entire site is down

ShmooCon 2009 – Washington, DC – Feb 2009 what did myspace do wrong?  they used a word blacklist  negative security models are error prone  unknown attacks / fragmenting / encoding can usually bypass (sometimes trivially)

ShmooCon 2009 – Washington, DC – Feb 2009 do sites really need html from users? users want to customize profiles community sites like eBay/craigslist allow public listings cm solutions like magnolia, dotnetnuke, etc rich comment sharing on blogs, news sites, etc

ShmooCon 2009 – Washington, DC – Feb 2009 this is a bad situation… F5 // Defcon 31 // Threat level Midnight DISASTER – what to do?!!?1!? web apps trying to validate that HTML with blacklists sites need to allow users to provide HTML HTML the worst mashup of data and code ever

ShmooCon 2009 – Washington, DC – Feb 2009  an HTML validation tool and API  funded by an OWASP Spring of Code grant  uses a positive security model  takes dirty HTML/CSS that could contain xss and spits out a safe version of that input while retaining all formatting code  (applause)

ShmooCon 2009 – Washington, DC – Feb 2009 goals for anti-samy  provide high assurance  provide 99% (or close enough) protection against xss  browser wars, new w3c directives, etc. cause rules to change  be portable  works with terribly broken html  easy-to-use API or tool  use single XML policy file with default settings providing high assurance  absorbable by validator implementations in different languages  be able to provide friendly feedback, able to just “make it work”  users may copy html/js from a site they like  not all JavaScript is xss, user intention may not be malicious  help user to tune html/js to work with requirements  use it to meet girls  this goal is not going so well  do you know anyone?

ShmooCon 2009 – Washington, DC – Feb 2009 anti samy seen from outer space dirty html gets run through nekoHTML for structural sanitization (and legal validation)

ShmooCon 2009 – Washington, DC – Feb 2009 neko validation 14 body divb u (text) p img src=javascript:xss() src=hax.js style=expression(…) samy is my hero id=foo samy is my hero \0 - DOM object - fragmenting attacks gone - html now sanitized (text) script <

ShmooCon 2009 – Washington, DC – Feb 2009 anti samy seen from outer space Step through DOM tree and validate each node according to the policy file… filter / remove nodes / content or attributes as needed

ShmooCon 2009 – Washington, DC – Feb 2009 antisamy.xml – customize to your site’s policy Slashdot - links, markup E-Bay - links, markup, images, etc MySpace - links, markup, images, stylesheets, etc

ShmooCon 2009 – Washington, DC – Feb 2009 common stores in antisamy.xml Common Regular Expressions (write once then use anywhere by name) Common Tag Attributes (define attribute once then use in many tags) Global Tag Attributes (define implicit attributes for all tags)

ShmooCon 2009 – Washington, DC – Feb 2009 validation step-through (this slide is bananas) 18 head divb(text) a img src= style=expression(…) samy is my hero id=foo (text) i < li href=javascript:attax() script content=0;url=javascript:attax() http-equiv=refresh meta src=bar.jpg style=background-image: url(‘javascript:attax()’) p antisamy.xml Tag Not Found!

ShmooCon 2009 – Washington, DC – Feb 2009 anti samy seen from outer space Return as string or DOM object

ShmooCon 2009 – Washington, DC – Feb 2009 CleanResults object  getCleanHTML() - String  getCleanXMLDocumentFragment() - DOM  getScanTime() – double  getErrorMessages() – String[]

ShmooCon 2009 – Washington, DC – Feb 2009 how do i get started?  figure out policy on what tags and attributes to allow for your site  customize one of the default antisamy.xml files  add 5-10 lines of code to your app  done! congratulate self with guilt free visit to singles.net (look for tom stracener’s alternative profile)

ShmooCon 2009 – Washington, DC – Feb 2009 using antisamy api is really hard

ShmooCon 2009 – Washington, DC – Feb 2009 project goals  work to create a peer reviewed, time tested solution for validating html  destroy the idea that letting users provide their own html is too dangerous  enable the next gen of user generated content sites samy is a threat to western society

ShmooCon 2009 – Washington, DC – Feb 2009 what about CSRF?  simple – go through antisamy.xml and remove the ability to have offsite resources  changing common attributes make this real easy  hosting csrf attacks is an accepted risk for many

ShmooCon 2009 – Washington, DC – Feb 2009 interesting attacks 25 1.spot the vuln 2. hijacking co-browse window with target click ze link 4 lulz... window.open(“ 3. lots of vulns in neko ”.> SAX parsers + loops = hahahahahahaha

ShmooCon 2009 – Washington, DC – Feb 2009 known vulns? ... for now (gulp)  us-ascii, utf-7 – ANY time the browser is on a different planet than the input  few crashes (uncaught exceptions)  tx noticed debug code enabling XSS (whoops) 26

ShmooCon 2009 – Washington, DC – Feb 2009 socioeconomic enabler why should ebay, google, mysp ace be the only people able to ha ve this functionality? 27 this is my pdp slide

ShmooCon 2009 – Washington, DC – Feb 2009 demo time

ShmooCon 2009 – Washington, DC – Feb 2009 demo time (0 of 3 – few javascript tests)  everything on rsnake’s cheat sheet  Solution: already defended against in default policy files 29

ShmooCon 2009 – Washington, DC – Feb 2009 demo time (1 of 3 –absolute div overlay)  create a div in our profile that overlays the entire page (or a subsection)  extremely effective phishing vector  SSL certificate is valid  look and feel matches expectations  Solution: insert a stylesheet rule in the policy file to prevent access to any position value except those we want 30

ShmooCon 2009 – Washington, DC – Feb 2009 demo time (2 of 3 – div hijacking)  redefine an existing div “above” our profile  most stylesheets defined at the beginning of the page in or “at the top”  Solution: blacklist the IDs and selector names you want to prevent the user from being able to modify 31

ShmooCon 2009 – Washington, DC – Feb 2009 demo time (3 of 3 – all your base are belong to us)  insert a tag to hijack internal resources  used to define a base for all relative URLs on the page  isn’t used a whole lot as it doesn’t work within javascript & some other issues  Solution: remove tag from policy file 32

ShmooCon 2009 – Washington, DC – Feb 2009 … not done yet! Announcing Scrubbr!  database scanning tool  looks for stored XSS or presentation layer attacks (phishing)  best part: it’s got an ugly UI but you have no alternative  free as in free beer; BSD license 33

ShmooCon 2009 – Washington, DC – Feb 2009 what can’t Scrubbr do?  it can’t find:  dom-based xss  attribute-based xss  it’s not a good XSS detector like NoScript or PHPIDS  we’ looking at re-implementing PHPIDS in Java – that would make it JavaIDS – or javAIDS  it can’t fix:  probably some Oracle stuff  your vulnerabilities  your sdlc 34

ShmooCon 2009 – Washington, DC – Feb 2009 Thanks to:  the shmoo group for having me  all the contributors, bughunters, supporters:  jason li  jerry hoff  raziel alvarez  marcin yeelllshefsomething  diazepam  owasp 35

ShmooCon 2009 – Washington, DC – Feb 2009 ¿questions?