Aerosol Posted January 22, 2015 Report Posted January 22, 2015 Table of ContentsAbstract.........................................................................................................................................................11. Introduction..........................................................................................................................................21.1 Form Validation in HTML 4 ...........................................................................................................21.2 Form Validation in HTML5 ............................................................................................................32. HTML5 Security Concerns.....................................................................................................................42.1 Web Storage Attacks.....................................................................................................................43.1 Session Storage .............................................................................................................................53.2 Local Storage.................................................................................................................................53.3 localStorage API ............................................................................................................................63.3.1 Adding an Item..................................................................................................................63.3.2 Retrieving Items................................................................................................................63.3.3 Removing an Item .............................................................................................................63.3.4 Removing All Items............................................................................................................63.4 Session Storage API.......................................................................................................................73.4.1 Adding An Item..................................................................................................................73.4.2 Retrieving An Item.............................................................................................................73.4.3 Removing An Item.............................................................................................................73.4.4 Removing All Items............................................................................................................73.5 Security Concerns with Web Storage in HTML5 ...........................................................................73.6 Stealing Local Storage Data via XSS ..............................................................................................83.7 Stored DOM Based XSS Attacks....................................................................................................93.8 Example of a DOM Based XSS .....................................................................................................104. WebSockets Attacks ...........................................................................................................................114.1 Security Concerns of WebSockets Attacks..................................................................................114.1.1 Denial of Service Issues...................................................................................................114.1.2 Denial of Service on the Client Side ................................................................................114.1.3 Denial of Service on the Server Side ...............................................................................124.1.4 Data Confidentiality Issues..............................................................................................124.1.5 Cross-Site Scripting Issues in WebSocket........................................................................134.1.6 WebSocket Cross-Site Scripting Proof of Concept..........................................................134.1.7 Proof of Concept of WebSocket XSS ...............................................................................144.1.8 Origin Header..................................................................................................................155. XSS with HTML5 Vectors.....................................................................................................................165.1 Case 1 – Tags Blocked .................................................................................................................165.2 Case 2 - Attribute Context...........................................................................................................165.2.1 Example...........................................................................................................................165.3 Case 3 – Formaction attribute ....................................................................................................186. Cross Origin Resource Sharing (CORS)................................................................................................196.1 What is an Origin?.......................................................................................................................196.2 Crossdomain.xml.........................................................................................................................196.3 What is CORS?.............................................................................................................................206.3.1 Example...........................................................................................................................206.3.2 Security Issue...................................................................................................................206.3.3 Example...........................................................................................................................206.3.4 Example...........................................................................................................................206.3.5 Proof of Concept .............................................................................................................227. GeoLocation API..................................................................................................................................237.1 Introduction ................................................................................................................................237.2 Security Concerns........................................................................................................................237.2.1 Example...........................................................................................................................237.2.2 Proof of Concept .............................................................................................................247.2.3 Chrome............................................................................................................................247.2.4 Firefox..............................................................................................................................248. Client Side RFI Includes.......................................................................................................................268.1 Vulnerability Example .................................................................................................................268.2 Example.......................................................................................................................................278.3 Request .......................................................................................................................................288.4 Safer Example .............................................................................................................................288.5 Open Redirects............................................................................................................................298.5.1 Example...........................................................................................................................299. Cross Window Messaging...................................................................................................................309.1 Sender’s Window........................................................................................................................30Copyright© 2014 RHA InfoSEC. All rights reserved. Page iv9.2 Receiver’s Window......................................................................................................................309.3 Security Concerns........................................................................................................................319.3.1 Origin not being checked ................................................................................................319.3.2 Impact .............................................................................................................................319.3.3 DOM Based XSS...............................................................................................................319.3.4 Vulnerable Code..............................................................................................................3210. Sandboxed Iframes.............................................................................................................................3310.1 Security Concerns........................................................................................................................3311. Offline Applications ............................................................................................................................3411.1 Example.......................................................................................................................................3411.2 Security Concerns........................................................................................................................3512. WebSQL ..............................................................................................................................................3712.1 Security Concerns........................................................................................................................3712.2 SQL Injection ...............................................................................................................................3712.3 Insecure Statement.....................................................................................................................3712.4 Secure Statement........................................................................................................................3812.5 Cross Site Scripting......................................................................................................................3912.5.1 Example...........................................................................................................................4013. Scalable Vector Graphics....................................................................................................................4114. Webworkers........................................................................................................................................4414.1 Creating a Webworker................................................................................................................4414.1.1 Sending/Receiving a Message to/from Webworker.......................................................4414.2 Cross Site Scripting Vulnerability ................................................................................................4614.2.1 Example...........................................................................................................................4614.3 Distributed Denial of Service Attacks..........................................................................................4714.4 Distributed Password Cracking ...................................................................................................5015. Stealing Personal Data Stored With Autocomplete Function ............................................................5215.1 Example: Autocomplete Attribute in Action...............................................................................5216. Scanning Private IP Addresses............................................................................................................5416.1 WebRTC.......................................................................................................................................5417. Security Headers to Enhance Security with HTML5 ...........................................................................5617.1 X- XSS-Protection ........................................................................................................................5617.2 X-Frame-Options.........................................................................................................................5617.3 Strict-Transport-Security.............................................................................................................5717.3.1 Example...........................................................................................................................5817.4 X-Content-Type-Options.............................................................................................................5817.4.1 Example...........................................................................................................................5817.4.2 Example...........................................................................................................................5917.5 Content-Security-Policy ..............................................................................................................5917.5.1 Sample CSP......................................................................................................................60Acknowledgements.....................................................................................................................................61References ..................................................................................................................................................62Read more: http://dl.packetstormsecurity.net/papers/attack/HTML5AttackVectors_RafayBaloch_UPDATED.pdf Quote