W3Conf, November 15 & 16, Brad Scott

Similar documents
Match the attack to its description:

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

RKN 2015 Application Layer Short Summary

Extending the browser to secure applications

Web basics: HTTP cookies

NoScript, CSP and ABE: When The Browser Is Not Your Enemy

Browser code isolation

Web basics: HTTP cookies

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

Content Security Policy

WHY CSRF WORKS. Implicit authentication by Web browsers

HTTP Security Headers Explained

October 08: Introduction to Web Security

Chrome Extension Security Architecture

Content Security Policy

Origin Policy Enforcement in Modern Browsers

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

C1: Define Security Requirements

Web Application Security. Philippe Bogaerts

Information Security CS 526 Topic 11

Web Application Vulnerabilities: OWASP Top 10 Revisited

Sichere Webanwendungen mit Java

Writing Secure Chrome Apps and Extensions

Modern client-side defenses. Deian Stefan

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

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

HTML5: Something wicked this way comes. Krzysztof Kotowicz Securing

OWASP Top David Caissy OWASP Los Angeles Chapter July 2017

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

COMP9321 Web Application Engineering

High -Tech Bridge s Web Server Security Service API Developer Documentation Version v1.3 February 13 th 2018

WEB SECURITY: XSS & CSRF

CS 161 Computer Security

Care & Feeding of Programmers: Addressing App Sec Gaps using HTTP Headers. Sunny Wear OWASP Tampa Chapter December

Client Side Security And Testing Tools

Authentication and Password CS166 Introduction to Computer Security 2/11/18 CS166 1

Can HTTP Strict Transport Security Meaningfully Help Secure the Web? nicolle neulist June 2, 2012 Security B-Sides Detroit

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

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

Sichere Software vom Java-Entwickler

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

CS Paul Krzyzanowski

Computer Security. 14. Web Security. Paul Krzyzanowski. Rutgers University. Spring 2018

BOOSTING THE SECURITY

Information Security CS 526 Topic 8

Robust Defenses for Cross-Site Request Forgery Review

Application Security Introduction. Tara Gu IBM Product Security Incident Response Team

Acknowledgments... xix

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

AN EVALUATION OF THE GOOGLE CHROME EXTENSION SECURITY ARCHITECTURE

s642 web security computer security adam everspaugh

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

Applications Security

Contents. xvii xix xxiil. xxvii

Application. Security. on line training. Academy. by Appsec Labs

CSWAE Certified Secure Web Application Engineer

HTML5 Unbound: A Security & Privacy Drama. Mike Shema Qualys

Welcome to the OWASP TOP 10

Your Turn to Hack the OWASP Top 10!

PROBLEMS IN PRACTICE: THE WEB MICHAEL ROITZSCH

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

Web Security. Course: EPL 682 Name: Savvas Savva

Secure Frame Communication in Browsers Review

CSP ODDITIES. Michele Spagnuolo Lukas Weichselbaum

W e b A p p l i c a t i o n S e c u r i t y : T h e D e v i l i s i n t h e D e t a i l s

THREAT MODELING IN SOCIAL NETWORKS. Molulaqhooa Maoyi Rotondwa Ratshidaho Sanele Macanda

OWASP Top 10 The Ten Most Critical Web Application Security Risks

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

Secure Coding and Code Review. Berlin : 2012

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

Web Security: Loose Ends

s642 web security computer security adam everspaugh

Moving your website to HTTPS - HSTS, TLS, HPKP, CSP and friends

Copyright

Web Application Threats and Remediation. Terry Labach, IST Security Team

More attacks on clients: Click-jacking/UI redressing, CSRF

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

Web Security: XSS; Sessions

CIS 5373 Systems Security

EasyCrypt passes an independent security audit

Web Security: Vulnerabilities & Attacks

Solutions Business Manager Web Application Security Assessment

Exploiting and Defending: Common Web Application Vulnerabilities

Human vs Artificial intelligence Battle of Trust

(System) Integrity attacks System Abuse, Malicious File upload, SQL Injection

Certified Secure Web Application Engineer

Defend Your Web Applications Against the OWASP Top 10 Security Risks. Speaker Name, Job Title

OWASP Thailand. Proxy Caches and Web Application Security. OWASP AppSec Asia October 21, Using the Recent Google Docs 0-Day as an Example

P2_L12 Web Security Page 1

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

Know Your Own Risks: Content Security Policy Report Aggregation and Analysis

Application Layer Security

Students should have an understanding and a working knowledge in the following topics, or attend these courses as a pre-requisite:

Students should have an understanding and a working knowledge in the following topics, or attend these courses as a pre-requisite:

Don't Trust The Locals: Exploiting Persistent Client-Side Cross-Site Scripting in the Wild

django-secure Documentation

GUI based and very easy to use, no security expertise required. Reporting in both HTML and RTF formats - Click here to view the sample report.


LECT 8 WEB SECURITY BROWSER SECURITY. Repetition Lect 7. WEB Security

Northeastern University Systems Security Lab

Transcription:

The Future of Web Application Security W3Conf, November 15 & 16, 2011 Brad Hill @hillbrad bhill@paypal-inc.com Scott Stender @scottstender scott@isecpartners.com

The History of Web App Security

Attacker as Eavesdropper and Impersonator HTTP

Attacker as Client

OWASP Top 10 2010 A1: Injection A2: Cross-Site Scripting (XSS) A3: Broken Authentication and Session Management A4: Insecure Direct Object References A5: Cross-Site Request Forgery (CSRF) A6: Security Misconfiguration A7: Insecure Cryptographic Storage A8: Failure to Restrict URL Access A9: Insufficient Transport Layer Protection A10: Unvalidated Redirects and Forwards

Attacker as Server Bank.com Evil.com

Confusing the Client: CSRF Cookie: mycreds=sekr1t GET /transfer?amt=$1m&to=mallory <iframe src=https://bank.com/transfer?amt=$1m&to=mallory> GET /dancingpigs.html

Client Code Injection: Reflected XSS <script>evil.js</script> <iframe src=https://bank.com/?amt=<script>evil.js</script> GET /dancingpigs.html

Client Code Injection: Stored XSS GET /comment <script>evil.js</script> POST /comment?txt=<script>evil.js</script>

OWASP Top 10 2010 A1: Injection A2: Cross-Site Scripting (XSS) A3: Broken Authentication and Session Management A4: Insecure Direct Object References A5: Cross-Site Request Forgery (CSRF) A6: Security Misconfiguration A7: Insecure Cryptographic Storage A8: Failure to Restrict URL Access A9: Insufficient Transport Layer Protection A10: Unvalidated Redirects and Forwards

Conventional Wisdom of Web Security: Never trust the client. Defend the server, at the server.

< < HTTPS WEB SECURITY 1.0

Enter Web 2.0

AJAX Empowers Clients

Mobile Code, not just Mobile UI

Client Code Injection: DOM XSS DOM #alert(xss) eval(location.href.split( # )[1]); GET /app.js <iframe src=https://bank.com/app.js#alert(xss)> GET /dancingpigs.html

Contrived Example, Real Vulnerability Mindedsecurity.com tested a sample of the Alexa Top 1M, and found 56% of sites they examined had exploitable DOM XSS vulnerabilities. Source of real vulnerabilities against Twitter, Omniture, more DOM XSS Sources: document.url document.urlunencoded document.documenturi document.location document.referrer window.name window.location window.dialogarguments postmessage (HTML5)

Web APIs beyond the Browser

What is the sound of Cross-Site Scripting without a Site? Credit: kyleosborn.org

Data from Everywhere: Meet the Mashups

One App, Many Servers Accessing map data is great if you are Google What about every other use of maps? Can t we re-use that service?

NO! Bank.com Evil.com

First Generation Mashups: Hacking the Same-Origin Policy Clever uses of <script> <img> <iframe> aggregate content and work around the SOP JSONP is a fantastic example of a mature technology built on clever use of <script> Or

Making Mashups Work JSONP is a great way of inviting arbitrary code execution in your DOM JSONP places all of your security in the hands of the script source Sourcing script gives that server checkin privileges on your code

But they are trustworthy Even trustworthy companies are compromised Even trustworthy companies enjoy your customers and your data Are your users, your customers, expecting that security model?

HTML5+ Mashing Up with permission

CORS and XHR2 Cross-Origin Resource Sharing : Server-supplied headers permitting the client to relax the Same-Origin Policy With or without credentials Richer response types with XMLHttpRequest Level 2 ArrayBuffer, Blob, File, FormData Also allows anonymous requests

WebSockets Bi-directional communication between server and Web client May be cross-origin, client sends verified origin

CORS, XHR2, WebSockets No policy file at well-known location as, e.g.: crossdomain.xml for Flash clientaccesspolicy.xml for Silverlight Access control is dynamically determined, perresource Harder to identify and audit cross-domain permissions on a server than with plugin-based approaches.

postmessage Cross-Document and Channel Messaging establish communication between instances of client-side code in the same browser, including across origins Includes origin targets, but ports can be passed to other origins or an origin may itself be a mashup

Web RTC postmessage communicates between client-side apps in the same browser Web RTC (in development) communicates realtime multimedia between client-side apps running in different browsers

WebStorage postmessage HTTP, XHR Web RTC CORS, XHR2, WebSockets

PostMessage DOM #alert(xss) HTTPS < <

Assets and attack surface are moving to the client. We are still only defending at the server, but it does not see all data flows.

Servers are still broken But the future of Web App Security is in the client.

So what now?

Testing/Verification Comprehensive analysis of standard web apps already stressed our abilities to test Now we have to manage the entire set of potential state in a DOM Test tools, even developer tools, are not where they should be

The State of Mobile Code Engineering: Stay vulnerable, my friends.

What do we do? What can we do? Today: Features you want come with built-in Game Over security problems JSONP and <script src=> patterns plaintext HTTP We need Mobile Code designed to be securable: Compartmentalized Decoupled Explicit Testable: Think TDD

Today: Use HTML5+ Mashup APIs Authenticate Origins: HTTPS and HSTS everywhere Secure Design: Compartmentalize and Sandbox Origins Client-Side Testing

Design: Compartmentalization Use httponly cookies Isolate session credentials value from the DOM Minimize foreign origins Remember: <script src= X > is equivalent to giving X unsupervised check-in privileges to your codebase Create unique origins to isolate apps and sandbox dangerous / active content example.com, example-sandbox.com, example-marketing.com Remember that scripts can reset their origin to something less-specific!

Seamless IFRAME Sandbox Blog blog blog blog blog blog origin=safe.com USER COMMENTS: <iframe seamless sandbox> origin=null Mallory: <script>whoops, a bypass!</script>

IFRAME Sandbox + JSONP origin=safe.com <iframe sandbox= allow-scripts > origin=safe.com origin=null postmessage script src=evil.com/jsonp?callback=pwned

Implementation: Validate! Context-sensitive validation of untrusted data HTML, Attribute, CSS, JS, JSON, URL Do this client-side, even if you also do it serverside Better view of the data through the local parser http://plugins.jquery.com/project/jqencoder

Some great starts on tooling: DOMinator Firefox runtime tool for analyzing and identification of DOM-based XSS Stefano Di Paola and MindedSecurity http://blog.mindedsecurity.com/2011/05/dominator-project.html DOM Snitch Chrome runtime tool: passive analysis of dangerous client-side practices in the DOM Radoslav Vasilev @ Google http://code.google.com/p/domsnitch/ Other DOM XSS tools from IBM, Blueinfy WebDriver and Selenium for testing in-the-client

Near Future Make and Demand better tooling. Design for and use a Content Security Policy Tell your browser vendors and API providers that security matters to you!

Least-Privilege: Content Security Policy New work pioneered by Mozilla and Google, now on W3C recommendation track. Header or META tag to allow/force a page to drop privileges and capabilities No inline script, no code from strings (eval), no data: URIs (mostly) Code must come from libraries at origins specified in script-src whitelist Origin whitelisting for other features: Image, media, frame, font, object/plugin

Challenges Remaining

Clickjacking / UI Redressing A serious threat to in-context mashups. Like, +1, Follow, Pay, Friend, Share Pay can be reversed. You can t claw back your social graph after being Friend-jacked. X-Frame-Options allows refusal to render when framed Breaks the Web to secure it Not helpful when you want to be framed Work underway to fix this in W3C WebAppSec WG

The DOM is still a mess Hundreds of browser-specific quirks Hinders tool market, understanding of attack surface, crossplatform testing Amazing and innovative efforts at client-side security models by Mario Heiderich, Gareth Heyes, etc. Client-side, foolproof anti-xss, sandboxing, even RBAC in the DOM Constantly foiled by the mess of the DOM

Need for a Strict DOM? The Standard The Whole Standard And Nothing But the Standard

Thank you!

We are: bhill@paypal-inc.com, @hillbrad scott@isecpartners.com, @scottstender Others to follow: @WisecWisec, @garethheyes, @0x6D6172696F, @johnwilander, @jeremiahg, @kkotowicz, @randomdross, @lcamtuf http://www.schemehostport.com/ (Adam Barth) The Tangled Web (new book by lcamtuf)