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

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.
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
In this lecture, you will learn: ❑ How to link between pages of your site ❑ How to link to other sites ❑ How to structure the folders on your web site.
©2009 Justin C. Klein Keane PHP Code Auditing Session 5 XSS & XSRF Justin C. Klein Keane
Cross Site Scripting & SQL injection
Cross Site Scripting a.k.a. XSS Szymon Siewior. Disclaimer Everything that will be shown, was created for strictly educational purposes. You may reuse.
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.
Active Server Pages Chapter 1. Introduction Understand how browsers and servers interacted when the Web was young Understand what early Internet and intranet.
Using Entities & Creating Forms Jill R. Sommer Institute for Applied Linguistics Kent State University.
Introduction to the OWASP Top 10. Cross Site Scripting (XSS)  Comes in several flavors:  Stored  Reflective  DOM-Based.
Exploits: XSS, SQLI, Buffer Overflow
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Presented by Paul Gilzow Web Communications University of Missouri #hew08xss.
CROSS SITE SCRIPTING..! (XSS). Overview What is XSS? Types of XSS Real world Example Impact of XSS How to protect against XSS?
Chapter 6: Hostile Code Guide to Computer Network Security.
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Copyright© 2002 Avaya Inc. All rights reserved Advanced Cross Site Scripting Evil XSS Anton Rager.
Prevent Cross-Site Scripting (XSS) attack
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Project Four Forms Discuss form processing Describe the difference between client-side and server-side form processing Add a horizontal rule to a Web page.
+ 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.
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.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
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.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
How did the internet develop?. What is Internet? The internet is a network of computers linking many different types of computers all over the world.
3-Protecting Systems Dr. John P. Abraham Professor UTPA.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
Web Spoofing Steve Newell Mike Falcon Computer Security CIS 4360.
School of Computing and Information Systems CS 371 Web Application Programming Security Avoiding and Preventing Attacks.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
ITCS373: Internet Technology Lecture 5: More HTML.
SQL INJECTIONS Presented By: Eloy Viteri. What is SQL Injection An SQL injection attack is executed when a web page allows users to enter text into a.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Introduction to JavaScript CS101 Introduction to Computing.
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.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
Module: Software Engineering of Web Applications Chapter 3 (Cont.): user-input-validation testing of web applications 1.
CSRF Attacks Daniel Chen 11/18/15. What is CSRF?  Cross Site Request Forgery (Sea-Surf)  AKA XSRF/ One Click / Sidejacking / Session Riding  Exploits.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Cross Site Scripting (XSS) Attack Chien-Chung Shen
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
XSS 101 Jason Clark 12/20.
Computer & Network Security
Module: Software Engineering of Web Applications
CSCE 548 Student Presentation Ryan Labrador
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
CS 371 Web Application Programming
Intro to PHP & Variables
Database Driven Websites
Cross-Site Request Forgery (CSRF) Attack Lab
Introduction to Servlets
PHP and Forms.
Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems
Exploring DOM-Based Cross Site Attacks
Cross Site Request Forgery (CSRF)
Presentation transcript:

Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems © 2002, Predictive Systems

Cross-Site Scripting in a Nutshell Consider a web site that gathers user input User input is displayed back to user Validate address, search results, etc. Attacker crafts URL with a script in it and sends to victim Victim clicks on link Script in the URL is sent to server as user input User input displayed; script "reflected" back to client Script runs on client Which state do I live in? I am a resident of: alert ("You are vulnerable to cross-site scripting!");

© 2002, Predictive Systems Cross-Site Scripting Overview Attacker intends to obtain sensitive data from victim user that is only accessible from within a valid session with the target site Attacker has analyzed the target site and identified a vulnerable CGI script (one that does not properly filter user supplied input, such as HTML tags) The site displays back to the user something the user types in, such as a name, account number, or anything, really Attacker has written a specialized browser script (most likely in JavaScript) that performs an action as a victim user on the target site

© 2002, Predictive Systems Ways of Launching Cross-Site Scripting Attacks Attacker's script must be sent to the victim Inter-user communication within the target site (i.e., message board, etc.) URL provided on a third-party web site (either clicked on by victim user or automatically loaded when visiting a malicious web site) URL embedded in an or newsgroup posting

© 2002, Predictive Systems How Cross-Site Scripting Attacks Work 1)Victim logs into the target site Could occur through social engineering by attacker Log in to your account to get this special offer!!! 2)Victim then clicks on a URL or visits a web site that includes the malicious code 3)Victim users browser transmits malicious code to the vulnerable script on the target site as a web request 4)Target site reflects the malicious code back to the victim users browser in the response to the request 5)Malicious code executes within victim users browser under the security context of the target site

© 2002, Predictive Systems How It Works (continued) target site Attacker NORMAL VALID SESSION security context: target site MALICIOUS CODE security context: target site From: Malicious User To: Victim User CLICK HERE browser window client normal interaction malicious code reflected code

© 2002, Predictive Systems When Will The Attack Be Successful? User must be convinced to click on a URL or visit a malicious web site AND User must be currently logged into the target site and have a valid session (that has not timed out) Both conditions can be accomplished through social engineering via or telephone

© 2002, Predictive Systems Cross-Site Scripting Defenses Remove from user input all characters that are meaningful in scripting languages: =<>"'(); You must do this filtering on the server side You cannot do this filtering using Javascript on the client, because the attacker can get around such filtering More generally, on the server-side, your application must filter user input to remove: Quotes of all kinds (', ", and `) Semicolons (;), Asterisks (*), Percents (%), Underscores (_) Other shell/scripting metacharacters (=&\|*?~<>^()[]{}$\n\r ) Your best bet – define characters that are ok (alpha and numeric), and filter everything else out