Web 2.0 and AJAX Security. OWASP Montgomery. August 21 st, 2007

Similar documents
Information Security CS 526 Topic 8

shortcut Tap into learning NOW! Visit for a complete list of Short Cuts. Your Short Cut to Knowledge

Information Security CS 526 Topic 11

Lecture 17 Browser Security. Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Some slides from Bailey's ECE 422

CS 142 Winter Session Management. Dan Boneh

PROBLEMS IN PRACTICE: THE WEB MICHAEL ROITZSCH

Web basics: HTTP cookies

Content Security Policy

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

How is state managed in HTTP sessions. Web basics: HTTP cookies. Hidden fields (2) The principle. Disadvantage of this approach

CIS 4360 Secure Computer Systems XSS

Web basics: HTTP cookies

WEB SECURITY: XSS & CSRF

Security and Privacy. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Web Application Security. Philippe Bogaerts

RKN 2015 Application Layer Short Summary

Web 2.0 and Security

Computer Security CS 426 Lecture 41

CSE361 Web Security. Attacks against the client-side of web applications. Nick Nikiforakis

Web Security II. Slides from M. Hicks, University of Maryland

Information Security. Gabriel Lawrence Director, IT Security UCSD

Is Browsing Safe? Web Browser Security. Subverting the Browser. Browser Security Model. XSS / Script Injection. 1. XSS / Script Injection

Preparing for the Cross Site Request Forgery Defense

Web Security: Vulnerabilities & Attacks

Some Facts Web 2.0/Ajax Security

Common Websites Security Issues. Ziv Perry

Certified Secure Web Application Engineer

CHAPTER 8 CONCLUSION AND FUTURE ENHANCEMENTS

Lecture Overview. IN5290 Ethical Hacking

Lecture 6: Web hacking 2, Cross Site Scripting (XSS), Cross Site Request Forgery (CSRF), Session related attacks

COMP9321 Web Application Engineering

Robust Defenses for Cross-Site Request Forgery

Application vulnerabilities and defences

GOING WHERE NO WAFS HAVE GONE BEFORE

Web Security IV: Cross-Site Attacks

Attacks Against Websites 3 The OWASP Top 10. Tom Chothia Computer Security, Lecture 14

OWASP Top 10 Risks. Many thanks to Dave Wichers & OWASP

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies

Web Security. Thierry Sans

F5 Big-IP Application Security Manager v11

CS 161 Computer Security

CSCE 813 Internet Security Case Study II: XSS

Chrome Extension Security Architecture

Web 2.0 Attacks Explained

2/16/18. CYSE 411/AIT 681 Secure Software Engineering. Secure Coding. The Web. Topic #11. Web Security. Instructor: Dr. Kun Sun

Web Application Penetration Testing

Exploiting and Defending: Common Web Application Vulnerabilities

Notes From The field

Human vs Artificial intelligence Battle of Trust

REST AND AJAX. Introduction. Module 13

Solutions Business Manager Web Application Security Assessment

Web Application with AJAX. Kateb, Faris; Ahmed, Mohammed; Alzahrani, Omar. University of Colorado, Colorado Springs

Advanced Web Technology 10) XSS, CSRF and SQL Injection

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

CSC 482/582: Computer Security. Cross-Site Security

Surrogate Dependencies (in

Copyright

User Interaction: jquery

Application Security through a Hacker s Eyes James Walden Northern Kentucky University

PROBLEMS IN PRACTICE: THE WEB MICHAEL ROITZSCH

Web Security, Summer Term 2012

Web Security, Summer Term 2012

Simple AngularJS thanks to Best Practices

EasyCrypt passes an independent security audit

C1: Define Security Requirements

Abusing Windows Opener to Bypass CSRF Protection (Never Relay On Client Side)

Attacks Against Websites. Tom Chothia Computer Security, Lecture 11

INF3700 Informasjonsteknologi og samfunn. Application Security. Audun Jøsang University of Oslo Spring 2015

WHY CSRF WORKS. Implicit authentication by Web browsers

Your Turn to Hack the OWASP Top 10!


Provide you with a quick introduction to web application security Increase you awareness and knowledge of security in general Show you that any

CSCD 303 Essential Computer Security Fall 2017

Attacking the Application OWASP. The OWASP Foundation. Dave Ferguson, CISSP Security Consultant FishNet Security.

CSWAE Certified Secure Web Application Engineer

Andrew Muller, Canberra Managing Director, Ionize, Canberra The challenges of Security Testing. Security Testing. Taming the Wild West

Robust Defenses for Cross-Site Request Forgery

P2_L12 Web Security Page 1

Application Design and Development: October 30

Security. CSC309 TA: Sukwon Oh

Understanding Web 2.0

Web Application Vulnerabilities: OWASP Top 10 Revisited

Fortify Software Security Content 2017 Update 4 December 15, 2017

Computer Security 3e. Dieter Gollmann. Chapter 18: 1

HTTP Security Headers Explained

Lesson 12: JavaScript and AJAX

TIBCO Cloud Integration Security Overview

CSCD 303 Essential Computer Security Fall 2018

CIS 700/002 : Special Topics : OWASP ZED (ZAP)

Presented By Rick Deacon DEFCON 15 August 3-5, 2007

2/16/18. Secure Coding. CYSE 411/AIT 681 Secure Software Engineering. Web Security Outline. The Web. The Web, Basically.

Top 10 AJAX security holes & driving factors

Welcome to the OWASP TOP 10

Client Side Security And Testing Tools

Secure Parameter Filter (SPF) (AKA Protecting Vulnerable Applications with IIS7) Justin Clarke, Andrew Carey Nairn

Cross-Site Request Forgery: The Sleeping Giant. Jeremiah Grossman Founder and CTO, WhiteHat Security

John Coggeshall Copyright 2006, Zend Technologies Inc.

CS50 Quiz Review. November 13, 2017

Avoiding Web Application Flaws In Embedded Devices. Jake Edge LWN.net URL for slides:

AJAX: Rich Internet Applications

Transcription:

Web 2.0 and AJAX Security OWASP Montgomery August 21 st, 2007

Overview Introduction Definition of Web 2.0 Basics of AJAX Attack Vectors for AJAX Applications AJAX and Application Security Conclusions 1

Introduction Dan Cornell Principal of Denim Group, Ltd. Software developer by training and background JEE.NET A little bit of everything else Currently focused on security Application assessments and penetration tests Training and mentoring Look at both building and breaking web applications 2

Definitions of Web 2.0 Evangelical Technical 3

Definition of Web 2.0 (Evangelical) Web 2.0 is the business revolution in the computer industry caused by the move to the internet as platform, and an attempt to understand d the rules for success on that t new platform. Chief among those rules is this: Build applications that harness network effects to get better the more people use them. -Tim O Reilly 4

Definition of Web 2.0 (Technical) Collaborative Applications New Technologies AJAX Flash/Flex Rich Internet Applications UI is more interactive Key to remember: HTTP requests are still just bits transmitted across the wire 5

Basics of AJAX Asynchronous JavaScript and XML Term coined by Jesse James Garrett http://www.adaptivepath.com/publications/essays/archives/000385.php Illustrations from next two slides come from this URL Relies on the XMLHttpRequest object accessible from JavaScript Security model only allows the browser to connect back to the original server These techniques have been around for a while but have only recently seen wide adoption 6

AJAX Illustrated 7

AJAX Illustrated 8

What Does AJAX Look Like? Still bits going across the wire Still HTTP traffic Headers GET parameters POST data Content is typically different than normal HTTP traffic XML JSON (versus HTTP POSTs and HTML) 9

What Does AJAX Look Like? 10

What Does AJAX Look Like? 11

Why is AJAX Security a Concern? Web 2.0 application have all the same problems as traditional web applications and more! Threat models / risk profiles are not well understood Focus on what CAN be done not what SHOULD be done Practitioners are focused on what they can do rather than how (or if) they should do it 12

Attack Vectors for AJAX Applications Front-door attacks on server-side resources Remote control attacks via target application Remote control attacks via 3 rd party application 13

Attack Vectors for AJAX Applications Front-door attacks on server-side resources SQL injection attacks AuthX, AuthZ attacks 14

Attack Vectors for AJAX Applications Remote control attacks via target application Cross Site Scripting (XSS) Cross Site Request Forgery (CSRF) 15

Attack Vectors for AJAX Applications Remote control attacks via 3 rd party application JavaScript manipulation 16

Fundamentals of AJAX Security All the standard rules for web application security still apply Perform Threat Modeling / Risk Assessment Validate input: Do not trust anything in the request Cookies, other HTTP Headers Parameters Prefer positive validation to negative validation Escape output HTML (HTMLEncode) XML (XMLEncode) URL parameters (URLEncode) Authentication and Authorization still matter Web services and other Web 2.0 endpoints must require authentication and should enforce authorization 17

Fundamentals of AJAX Security New things to think about Protect methods to access sensitive URLs Prefer POST requests over GET requests There are lots of ways to make GET requests (<IMG> <SCRIPT> and so on) POST requests are typically only automated via XMLHttpRequest Know what hosts serve what content Be careful what you send via JavaScript Sensitive data may be accessible off-domain 18

Some (In)Famous Vulnerabilities MySpace Worm GMail Hacks 19

MySpace Worm Based on an assembled JavaScript built up from several substrings Bypassed numerous negative filters against malicious tags, attributes, etc Relied on the same functionality being served from multiple hostnames profile.myspace.com and www.myspace.com Used a multi-step background combination of GETs and POSTs Get the list of friends Parse out special POST tokens Add samy as a new friend For more info: http://namb.la/popular/ Technical explanation: http://namb.la/popular/tech.html / l /t h l 20

MySpace Worm: Lessons Learned Better input validation positive versus negative where possible Interpretable HTML is a big place so carving out a couple of tags or syntax bits will not remove the ability of attackers to find workarounds Be careful about what functionality is available from where GETs versus POSTs What applications are available from a given hostname? Similar to checking to be sure that HTTPS content is not available via HTTP 21

GMail Hacks Link to malicious site sent in GMail message User clicks on link and page renders Page contains a script reference to a Gmail URL that will render sensitive data encoded in JavaScript User s cookies are sent along to GMail because user was just logged in to GMail Page also contains an override for the JavaScript Array() constructor Browser can then access off-domain JavaScript content and send along to a 3 rd party site More information: http://jeremiahgrossman.blogspot.com/2006/01/advanced-web-attack-techniques-using.html Easier to type: http://tinyurl.com/2t99b8 22

GMail Hacks: Lessons Learned Do not put sensitive data in JavaScript content in a form that can be automatically parsed What if it ends up in a SCRIPT tag? Possible to override constructors in JavaScript language URLs that render JavaScript with sensitive data should be hard to get to (for an attacker) POST rather than GET Unpredictable URL Check referrers Can be spoofed but can help prevent execution in some cases 23

AJAX and Application Security Old Favorites Authentication and Authorization SQL Injection Cookie Tampering Parameter Tampering New Stuff Additional State on the Client Cross Site Scripting Cross Site Request Forgery (CSRF) JavaScript Manipulation 24

Old Favorites Authentication and Authorization SQL Injection Cookie Tampering Parameter Tampering 25

Authentication and Authorization XMLHttpRequests send along the same cookies as the browser Leverage the server-side session Require authentication as with accessing any other web application Require authorization before allowing access to sensitive content or capabilities Continue to leverage platform Authentication and Authorization features 26

SQL Injection This works just like it does for normal web applications Creating SQL queries based on static text and unfiltered inputs 27

Cookie Tampering Cookies are passed along with AJAX XMLHttpRequests Can piggyback of pre-existing session login Malicious users can still modify cookies when making direct requests 28

Parameter Tampering Parameters are passed along with the XMLHttpRequests via a variety of means GET POST Each framework has its own encoding scheme 29

New Stuff Additional State on the Client Cross Site Scripting (XSS) Cross Site Request Forgery (CSRF) JavaScript Manipulation XML Security JSON Security 30

Additional State on the Client Bad in normal web applications Hidden FORM fields Cookies TERRIBLE in AJAX applications Although handling things on the client is kind of the point of AJAX No excuse for sloppy server-side validation 31

Cross Site Scripting Receiving HTML from 3 rd party sites is just as dangerous to AJAX-enabled applications How much do you trust the folks you are talking to? Standard threat modeling applies 32

Cross Site Request Forgery (CSRF) Similar to Cross Site Scripting (XSS) Inject HTML or JavaScript to make rogue requests XMLHttpRequest calls <img src=http://site/target.aspx?param=value> Risk mitigation: Limit URLs to only render for POST requests Helps prevent access via IMG tags and the like Add nonces to URLs Require ViewState encryption/validation on ASP.NET sites 33

JavaScript Manipulation AJAX applications often render our JSON or other valid JavaScript These can be potentially accessed via 3 rd party sites Sensitive data can be retrieved and sent elsewhere Risk Mitigation Do not send sensitive data in JavaScript parsable format Might end up in a <SCRIPT> tag It is possible to defeat built-in browser protections for JavaScript security Redefine JavaScript Array() constructor t Redefine JavaScript object() constructor 34

XML Security If clients are sending XML documents be careful what you trust DOM SAX Text on network wire is turned into objects in server memory Potential for DoS attacks by consuming memory <tag /><tag /><tag /> XML documents passed between systems can be injected just like SQL Watch out for re-occurrence of tags Application expects <tag1 /><tag2 /> Application sees <tag1 /><tag2 /><tag1 /> 35

JSON Security JSON can be made into JavaScript objects using the eval() command This is dangerous Use parsejson() function instead 36

OWASP and Web 2.0 Security Open Web Application Security Project (OWASP) http://www.owasp.org/ OWASP AJAX Project http://www.owasp.org/index.php/category:owasp_ajax_security_project OWASP Sprajax Project http://www.owasp.org/index.php/category:owasp_sprajax_project OWASP Testing Guide http://www.owasp.org/index.php/testing_for_ajax:_introduction 37

Contact Dan Cornell dan@denimgroup.com (210) 572-4400 Website: http://www.denimgroup.com/ Blog: http://denimgroup.typepad.com/ 38