forked from hakimel/reveal.js
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjopenspace2016.html
270 lines (240 loc) · 15.9 KB
/
jopenspace2016.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Spring Security, 2016</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/clock.css">
<link rel="stylesheet" href="css/theme/night.css" id="theme">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<style>
.documentation {
font-family: sans-serif;
color: #fff;
display: inline-block;
font-weight: 100;
text-align: center;
position:absolute;
margin: 15px;
top:0;
right:100px;
z-index: 100;
}
.documentation > div{
padding: 10px;
border-radius: 3px;
background: #343434;
display: inline-block;
}
.documentation div > a {
color: #cecece;
text-decoration: none;
padding: 10px;
border-radius: 3px;
background: #252525;
display: inline-block;
}
.documentation > div:hover {
background: #8b8b8b;
}
.documentation div:hover > a {
background: #606060;
}
</style>
</head>
<body>
<div style="display: block; position: absolute; bottom: 40px; left: 50%; margin-left: -70px; z-index: 20;">
<a target="_blank" href="http://www.fg.cz" target="_blank"><img src="img/jopenspace2013/FG_Forrest_neg.png" width="140px"/></a>
</div>
<div class="reveal">
<div class="slides">
<!-- INTRO -->
<section data-background="img/jopenspace2016/breaking_toys.jpg">
<h1 style="color: black;">Když vám rozbíjejí hračky</h1>
<p style="margin-top: 10em">
<small style="color: #333333">Jan <a style="color: #444444" href="http://www.twiter.com/novoj">@Novoj</a> Novotný</small>
</p>
<h4 style="color:black">Sledujte prezentaci spolu se mnou<br/><a style="color: #444444" href="http://novoj.github.io/reveal.js/jopenspace2016.html">http://novoj.github.io/reveal.js/jopenspace2016.html</a></h4>
</section>
<!-- Client input -->
<section data-background="img/backgrounds/black.jpg">
<h1>Už na škole nás učili</h1>
<h3>nevěřit ničemu, co přichází z klienta</h3>
<ul>
<li>parametry / fieldy</li>
<li>http hlavičky</li>
<li>názvy souborů<br>(to, že to nemůže existovat, ještě neznamená,<br>že vám to nemůžou uploadnout)</li>
<li>soubory (injected code)</li>
</ul>
<p><strong>Obecně:</strong></p>
<ul>
<li>co není třeba předávat přes klienta radši nepředávat</li>
<li>používat ideálně hashe místo idček (enumerace)</li>
<li>vstupy validovat</li>
</ul>
</section>
<section data-background="img/backgrounds/black.jpg">
<h1>Děláme to dostatečně?</h1>
</section>
<section data-background="img/backgrounds/black.jpg">
<h1>Cross Site Scripting (XSS)</h1>
<ul>
<li>reflected XSS na kradení hesel (<a target="_blank" href="https://www.youtube.com/watch?v=Td0LeWtNSVI&t=21m00s">Kafemlejnek.TV</a>)</li>
<li>ovládání klienta (<a target="_blank" href="https://www.youtube.com/watch?v=Td0LeWtNSVI&t=24m43s">Kafemlejnek.TV</a>)</li>
<li>detekce navštívených stránek a historie vyhledávání (<a target="_blank" href="http://lcamtuf.coredump.cx/css_calc/">popis</a>,
<a target="_blank" href="http://lcamtuf.coredump.cx/whack/">demo</a>)</li>
<li>scanning a útoky na zařízení ve vnitřní síti
(<a target="_blank" href="https://allodox.wordpress.com/2012/04/21/javascript-based-network-scanners">popis</a>, <a target="_blank" href="http://www.andlabs.org/tools/jsrecon.html">demo</a>)</li>
</ul>
<p><strong>Co s tím?</strong></p>
<ul>
<li>Content Security Policy FTW</li>
</ul>
</section>
<section data-background="img/backgrounds/black.jpg">
<h1>Nebezpečí v URL</h1>
<ul>
<li>vložený obrázek za HTTP autentizací (<a
href="http://www.soom.cz/clanky/1161--Kradez-prihlasovacich-udaju-obrazkem-WWW-Authenticate-exploit">popis</a>)</li>
<li>HTML v odkazu (<a target="_blank" href="data:text/html, <html contenteditable>" target="_new">Notepad</a>), útok na přihlašování
<a target="_blank" href="https://thehackerblog.com/dataurize/chrome/index.html">demo</a>, <a target="_blank" href="https://thehackerblog.com/dataurization-of-urls-for-a-more-effective-phishing-campaign/">popis</a></li>
</ul>
</section>
<section data-background="img/backgrounds/black.jpg">
<section data-background="img/backgrounds/black.jpg">
<h1>XML zranitelnosti</h1>
<pre><code data-trim>
<?xml version="1.0"?>
<!DOCTYPE lolz [
<!ENTITY lol "lol">
<!ENTITY lol2 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
<!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;">
<!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;">
<!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;">
<!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;">
<!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">
]>
<lolz>&lol9;</lolz></code></pre>
<ul>
<li>Million LOLs (<a target="_blank" href="https://cytinus.wordpress.com/2011/07/26/37/">popis</a>)</li>
<li>XSS injekce přes data v XML</li>
<li>DOS serveru - čtení z file:///dev/random</li>
<li>DOS serveru - neuzavřeným streamem externího DTD</li>
<li>include lokálního / externího souboru</li>
<li>získání adresářové struktury v Java aplikaci (<a href="http://blog.h3xstream.com/2014/06/identifying-xml-external-entity.html">útok na Runkeeper (polovina roku 2014) s použitím Gopher protokolu</a>,
<a target="_blank" href="http://lab.onsec.ru/2014/06/xxe-oob-exploitation-at-java-17.html">novější typ útoku s pomocí FTP</a>)</li>
<li>XML hacky v místech, kde byste je nečekali:
<a target="_blank" href="http://www.soom.cz/clanky/1198--MS-Office-DoS-a-mozna-i-neco-vic">Outlook</a>,
<a target="_blank" href="https://lwn.net/Articles/690411/">PDF</a>,
<a target="_blank" href="https://www.dropbox.com/s/wkba6f0wrax0wr8/xxe.mp4?dl=0">SVG</a>,
<a target="_blank" href="https://www.youtube.com/watch?v=qzbafFSFhtU">DOCX</a>
</li>
<li>instalace nebezpečného WAR pomocí jar:// protokolu (<a target="_blank" href="http://www.pwntester.com/blog/2013/11/28/abusing-jar-downloads/">Jar protocol abuse</a>,
<a target="_blank" href="https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_a_Directory_or_WAR_by_URL">Tomcat manager (cat tomcat-users.xml by XXE)</a>)</li>
</ul>
<p><strong>Skvělý rozbor XXE</strong> se nachází na <a target="_blank" href="http://www.soom.cz/clanky/1137--XXE-a-dalsi-XML-zranitelnosti">SOOM.cz</a></p>
<!--
- mitigation: https://blog.compass-security.com/2012/08/secure-xml-parser-configuration/
- billion LOLS je stále problematický: https://java.net/jira/browse/JERSEY-1714 / http://blog.bdoughan.com/2011/03/preventing-entity-expansion-attacks-in.html
- přes PDF parser: https://lwn.net/Articles/690411/ :)
- http://t.co/jBR0NKST -> https://www.youtube.com/watch?v=7GtPgavI-sI
- http://10-99.blogspot.cz/2013/02/definition-xml-external-entityxxe-is.html
- http://2013.appsecusa.org/2013/wp-content/uploads/2013/12/WhatYouDidntKnowAboutXXEAttacks.pdf
- Hack přes SVG / DOCX : https://vulners.com/hackerone/H1:104620
- Proxované spouštění kódu
- např. domain check ... cokoliv co se spouští na příkazové řádce nebo HTTP
-->
</section>
<section data-background="img/backgrounds/black.jpg">
<h1>A co teda s tím?</h1>
<div style="display: block; clear: both">
<img src="img/jopenspace2016/xxe-0.png" style="width: 45%; margin: 2%">
<img src="img/jopenspace2016/xxe-1.png" style="width: 45%; margin: 2%">
</div>
<div style="text-align: center"><a target="_blank" href="http://t.co/jBR0NKST">Source</a>,
<a target="_blank" href="https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Prevention_Cheat_Sheet">OWASP</a>,
<a target="_blank" href="https://www.blackhat.com/docs/us-15/materials/us-15-Wang-FileCry-The-New-Age-Of-XXE-java-wp.pdf">BlackHat</a></div>
</section>
</section>
<section data-background="img/backgrounds/black.jpg">
<h1>ReDos</h1>
<ul>
<li>plno lidí RegExům nerozumí</li>
<li>plno vývojářů RegExy kopírují aniž by jim rozuměli</li>
</ul>
<p><em>Ukázka <a target="_blank" href="http://regexlib.com/REDetails.aspx?regexp_id=1757">RegExu na validaci e-mailu</a>:</em></p>
<pre><code data-trim data-noescape>^([a-zA-Z0-9])(([\-.]|[_]+)?([a-zA-Z0-9]+))*(@){1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a-z]{2,3}[.]{1}[a-z]{2,3}))$</code></pre>
<div class="fragment">
<pre><code data-trim data-noescape>^([a-zA-Z0-9])<mark>(([\-.]|[_]+)?([a-zA-Z0-9]+))*</mark>(@){1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a-z]{2,3}[.]{1}[a-z]{2,3}))$</code></pre>
<pre><code>[email protected] //ok
aaaaaaaaaaaaaaaaaaaaaaaa! //DOS</code></pre> OK
</div>
<ul>
<li><a target="_blank" href="https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS">detailní popis</a></li>
<li><a target="_blank" href="https://code.google.com/archive/p/saferegex/">Safe RegEx tester</a>, <a target="_blank" href="https://github.com/substack/safe-regex">totéž v Node.js</a></li>
<li><a target="_blank" href="http://www.ocpsoft.org/regex/how-to-interrupt-a-long-running-infinite-java-regular-expression/">Circuit breaker v Javě</a></li>
<li><a target="_blank" href="https://bugs.openjdk.java.net/browse/JDK-8140212">Pro JDK is not an issue :(</a></li>
</ul>
</section>
<!-- OUTRO -->
<section data-background="img/backgrounds/brown.jpg">
<img src="img/jopenspace2016/stay_alert.jpg" style="float: left">
<div style="display: inline-block">
<h2>Děkuji za pozornost</h2>
<p><strong>Odkazy:</strong></p>
<ul>
<li><a target="_blank" href="http://www.soom.cz/lexikon-webovych-zranitelnosti">SOOM.cz</a></li>
<li><a target="_blank" href="https://www.owasp.org/index.php/Main_Page">OWASP</a></li>
<li><a target="_blank" href="http://2013.appsecusa.org/2013/wp-content/uploads/2013/12/WhatYouDidntKnowAboutXXEAttacks.pdf">Rozbor XXE útoků (anglicky)</a></li>
<li><a target="_blank" href="http://www.oracle.com/technetwork/java/seccodeguide-139067.html">Bezpečnostní doporučení Oracle</a></li>
</ul>
<p>Kontakt <a target="_blank" href="https://www.twitter.com/novoj">@Novoj</a> or <a target="_blank" href="mailto:[email protected]">[email protected]</a></p>
</div>
</section>
</div>
<!-- REFERENCE: http://stackoverflow.com/questions/549/the-definitive-guide-to-form-based-website-authentication -->
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/clock.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
controls: true,
progress: true,
history: true,
center: true,
width: 1200,
height: 900,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
var deadline = new Date(Date.parse(new Date()) + 10 * 60 * 1000);
initializeClock(deadline);
</script>
</body>
</html>