HTML5. Eoin Keary CTO BCC Risk Advisory. www.bccriskadvisory.com www.edgescan.com



Similar documents
Investigation Report Regarding Security Issues of Web Applications Using HTML5

Relax Everybody: HTML5 Is Securer Than You Think

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

Abusing HTML5. DEF CON 19 Ming Chow Lecturer, Department of Computer Science TuCs University Medford, MA

Recent Advances in Web Application Security

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

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

Advanced XSS. Nicolas Golubovic

Next Generation Clickjacking

Cross-Site Scripting

Table of Contents. Page ii

Secure development and the SDLC. Presented By Jerry

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Universal XSS via IE8s XSS Filters

Web-Application Security

Security starts in the head(er)

Criteria for web application security check. Version

SESSION IDENTIFIER ARE FOR NOW, PASSWORDS ARE FOREVER

Pwning Intranets with HTML5

Precise client-side protection against DOM-based Cross-Site Scripting

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

Web Application Guidelines

Defending your Web Applications from Attack: Presenter: Damira Pon, UAlbany. NYS Forum Web & Accessibility Workgroup Talk. NYS Forum Training Room

Blackbox Reversing of XSS Filters

Exploits: XSS, SQLI, Buffer Overflow

PST_WEBZINE_0X04. How to solve XSS and mix user's HTML/JavaScript code with your content with just one script

Cross Site Scripting Prevention

Hack Yourself First. Troy troyhunt.com

HTML5 Top 10 Threats - Stealth Attacks and Silent Exploits

CS 155 Final Exam. CS 155: Spring 2013 June 11, 2013

Gateway Apps - Security Summary SECURITY SUMMARY

Preparing for the Cross Site Request Forgery Defense

Protection, Usability and Improvements in Reflected XSS Filters

Web App Security Keeping your application safe Joe Walker

Network Security Web Security

Analysis of Browser Defenses against XSS Attack Vectors

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

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

Web Application Exploits

Attacks on Clients: Dynamic Content & XSS

Project 2: Web Security Pitfalls

What is Web Security? Motivation

Enterprise Application Security Workshop Series

Web Tracking for You. Gregory Fleischer

Bypassing Web Application Firewalls (WAFs) Ing. Pavol Lupták, CISSP, CEH Lead Security Consultant

Bank Hacking Live! Ofer Maor CTO, Hacktics Ltd. ATC-4, 12 Jun 2006, 4:30PM

XSS PROTECTION CHEATSHEET FOR DEVELOPERS V1.0. Author of OWASP Xenotix XSS Exploit Framework opensecurity.in

Webapps Vulnerability Report

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

Web Application Worms & Browser Insecurity

The New OWASP Testing Guide v4

Intrusion detection for web applications

Web Application Security

Team Members: Christopher Copper Philip Eittreim Jeremiah Jekich Andrew Reisdorph. Client: Brian Krzys

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Vulnerabilità dei protocolli SSL/TLS

Bypassing Internet Explorer s XSS Filter

Web Application and API Security The Latest Trends and Threats. 03/19/15 Sean Leach

UNCLASSIFIED CPA SECURITY CHARACTERISTIC WEB APPLICATION FIREWALLS. Version 1.3. Crown Copyright 2011 All Rights Reserved

Ruby on Rails Secure Coding Recommendations

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

Web Application Security

RTC-Web Security Considerations

Protecting Web Applications and Users

Research of Web Real-Time Communication Based on Web Socket

Attacking with HTML5. By,

SECURITY ADVISORY. December 2008 Barracuda Load Balancer admin login Cross-site Scripting

Hack-proof Your Drupal App. Key Habits of Secure Drupal Coding

CSRF: Attack and Defense

APPLICATION SECURITY AND ITS IMPORTANCE

Security Research Advisory IBM inotes 9 Active Content Filtering Bypass

Web and Security 1 / 40

UI Redressing and Clickjacking. About click fraud and data theft

Magento Security and Vulnerabilities. Roman Stepanov

CS5008: Internet Computing

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

Check list for web developers

Cross-site site Scripting Attacks on Android WebView

An Evaluation of the Google Chrome Extension Security Architecture

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


Security features of ZK Framework

Web Security. Crypto (SSL) Client security Server security 2 / 40. Web Security. SSL Recent Changes in TLS. Protecting the Client.

OWASP TOP 10 ILIA

App Isolation: Get the Security of Multiple Browsers with Just One

Security Model for the Client-Side Web Application Environments

(WAPT) Web Application Penetration Testing

EECS 398 Project 2: Classic Web Vulnerabilities

Legal notices. Legal notices. For legal notices, see

elearning for Secure Application Development

Transcription:

HTML5 Eoin Keary CTO BCC Risk Advisory www.bccriskadvisory.com www.edgescan.com

Where are we going? WebSockets HTML5 AngularJS HTML5 Sinks

WebSockets: Full duplex communications between client or server to a resource. A secure version of the WebSocket protocol is implemented in Firefox 6, Safari 6, Google Chrome 14, Opera 12.10 Internet Explorer 10. 3 3

Request: GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: x3jjhmbdl1ezlkh9gbhxdw== Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 Origin: http://example.com Response: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk= Sec-WebSocket-Protocol: chat This helps ensure that the server does not accept connections from non- WebSocket clients Abuse? It is the web server s responsibility to verify the Origin header in the initial HTTP WebSocket handshake. If the Origin header is not properly checked, the application may be vulnerable to CSRF Sec-WebSocket-Key header field in the client's handshake were " x3jjhmbdl1ezlkh9gbhxdw== ", the server would append the string "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" to form the string " x3jjhmbdl1ezlkh9gbhxdw== 258EAFA5-E914-47DA-95CA- C5AB0DC85B11". The server would then take the SHA-1 hash of this and return the value. 4 4

WebSockets if(window.websocket) { /*browser has websocket support var sock = new WebSocket('ws://server:8181');.. sock.onopen = function(event) { } /*Open... sock.send() */ sock.onmessage = function(e) { /*Received message */ e.data(); } sock.onclose = function(event) { /* Connection closed }

ProTip You should use the secure wss:// protocol over the insecure ws:// transport. Never Tunnel via websockets from the browser to say a database! XSS attacks can attack such connections. CSRF and WebSockets Process the messages received by the websocket as data. Never try to assign it directly to the DOM nor evaluate as code. If the response is JSON, never use the insecure eval() function; use the safe option JSON.parse() instead.

Websockets Authentication Authentication WebSockets do not handle authentication, instead normal application authentication mechanisms apply, such as cookies, HTTP Authentication or TLS authentication. Input Validation As with any data originating from untrusted sources the data should not be trusted. 7 7

Websockets Authentication Check the Origin: header in the Websockets handshake. Though it might be spoofed outside a browser, browsers always add the Origin of the page that initiated the Websockets connection. Always validate data coming through a WebSockets connection.

AngularJS Pitfalls AngularJS uses stuff like: {{}} are expressions in AngularJS. They are parsed and executed {{5+5}} <- output is 10 <div ng-init="some.js.code.here"> or {{constructor.constructor('alert(1)')()}} AngularJS uses it's own parser; If there's an injection source, no actual antixss filter will be able to stop these attacks.

HTML5 Sinks Formaction: <form id="test"></form><button form="test" formaction="javascript:alert(1)">x</button> <form><button formaction="javascript:alert(1)">clickme</button> - Don't allow users to submit markup containing "form" and "formaction" attributes or transform them to bogus attributes. HTML Attribute encoding of user data should prevent injection of formaction

More HTML 5 Elements <video>: <video vid1=javascript:alert(1)//></video> <video><src onerror="alert(1)"> Oninput: <body oninput=alert(1)><input autofocus> Srcdoc: <html><body><iframe src= srcdoc=<script>alert(123)</script></body>

More HTML 5 elements HTML5 offers the <picture> element. "srcset" attribute allows to trigger load events: <picture><img srcset="x" onerror="alert(1)"></picture>

Other elements which need to be considered <TABLE> <FRAMESET> <BASE> <OBJECT> <EMBED> <TITLE> [if] (conditional comments) <LINK> <STYLE> @import data

Local Storage Also known as WebStorage, DOM Storage Supported by: HTML5 Storage support IE Firefox Safari Chrome Opera iphone Android 8.0+ 3.5+ 4.0+ 4.0+ 10.5+ 2.0+ 2.0+ Accessed via LocalStorage object: var foo = localstorage.getitem("bar"); localstorage.setitem("bar", foo);

Local Storage it's recommended not to store any sensitive information in local storage. Malware; Unencrypted storage on local machine Shared computer environment etc etc sessionstorage instead of localstorage should be considered if persistent storage is not needed. sessionstorage object is available only to that window/tab until the window is closed.

Local Storage XSS can steal data similar to session cookie attacks. XSS can also load malicious data into local storage. getitem() and setitem() calls in Javascript are sources and sinks for localstorage attacks. Multiple applications on the Same Origin would share the same localstorage beware. One vulnerability could result in many applications being attacked!!!

iframe Sandboxing Sandboxed frames Use the sandbox attribute of an iframe for untrusted content. Rendering content based in input from an untrusted source. The sandbox attribute of an iframe enables restrictions on content within a iframe. The following restrictions are active when the sandbox attribute is set: All markup is treated as being from a unique origin. All forms and scripts are disabled. All links are prevented from targeting other browsing contexts. All features that triggers automatically are blocked. All plugins are disabled.

iframe Sandboxing <iframe src="demo_iframe_sandbox.htm" sandbox= <VALUE>"></iframe> If <VALUE> is specified as an empty string (sandbox=""), the sandbox attribute enables a set of extra restrictions for the content in the inline frame. The value of the sandbox attribute can either be an empty string (all the restrictions is applied), or a space-separated list of predefined values that will REMOVE particular restrictions.

iframe Sandboxing <iframe src="demo_iframe_sandbox.htm" sandbox= <VALUE>"></iframe> Value Description " (empty) Applies all restrictions below allow-same-origin allow-top-navigation allow-forms allow-scripts Allows the iframe content to be treated as being from the same origin as the containing document Allows the iframe content to navigate (load) content from the containing document Allows form submission Allows script execution

iframe Sandboxing In old versions of user agents where this feature is not supported, this attribute will be ignored. - backward compatable iframe Sanboxing can be used as an additional layer of protection. It may be an option to check if the browser supports sandboxed frames and only show the untrusted content if supported. Apart from this attribute, to prevent Clickjacking attacks and unsolicited framing it is encouraged to use the header X-Frame- Options which supports the deny and same-origin values.