Copyright © 2007 - The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike.

Slides:



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

Enabling Secure Internet Access with ISA Server
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
By Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, and Giovanni Vigna Network and Distributed System Security(NDSS ‘07)
WebGoat & WebScarab “What is computer security for $1000 Alex?”
Attacking Session Management Juliette Lessing
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
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.
It’s always better live. MSDN Events Securing Web Applications Part 1 of 2 Understanding Threats and Attacks.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
Handling Security Threats in Kentico CMS Karol Jarkovsky Sr. Solution Architect Kentico Software
WEB SECURITY WORKSHOP TEXSAW 2013 Presented by Joshua Hammond Prepared by Scott Hand.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike.
OWASP Mobile Top 10 Why They Matter and What We Can Do
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
INTRODUCTION TO WEB DATABASE PROGRAMMING
IT 210 The Internet & World Wide Web introduction.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
CSC 2720 Building Web Applications Cookies, URL-Rewriting, Hidden Fields and Session Management.
Remotely authenticating against the Service Framework.
WEB SECURITY WEEK 3 Computer Security Group University of Texas at Dallas.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
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.
International Telecommunication Union Geneva, 9(pm)-10 February 2009 ITU-T Security Standardization on Mobile Web Services Lee, Jae Seung Special Fellow,
Computer Emergency Notification System (CENS)
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. 1 RubyJax Brent Morris/
SEC835 Runtime authentication Secure session management Secure use of cryptomaterials.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright © cs-tutorial.com. Overview Introduction Architecture Implementation Evaluation.
1 Robust Defenses for Cross-Site Request Forgery Adam Barth, Collin Jackson, John C. Mitchell Stanford University 15th ACM CCS.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
THE DEVIL IS IN THE (IMPLEMENTATION) DETAILS: AN EMPIRICAL ANALYSIS OF OAUTH SSO SYSTEMS SAN-TSAI SUN & KONSTANTIN BEZNOSOV PRESENTED BY: NAZISH KHAN COMPSCI.
1 Network Firewalls CSCI Web Security Spring 2003 Presented By Yasir Zahur.
PwC New Technologies New Risks. PricewaterhouseCoopers Technology and Security Evolution Mainframe Technology –Single host –Limited Trusted users Security.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
Practical Threat Modeling for Software Architects & System Developers
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
1 Chapter Overview Creating Web Sites and FTP Sites Creating Virtual Directories Managing Site Security Troubleshooting IIS.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Web Technologies Lecture 6 State preservation. Motivation How to keep user data while navigating on a website? – Authenticate only once – Store wish list.
Web Application (In)security Note: Unless noted differently, all scanned figures were from the textbook, Stuttard & Pinto, 2011.
Session Management Tyler Moore CS7403 University of Tulsa Slides adapted in part or whole from Dan Boneh, Stanford CS155 1.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
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,
The Postman Always Rings Twice: Attacking and Defending postMessage in HTML5 Websites Paper by Sooel Son and Vitaly Shmatikov, The University of Texas.
Chapter 29: Program Security Dr. Wayne Summers Department of Computer Science Columbus State University
Page 1 Ethical Hacking by Douglas Williams. Page 2 Intro Attackers can potentially use many different paths through your application to do harm to your.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
SESSION HIJACKING It is a method of taking over a secure/unsecure Web user session by secretly obtaining the session ID and masquerading as an authorized.
Building Secure ColdFusion Applications
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
World Wide Web policy.
Ofer Shezaf, CTO, Breach Security
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.
Cross-Site Request Forgeries: Exploitation and Prevention
Riding Someone Else’s Wave with CSRF
CSC 495/583 Topics of Software Security Intro to Web Security
Exploring DOM-Based Cross Site Attacks
Cross Site Request Forgery (CSRF)
Presentation transcript:

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike 2.5 License. To view this license, visit The OWASP Foundation OWASP & WASC AppSec 2007 Conference San Jose – Nov Defeating Web 2.0 Attacks without Recoding Applications Amichai Shulman CTO, Imperva

OWASP & WASC AppSec 2007 Conference – San Jose – Nov Goals and Agenda  Detection and Mitigation of JS-Hijacking and CSRF Attacks  Attack intro  Code based solution  Gateway based solution  Detecting Fraud Attempts that Exploit CSRF and JS-Hijacking Vulnerabilities

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Why CSRF and JS-Hijacking  JS-Hijacking is a newly discovered web 2.0 related vulnerability  CSRF has been given a lot of attention lately. Experts predict that it’s becoming the major issue in web security  Traditional mitigation techniques are not suitable for cost-effective implementation  To-date businesses are not properly protected against web frauds

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Introduction to JS Hijacking  Introduced by Fortify on March 12, 2007  Specific to applications who use Javascript as data transfer format – AJAX applications  Abuses a loophole in the browser’s Same Origin Policy  A script from any domain can be included and executed in the context of any other web site  If the script is used for application data transfer (it contains sensitive data in the form of JS arrays) that sensitive information can be accessed by code from a different domain  Most notable example: gmail contact list

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Introduction to JS Hijacking Log in and retrieve information … ….

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Introduction to JS Hijacking DEMO

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Code Based Solutions for JS Hijacking  Suggested by Fortify and others.  Track a session nonce  Long random number generated per each new session (could be the session cookie)  Include the random number in each form / link  Validate the random element of each incoming form / link against the cookie / internal session pool  Reject requests with invalid random  Change response format (use subverted Javascript)

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Shortcomings of Code Based Solutions  3 rd Party Components  Code for 3 rd party components cannot be altered  Deployed Applications  Modifying deployed applications is impractical extremely expensive and interrupts ongoing functionality  Coding Practices  Enforcing secure coding practices is expensive and does not cover every loophole in an application

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Shortcomings of Code Based Solutions (2)  No Feedback for Victim  Victim is unaware of attack  Security personnel is unaware of attack until it is too late (the attacker has changed servers)  No Support for Mashups  Access to application by Mashups would be rejected (unless more coding effort is put into the mashup)

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution - Motivation  Does not require code changes. Can be used for 3 rd party components as well as deployed applications  Does not disrupt application availability – no need to redeploy existing applications  Protects all instances of JS Hijacking vulnerabilities within the application  Continuous protection and detection regardless of new vulnerabilities being introduced into existing applications  Provide detection as well as protection, including feedback for potential victims

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution – Some Observations  The “malicious” request is sent from the victim’s browser rather than an attacker’s client  The “malicious” request is sent over an existing authenticated session (otherwise it would not make sense)  The “malicious” request is invoked by a visit to an attacker’s controlled page outside of the application’s domain  Allegedly “malicious” behavior can be the result of mashup usage  Response is in Javascript format

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution - Details  Two step solution  Detect suspicious access  Interact with end user to resolve the event  Detection  A request that belongs to an authenticated session  The domain in the “referer” header field is not part of the application (either manual setup or dynamically profiled behavior).  The response is in Javascript format

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution – Details (2)  Interact with user  Prefix the Javascript code in the response with code to interact with user  Display an alert box that includes information about the source domain and requires user approval  If end-user approves then the response is further processed by the browser, otherwise processing of the response is stopped before sensitive information is available to the browser

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution – Demo DEMO

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution – Extensions  The injected code can be further enhanced to accommodate a rich choice of user decisions:  Always block for the specific source domain  Always allow for the specific domain  Don’t bother me anymore during this session  Never bother me again  All the above can be implemented using browser controlled cookies inspected by the security gateway

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution – Fraud Detection  The injected code can be further enhanced to report the decision back to the security gateway (either explicitly or through a cookie)  The gateway behavior can be enhanced to detect attempted fraud and provide automatic reaction  A specific domain is reported by a variety of application users during a short period of time  The domain is flagged as malicious in the gateway’s database  Further requests invoked by pages from the malicious domain are immediately discarded

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Short Introduction to CSRF  Has been discussed extensively in previous sessions  Abuses the server’s trust in a client  Take advantage of stateless modules with simple parameter interface  Can be used to invoke application functionality  Cannot be (generally) used to compromise sensitive information

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Introduction to CSRF Log in and retrieve information … ….

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 CSRF – Short Demo DEMO

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Code Based Solutions for CSRF  Solution Types:  Track a session nonce (see earlier in this session)  Introduce CAPTCHA for sensitive modules  Shortcomings  See earlier in this session regarding code based solutions  If CAPTCHA is introduced then redundant user interaction is required for each sensitive operation  Not always possible to introduce CAPTCHA without breaking the application

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution - Challenges  Detection of suspicious request is easy  A request that belongs to an authenticated session  The domain in the “referer” header field is not part of the application (either manual setup or dynamically profiled behavior).  However  Interaction with user must occur before request is conveyed to the server  Injecting code into response may break the application

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Gateway Based Solution – Security Monitor  Javascript code running on the client side on behalf of the security gateway  Initialized when browser forms an authenticated session with the server through the security gateway  Constantly waiting on commands from the security gateway  Each instance of the security monitor is assigned a session nonce

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 CSRF and the Security Monitor  When CSRF is suspected  Gateway internally flags the session as suspended  Sends HTTP 307 response to the original URL  Keep sending 307 response until a resolution is given through the Security Monitor  Alternatively store request locally and redirect using HTTP 302 to a void URL (together with a unique request id)

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 CSRF and the Security Monitor (2)  Send code to Security Monitor  Display an alert message requesting user authorization (could be simple acknowledgement or CAPTCHA)  Code should include a digest of the request in question  User choice is communicated back to the gateway (together with the session nonce and the request digest)  If user authorized the request the session is released from suspension and requests are conveyed to the server  Otherwise, request is dropped (or HTTP 403 is sent back)

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Security Monitor and CSRF – Demo DEMO

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 CSRF and Security Monitor - Extensions  The injected code can be further enhanced to accommodate a rich choice of user decisions  Fraud detection as described earlier

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 CSRF and Security Monitor - Optimization  Problem  Implementing Security Monitor using standard protocol stack may incur a heavy burden on gateway (double the number of active connections)  Observations  In an overwhelming portion of the sessions the Security Monitor is never used  In those session that actually use the Security Monitor it is used for an extremely small portion of the requests  Basically it’s idle most of the time

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 CSRF and Security Monitor – Optimization (2)  Solution  Implement a lightweight TCP stack on a dedicated gateway port  Each “lightweight” connection is represented by a four-touple, sequence and ack numbers.  A single thread / process is used to monitor the port.  Requests are expected to be single frames and so are responses – thus buffering, reassembly and retransmissions are not required by server side stack

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 A Twist in the Plot – Nonce Injection  Why not use a gateway to generate and track the nonce?  Requires that the nonce be introduced into each and every request  Requires understanding of application logic embedded into HTML responses  Seems highly inefficient  Bla bla bla

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Nonce Injection  The Little Engine Who Could  Most AJAX applications, whether they use a 3 rd party framework or an in house developed infrastructure have their request generation code concentrated in an easily identifiable location  A dedicated script file  A distinctive piece of code within each response  It is easy to inject into the existing engine code additional code that embeds a session nonce into each request

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Nonce Injection with DWR DEMO

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Nonce Injection - Advantages  A unified solution for an enterprise, regardless of the AJAX frameworks used  Can be customized for in house developed infrastructure  Can be applied to frameworks where the actual code cannot be changed  Allows flexible configuration of protected paths vs. unprotected paths

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Summary and Implications  JS Hijacking and CSRF are two of the most common threats in Web 2.0 environments, expected to substantially affect the security of those applications  Traditional, code based solutions are very costly and in many situations inappropriate for web applications

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Summary and Implications  Gateway based solutions can be designed to combine gateway side detection with end-user confirmation  Gateway based solution are:  Cost effective  Allow fast and convenient integration into existing deployments and 3 rd party components  Provide for continuous protection for the ever changing web applications  Can be expanded to detect large scale fraud

OWASP & WASC AppSec 2007 Conference – San Jose – Nov 2007 Q&A More information at