Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems

Slides:



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

Nick Feamster CS 6262 Spring 2009
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?
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 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.
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.
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)
Prevent Cross-Site Scripting (XSS) attack
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
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.
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.
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.
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.
 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.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
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.
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
Chapter 5 Validating Form Data with JavaScript
Distributed Control and Measurement via the Internet
Group 18: Chris Hood Brett Poche
Module: Software Engineering of Web Applications
CSCE 548 Student Presentation Ryan Labrador
Unit 20 - Client Side Customisation of Web Pages
An Introduction to Web Application Security
Module: Software Engineering of Web Applications
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
Section 6.3 Server-side Scripting
Web Development Web Servers.
Static Detection of Cross-Site Scripting Vulnerabilities
CS 371 Web Application Programming
Whether you decide to use hidden frames or XMLHttp, there are several things you'll need to consider when building an Ajax application. Expanding the role.
PHP / MySQL Introduction
Cross-Site Request Forgeries: Exploitation and Prevention
Intro to PHP & Variables
Database Driven Websites
Unit 27 - Web Server Scripting
Web Systems Development (CSC-215)
CSC 495/583 Topics of Software Security Intro to Web Security
Cross-Site Request Forgery (CSRF) Attack Lab
Introduction to Servlets
PHP and Forms.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Advanced Cross Site Scripting Evil XSS
Introduction to JavaScript
Exploring DOM-Based Cross Site Attacks
Enterprise Class Security Scanner
Security and JavaScript
Cross-Site Scripting Attack (XSS)
Cross Site Request Forgery (CSRF)
Presentation transcript:

Cross-Site Scripting Issues and Defenses Ed Skoudis 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: <SCRIPT LANGUAGE=Javascript>alert ("You are vulnerable to cross-site scripting!");</SCRIPT>

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 <SCRIPT> 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

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 email or newsgroup posting

How Cross-Site Scripting Attacks Work 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 user’s 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 user’s browser in the response to the request 5) Malicious code executes within victim user’s browser under the security context of the target site

How It Works (continued) target site Attacker 3 malicious code 1 “reflected” code normal interaction 4 2 From: Malicious User To: Victim User CLICK HERE MALICIOUS CODE security context: target site NORMAL VALID SESSION security context: target site 5 email client browser window browser window

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 e-mail or telephone

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