Cross Site Request Forgery New Attacks and Defenses

Slides:



Advertisements
Similar presentations
Nick Feamster CS 6262 Spring 2009
Advertisements

Protecting Browser State from Web Privacy Attacks Collin Jackson, Andrew Bortz, Dan Boneh, John Mitchell Stanford University.
Cross-site Request Forgery (CSRF) Attacks
ForceHTTPS: Protecting High-Security Web Sites from Network Attacks Collin Jackson and Adam Barth.
Session Management Dan Boneh CS 142 Winter Sessions A sequence of requests and responses from one browser to one (or more) sites Session can be.
17 th ACM CCS (October, 2010).  Introduction  Threat Model  Cross-Origin CSS Attacks  Example Attacks  Defenses  Experiment  Related Work 2 A Presentation.
Common Exploits Aaron Cure Cypress Data Defense. SQL Injection.
EECS 354 Network Security Cross Site Scripting (XSS)
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
It’s always better live. MSDN Events Securing Web Applications Part 1 of 2 Understanding Threats and Attacks.
Information Networking Security and Assurance Lab National Chung Cheng University 1 Top Vulnerabilities in Web Applications (I) Unvalidated Input:  Information.
Beware of Finer-Grained Origins
 Proxy Servers are software that act as intermediaries between client and servers on the Internet.  They help users on private networks get information.
WEB SECURITY WORKSHOP TEXSAW 2013 Presented by Joshua Hammond Prepared by Scott Hand.
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Towards a Formal Foundation of Web Security devdatta akhawe / adam barth / peifung eric lam john mitchell / dawn song.
Cosc 4765 Server side Web security. Web security issues From Cenzic Vulnerability report
Origins, Cookies and Security – Oh My! John Kemp, Nokia Mobile Solutions.
WEB SECURITY WEEK 3 Computer Security Group University of Texas at Dallas.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
Robust Defenses for Cross-Site Request Forgery CS6V Presented by Saravana M Subramanian.
© All rights reserved. Zend Technologies, Inc. PHP Security Kevin Schroeder Zend Technologies.
Optimizing Traditional and Advocating New Prevention Methods Mark Jenne Tatiana Alexenko Cross-Site-Request-Forgery.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
Krishna Mohan Koyya Glarimy Technology Services
Cross-Site Attacks James Walden Northern Kentucky University.
Robust Defenses for Cross-Site Request Forgery
COMPUTER SECURITY MIDTERM REVIEW CS161 University of California BerkeleyApril 4, 2012.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
1 Robust Defenses for Cross-Site Request Forgery Adam Barth, Collin Jackson, John C. Mitchell Stanford University 15th ACM CCS.
Protecting Browsers from DNS Rebinding Attacks Collin Jackson, Adam Barth, Andrew Bortz ACM CCS Systems Modeling & Simulation Lab. Kim.
University of Central Florida The Postman Always Rings Twice: Attacking & Defending postMessage in HTML5 Websites Ankur Verma University of Central Florida,
CS526Topic 12: Web Security (2)1 Information Security CS 526 Topic 9 Web Security Part 2.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Cross-site request forgery Collin Jackson CS 142 Winter 2009.
Securing Angular Apps Brian Noyes
CSRF Attacks Daniel Chen 11/18/15. What is CSRF?  Cross Site Request Forgery (Sea-Surf)  AKA XSRF/ One Click / Sidejacking / Session Riding  Exploits.
Session Management Tyler Moore CS7403 University of Tulsa Slides adapted in part or whole from Dan Boneh, Stanford CS155 1.
Web Login, Cookies Web Login | Old way HTML
Intro to Web Application Security. iHostCodex Web Services - CEO Project-AG – CoFounder OWASP Panay -Chapter Leader -Web Application Pentester -Ethical.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
SECURE DEVELOPMENT. SEI CERT TOP 10 SECURE CODING PRACTICES Validate input Use strict compiler settings and resolve warnings Architect and design for.
UKUUG Linux 2008 Introduction to Web Application Security Flaws Jake Edge LWN.net URL for slides:
Web Application Security
Building Secure ColdFusion Applications
Intro to Web Application Security
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
TOPIC: Web Security (Part-4)
Modeling User Interactions for (Fun and) Profit Preventing Request Forgery Attacks in Web Applications Karthick Jayaraman, Grzegorz Lewandowski, Paul G.
World Wide Web policy.
API Security Auditing Be Aware,Be Safe
Ofer Shezaf, CTO, Breach Security
What is REST API ? A REST (Representational State Transfer) Server simply provides access to resources and the REST client accesses and presents the.
Cross-Site Forgery
Web Security same origin policy cross-site request forgery
Web Security A Programmers Perspective
Automatic and Precise Client-Side Protection against CSRF Attacks
Auditing Etsy The Security of Etsy
Riding Someone Else’s Wave with CSRF
CSC 495/583 Topics of Software Security Intro to Web Security
Web Security Advanced Network Security Peter Reiher August, 2014
WWW安全 國立暨南國際大學 資訊管理學系 陳彥錚.
Cross-Site Scripting Attack (XSS)
Cross Site Request Forgery (CSRF)
Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago
Presentation transcript:

Cross Site Request Forgery New Attacks and Defenses Collin Jackson Stanford University collinj@cs.stanford.edu (206) 963-0724 Joint work with Adam Barth and John C. Mitchell 6/25/2008

Outline CSRF Defined Attacks Using Login CSRF Existing CSRF Defenses CSRF Defense Proposal Identity Misbinding

Threat Models Forum Poster Web Attacker Network Attacker Injects content onto trusted site Sanitized (hopefully) Web Attacker Owns https://www.attacker.com Free user visit Network Attacker Eavesdrop/corrupt normal traffic Cannot eavesdrop/corrupt HTTPS

Browser vs. Web Attacker Isolate sites Sites can opt in to sharing information Prevent attacker from Abusing user’s IP address Reading browser state associated with other sites Writing browser state associated with other sites

Browser Security Policy Same-origin policy <iframe src="http://www.bank.com/"> <script> alert(frames[0].document.cookie); </script> Library import <script src="https://www.verisign.com/seal.js"> Data export <form action="https://www.bank.com/login">

Problems with Data Export Abusing user’s IP address Can issue commands to servers inside firewall Reading browser state Can issue requests with cookies attached Writing browser state Can issue requests that cause cookies to be overwritten “Session riding” is a misleading name

Cross-Site Request Forgery

Login CSRF

Payments Login CSRF

Payments Login CSRF

Payments Login CSRF

Payments Login CSRF

Inline Gadgets

Using Login CSRF for XSS

Post-XSS

Secret Validation Token CSRF Defenses Secret Validation Token Referer Validation Custom HTTP Header <input type=hidden value=23a3af01b> Referer: http://www.facebook.com/home.php X-Requested-By: XMLHttpRequest

Secret Validation Token vs. Web Attacker Hash of User ID Attacker can forge Session ID Save to HTML does allow session hijacking Session-Independent Nonce (Trac) Can be overwritten by subdomains, network attackers Session-Dependent Nonce (CSRFx, CSRFGuard) Requires managing a state table HMAC of Session ID No extra state required <input type=hidden value=23a3af01b>

Keeping Secrets in NoForge Parses HTML and appends token to hyperlinks Dynamically created HTML lacks token Legacy application may break unexpectedly Token appended to all external links Remote site can immediately CSRF referrer No login CSRF defense Requires a session before token is validated

  ? Referer Validation Referer: http://www.facebook.com/ Lenient Referer checking – header is optional Strict Referer checking – header is required Referer: http://www.facebook.com/  Referer: http://www.evil.com/attack.html ? Referer:

Why use Lenient Referer Checking? Referer may leak privacy-sensitive information http://intranet.corp.apple.com/ projects/iphone/competitors.html Common sources of blocking: Network stripping by the organization Network stripping by local machine Stripped by browser for HTTPS -> HTTP transitions User preference in browser Buggy user agents Site cannot afford to block these users

Lenient Referer Checking vs. Web Attacker ftp://www.attacker.com/index.html javascript:"<script> /* CSRF */ </script>" data:text/html,<script> /* CSRF */ </script> … and many more Lenient Referer Checking is not secure! Don’t use it!  Referer: M. Johns '06

Is Strict Referer Checking Feasible? 283,945 advertisement impressions from 163,767 IP addresses

XMLHttpRequest is for same-origin requests Custom Header XMLHttpRequest is for same-origin requests Can use setRequestHeader within origin Limitations on data export format No setRequestHeader equivalent XHR2 has a whitelist for cross-site requests Issue POST requests via AJAX: No secrets required X-Requested-By: XMLHttpRequest

Can browsers help sites with CSRF? Does not break existing sites Easy to use Allows legitimate cross-site requests Reveals minimum amount of information No secrets to leak Standardized

Proposal: Origin Header Privacy Identifies only principal that initiated the request (not path or query) Sent only for POST requests; following hyperlink reveals nothing Usability Authorize subdomains and affiliate sites with simple firewall rule No need to manage secret token state Can use redundantly with existing defenses to support legacy browsers Standardization Supported by W3C XHR2 and JSONRequest Expected in IE8’s XDomainRequest SecRule REQUEST_HEADERS:Host !^www\.example\.com(:\d+)?$ deny,status:403 SecRule REQUEST_METHOD ^POST$ chain,deny,status:403 SecRule REQUEST_HEADERS:Origin !^(https?://www\.example\.com(:\d+)?)?$

User is logged in to trusted site as attacker Identity Misbinding User is logged in to trusted site as attacker Does not always require login CSRF OpenID PHP Cookieless Authentication “Secure” cookies

Web Attacker vs. OpenID

Web Attacker vs. PHP Cookieless Authentication

Network Attacker vs. “Secure” Cookies Need a browser-based solution Cookie-Integrity Mitigation: Don’t allow self-XSS over HTTPS

Conclusions Beware of: OK: State-modifying GET requests Login CSRF Lenient Referer checking Sloppy secret token validation OpenID without binding to browser PHP cookieless authentication User opt-in to self-XSS (especially over HTTPS) OK: Careful secret token validation Strict Referer checking over HTTPS Custom headers