-
Notifications
You must be signed in to change notification settings - Fork 8
/
slides.html
1114 lines (941 loc) · 41.1 KB
/
slides.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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Hacking Games in a Hacked Game</title>
<meta name="author" content="(Rusty Wagner, Jordan Wiens)"/>
<link rel="stylesheet" href="./reveal.js/css/reveal.css"/>
<link rel="stylesheet" href="./reveal.js/css/theme/vector35.css" id="theme"/>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = './reveal.js/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<section id="slide-sec-1">
<h2 id="sec-1">Hacking Games <BR>in a <BR>Hacked Game</h2>
<p>
<img src="./images/rusty-hs.jpg" alt="rusty-hs.jpg" /> <img src="./images/jordan-hs.jpg" alt="jordan-hs.jpg" /> <BR>
<img src="./images/wide-black-small.png" alt="wide-black-small.png" />
</p>
<aside class="notes">
<p>
Hi, I'm Jordan – and I'm Rusty
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-2">
<h2 id="sec-2">BIO</h2>
<ul>
<li>CTF junkies</li>
<li>Worked for Raytheon SI</li>
<li>Quit and founded Vector 35 to do "CTF stuff"</li>
</ul>
</section>
</section>
<section>
<section id="slide-sec-3">
<h2 id="sec-3">Is this talk for you?</h2>
<ul>
<li>Did you play Pwn Adventure 3 during Ghost in the Shellcode this year?</li>
<li>Have you ever played a CTF before?</li>
<li>Have you heard of CTFs before?</li>
<li>Have you played or hacked a video game?</li>
</ul>
<aside class="notes">
<p>
Raise your hands and keep them up if any of the following apply to you. If you
still have your hand down, just go ahead and leave now, you're probably not
going to like this talk.
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-4" data-background="./images/confused.jpg" data-background-transition="none">
<h2 id="sec-4">Questions?</h2>
</section>
</section>
<section>
<section id="slide-sec-5">
<h2 id="sec-5">Motivation</h2>
<aside class="notes">
<p>
(3min)
Note that most of these next few slides were skipped in the live presentation.
</p>
<p>
First, a brief note on the motivation for the talk. We're really talking about
the growth of both CTFs and gaming together, and how they're related. So first,
gaming.
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-6">
<h2 id="sec-6">Game Industry Profits</h2>
<div class="figure">
<p><img src="./images/digicapital.png" alt="digicapital.png" />
</p>
</div>
<aside class="notes">
<p>
Here comes the obligatory "Stuff over time" graphs. In this case, money,
specifically annual revenue of the video game industry. It's a $90B (or
maybe more depending on who's doing the counting) industry, and is only
expected to grow.
</p>
<p>
<a href="http://www.gartner.com/newsroom/id/2614915">http://www.gartner.com/newsroom/id/2614915</a> (predicted 100B)
Digi-Capital<sub>Global</sub><sub>Games</sub><sub>Investment</sub><sub>Review</sub><sub>2015</sub><sub>Executive</sub><sub>Summary</sub>.pdf
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-7">
<h2 id="sec-7">Hacking (in?) the Game Industry</h2>
<ul>
<li>As old as the game industry itself</li>
<li>Led to the rise of the demo scene, cracking, trainers, etc</li>
</ul>
<div class="figure">
<p><img src="./images/sanderfocus_animation.gif" alt="sanderfocus_animation.gif" />
</p>
</div>
</section>
<section id="slide-sec-7-1">
<h3 id="sec-7-1">Notable Examples</h3>
<ul>
<li>BNET.D (interop)</li>
<li>Glider (interop)</li>
<li>Diablo 3 Auction House (vuln)</li>
</ul>
<div class="figure">
<p><img src="./images/blizzard.jpg" alt="blizzard.jpg" />
</p>
</div>
</section>
<section id="slide-sec-7-2">
<h3 id="sec-7-2">Code-Signing</h3>
<ul>
<li>Game platforms as early bellwethers</li>
</ul>
<p>
<img src="./images/twilight-hack.jpg" alt="twilight-hack.jpg" />
<img src="./images/nintendo-patch.jpg" alt="nintendo-patch.jpg" />
</p>
<aside class="notes">
<p>
Discussion of how early video game platforms had incentive for strong DRM and
were some of the first to implement code-signing. The hacks from those days
(stealing code-signed objects and repurposing them, for example) remain relevant
today. Instead of a save game file and video game, it's a signed kernel module
with a bug for a priv-esc.
</p>
</aside>
</section>
<section id="slide-sec-7-3">
<h3 id="sec-7-3">TAS Total Control</h3>
<div class="figure">
<p><img src="./images/tasvideos.png" alt="tasvideos.png" />
</p>
</div>
<aside class="notes">
<p>
The Tool-Assisted Speed run scene in gaming has done some pretty amazing
stuff. They started with frame-perfect replays of particular games in emulators,
and have graduated to what they now call "total control" which is not only
arbitrary code execution but implementing some ridiculous payloads on top of it.
</p>
<p>
They started many years ago with "select glitches", abusing state bugs to cause
single byte increments or overwrites to change warp destinations or item types,
for example. These were often found without actually understanding the causes or
implications, but lately they've moved far beyond
</p>
<p>
The Tool-Assisted Speed Run scene has really taken off in recent years. They've
even invented a new term for code execution, "total control", and pulled off
some super neat tricks.
</p>
</aside>
</section>
<section id="slide-sec-7-3-1">
<h4 id="sec-7-3-1">TASBot</h4>
<div class="figure">
<p><img src="./images/tasbot.jpg" alt="tasbot.jpg" />
</p>
</div>
<aside class="notes">
<p>
<a href="https://twitter.com/mrtasbot">https://twitter.com/mrtasbot</a>
</p>
<p>
Hardware platform for physical interaction with games. No longer doing total
control exploits via emulators and software inputs but actually wiring directly
into consoles via gamepad interfaces. (Though sometimes cheating with wiring up
reset buttons as well)
</p>
</aside>
</section>
<section id="slide-sec-7-3-2">
<h4 id="sec-7-3-2">AGDQ 2015</h4>
<div class="figure">
<p><img src="./images/tasbot-twitch.png" alt="tasbot-twitch.png" />
</p>
</div>
<aside class="notes">
<p>
<a href="https://twitter.com/mrtasbot">https://twitter.com/mrtasbot</a>
<a href="http://tasvideos.org/forum/viewtopic.php?t=15787">http://tasvideos.org/forum/viewtopic.php?t=15787</a>
<a href="http://www.reddit.com/r/programming/comments/2rhvsa/tasbot_executes_arbitrary_code_on_the_snes_with/cngj16x">http://www.reddit.com/r/programming/comments/2rhvsa/tasbot_executes_arbitrary_code_on_the_snes_with/cngj16x</a>
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-8" data-state="chart1">
<h2 id="sec-8">Growth of CTFs</h2>
<canvas id="chart1" width="800" height="600"></canvas>
<aside class="notes">
<p>
Who here has played on a team ranked on ctftime?
</p>
<p>
There's also an interesting parallel trend in the CTF world that parallels the
growth of the game industry. Not only are CTFs taking off in popularity, but (as
Chris Eagle discussed here two years ago), there's increasingly real-world
spill-over between them.
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-9">
<h2 id="sec-9">Brief History of CTFs</h2>
<div class="figure">
<p><img src="./images/two-toy-soldiers.jpg" alt="two-toy-soldiers.jpg" />
</p>
</div>
<aside class="notes">
nil
</aside>
</section>
<section id="slide-sec-9-1">
<h3 id="sec-9-1">Basics</h3>
<ul>
<li>Red Team (Jeopardy Style)</li>
<li>Blue Team ("Defensive")</li>
<li>Full Spectrum (or Attack/Defense)</li>
<li>WarGames</li>
</ul>
</section>
<section id="slide-sec-9-2">
<h3 id="sec-9-2">DEF CON</h3>
<ul>
<li>One of the earliest (1996)</li>
<li>Beginning of "modern" A/D (2004/2005)</li>
<li>Kenshoto (2005-2009)</li>
<li>DDTEK (2010-2013)</li>
<li>LegitBS (2014-Current)</li>
</ul>
<aside class="notes">
<p>
One of the oldest events, always been attack-defense, pretty much defined the
modern-attack defense style event.
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-10" data-background="./images/bugs.jpg" data-background-transition="none">
<h2 id="sec-10">Real World Bugs</h2>
<aside class="notes">
<p>
(5min)
</p>
</aside>
</section>
<section id="slide-sec-10-1">
<h3 id="sec-10-1"></h3>
<div class="figure">
<p><img src="./images/phplogo.png" alt="phplogo.png" />
</p>
</div>
<aside class="notes">
<p>
PHP in general is worthy of its own whole talk about CTF challenges
The whipping boy of CTFs (and Stefan Esser), PHP is constantly getting picked
on. You could fill a talk showing nothing but the awful ways PHP is abused and
mocked. A couple of common targets for abuse are:
</p>
</aside>
</section>
<section id="slide-sec-10-1-1">
<h4 id="sec-10-1-1">fighting for equality</h4>
<div class="figure">
<p><img src="./images/php.png" alt="php.png" />
</p>
</div>
<aside class="notes">
<p>
When are two unequal things equal? If you ask PHP, pretty darn often. An empty
array? Why yes, yes it is equal to any random string.
</p>
</aside>
</section>
<section id="slide-sec-10-1-2">
<h4 id="sec-10-1-2">example</h4>
<div class="org-src-container">
<pre class="src src-php"><span style="color: #94BFF3;"><?php</span>
<span style="color: #DCDCCC; background-color: #111111;">$</span><span style="color: #DFAF8F;">key</span> = <span style="color: #CC9393;">"key{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}"</span>;
<span style="color: #DCDCCC; background-color: #111111;">$</span><span style="color: #DFAF8F;">pass</span> = <span style="color: #CC9393;">"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"</span>;
<span style="color: #F0DFAF; font-weight: bold;">if</span> <span style="color: #DCDCCC;">(</span> strcasecmp<span style="color: #BFEBBF;">(</span> <span style="color: #DCDCCC; background-color: #111111;">$</span><span style="color: #DFAF8F;">_GET</span><span style="color: #D0BF8F;">[</span><span style="color: #CC9393;">'pass'</span><span style="color: #D0BF8F;">]</span>, <span style="color: #DCDCCC; background-color: #111111;">$</span><span style="color: #DFAF8F;">pass</span> <span style="color: #BFEBBF;">)</span> == <span style="color: #BFEBBF;">0</span> <span style="color: #DCDCCC;">)</span> <span style="color: #DCDCCC;">{</span>
<span style="color: #F0DFAF; font-weight: bold;">echo</span><span style="color: #BFEBBF;">(</span><span style="color: #DCDCCC; background-color: #111111;">$</span><span style="color: #DFAF8F;">key</span><span style="color: #BFEBBF;">)</span>;
<span style="color: #DCDCCC;">}</span>
<span style="color: #94BFF3;">?></span>
</pre>
</div>
<span class="fragment (-)"><p>
<code>$ curl http://target.ip/?pass[]</code>
</p></span>
<aside class="notes">
<p>
This bug is particularly interesting since multiple CTFs have been bitten by it
unintentionally in their own score infrastructure. You'd think people would have
figured it out by now with all the challenges highlighting how broken it is, but
apparently not.
</p>
<p>
Note though that these two bugs weren't specifically found in a CTF, though many
CTF players were introduced to them through CTFs.
</p>
</aside>
</section>
<section id="slide-sec-10-1-3">
<h4 id="sec-10-1-3">php-cgi</h4>
<p>
<a href="http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823/">eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823</a>
<img src="./images/eindbazen.png" alt="eindbazen.png" />
</p>
<aside class="notes">
<p>
The third bug, however was an actual 0day that came from a CTF. It turns out one
of the problems with a CTF is untended solutions. Sometimes those unintended
solutions result in accidental 0day (more often than you'd think). One such
example was the php-cgi vulnerability that Eindbazen found a few years ago.
</p>
</aside>
</section>
<section id="slide-sec-10-2">
<h3 id="sec-10-2">go go!</h3>
<p>
Bunyan's Revenge (PlaidCTF 2013)
</p>
<div class="org-src-container">
<pre class="src src-C"> <span style="color: #F0DFAF; font-weight: bold;">case</span> ODOTPTR:
cgen<span style="color: #DCDCCC;">(</span>nl, res<span style="color: #DCDCCC;">)</span>;
+ <span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">explicit check for nil if struct is large enough</span>
+ <span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">that we might derive too big a pointer.</span>
+ <span style="color: #F0DFAF; font-weight: bold;">if</span><span style="color: #DCDCCC;">(</span>nl->type->type->width >= unmappedzero<span style="color: #DCDCCC;">)</span> <span style="color: #DCDCCC;">{</span>
+ regalloc<span style="color: #BFEBBF;">(</span>&n1, types<span style="color: #D0BF8F;">[</span>tptr<span style="color: #D0BF8F;">]</span>, res<span style="color: #BFEBBF;">)</span>;
+ gmove<span style="color: #BFEBBF;">(</span>res, &n1<span style="color: #BFEBBF;">)</span>;
+ n1.op = OINDREG;
+ n1.type = types<span style="color: #BFEBBF;">[</span>TUINT8<span style="color: #BFEBBF;">]</span>;
+ n1.xoffset = <span style="color: #BFEBBF;">0</span>;
+ gins<span style="color: #BFEBBF;">(</span>ATESTB, nodintconst<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">0</span><span style="color: #D0BF8F;">)</span>, &n1<span style="color: #BFEBBF;">)</span>;
+ regfree<span style="color: #BFEBBF;">(</span>&n1<span style="color: #BFEBBF;">)</span>;
+ <span style="color: #DCDCCC;">}</span>
<span style="color: #F0DFAF; font-weight: bold;">if</span><span style="color: #DCDCCC;">(</span>n->xoffset != <span style="color: #BFEBBF;">0</span><span style="color: #DCDCCC;">)</span> <span style="color: #DCDCCC;">{</span>
- <span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">explicit check for nil if struct is large enough</span>
- <span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">that we might derive too big a pointer.</span>
- <span style="color: #F0DFAF; font-weight: bold;">if</span><span style="color: #BFEBBF;">(</span>nl->type->type->width >= unmappedzero<span style="color: #BFEBBF;">)</span> <span style="color: #BFEBBF;">{</span>
- regalloc<span style="color: #D0BF8F;">(</span>&n1, types<span style="color: #93E0E3;">[</span>tptr<span style="color: #93E0E3;">]</span>, res<span style="color: #D0BF8F;">)</span>;
- gmove<span style="color: #D0BF8F;">(</span>res, &n1<span style="color: #D0BF8F;">)</span>;
- n1.op = OINDREG;
- n1.type = types<span style="color: #D0BF8F;">[</span>TUINT8<span style="color: #D0BF8F;">]</span>;
- n1.xoffset = <span style="color: #BFEBBF;">0</span>;
- gins<span style="color: #D0BF8F;">(</span>ATESTB, nodintconst<span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">0</span><span style="color: #93E0E3;">)</span>, &n1<span style="color: #D0BF8F;">)</span>;
- regfree<span style="color: #D0BF8F;">(</span>&n1<span style="color: #D0BF8F;">)</span>;
- <span style="color: #BFEBBF;">}</span>
ginscon<span style="color: #BFEBBF;">(</span>optoas<span style="color: #D0BF8F;">(</span>OADD, types<span style="color: #93E0E3;">[</span>tptr<span style="color: #93E0E3;">]</span><span style="color: #D0BF8F;">)</span>, n->xoffset, res<span style="color: #BFEBBF;">)</span>;
</pre>
</div>
<aside class="notes">
<ul class="org-ul">
<li>Real GO developers annoying about security, so…
</li>
</ul>
</aside>
</section>
<section id="slide-sec-10-3">
<h3 id="sec-10-3">Pirate Danbi</h3>
<ul>
<li>TLV protocol</li>
<li>bzip2</li>
<li><a href="https://git.io/vvETK">https://git.io/vvETK</a> (ctf writeup repository)</li>
</ul>
<div class="figure">
<p><img src="./images/beist.png" alt="beist.png" class="fragment (-)" />
</p>
</div>
<aside class="notes">
<p>
Upload some data, decompress it as BZip
</p>
<p>
Interesting to note that in real CTFs, people usually don't look to the real
libraries initially since it would typically make the events take up too much
time – or at least, if we always were investigating things it would.
</p>
</aside>
</section>
<section id="slide-sec-10-4">
<h3 id="sec-10-4">lollerskaters privesc</h3>
<pre class="fragment (appear)">
=============================================================================
FreeBSD-SA-11:05.unix Security Advisory
The FreeBSD Project
Topic: Buffer overflow in handling of UNIX socket addresses
Category: core
Module: kern
Announced: 2011-09-28
Credits: Mateusz Guzik
Affects: All supported versions of FreeBSD.
[...]
II. Problem Description
When a UNIX-domain socket is attached to a location using the bind(2)
system call, the length of the provided path is not validated. Later,
when this address was returned via other system calls, it is copied into
a fixed-length buffer.
Linux uses a larger socket address structure for UNIX-domain sockets
than FreeBSD, and the FreeBSD's linux emulation code did not translate
UNIX-domain socket addresses into the correct size of structure.
</pre>
<aside class="notes">
<p>
<a href="https://www.freebsd.org/security/advisories/FreeBSD-SA-11:05.unix.asc">https://www.freebsd.org/security/advisories/FreeBSD-SA-11:05.unix.asc</a>
</p>
</aside>
</section>
<section id="slide-sec-10-5">
<h3 id="sec-10-5">wireshark 0day</h3>
<div class="figure">
<p><img src="./images/wireshark.jpg" alt="wireshark.jpg" />
</p>
</div>
<aside class="notes">
<p>
<a href="http://reddit.com/r/netsec/comments/xgzt1/defcon_20_ctf_network_raw_pcap_torrent/c5mvehs">http://reddit.com/r/netsec/comments/xgzt1/defcon_20_ctf_network_raw_pcap_torrent/c5mvehs</a>
</p>
</aside>
</section>
<section id="slide-sec-10-6">
<h3 id="sec-10-6">guesspw</h3>
<ul>
<li>challenge from codegate CTF</li>
</ul>
<div class="org-src-container">
<pre class="src src-C">inputfile = realpath<span style="color: #DCDCCC;">(</span>argv<span style="color: #BFEBBF;">[</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">if</span> <span style="color: #DCDCCC;">(</span>strstr<span style="color: #BFEBBF;">(</span>inputfile,<span style="color: #CC9393;">"password"</span><span style="color: #BFEBBF;">)</span> || strstr<span style="color: #BFEBBF;">(</span>inputfile,<span style="color: #CC9393;">"flag"</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>
<span style="color: #DCDCCC;">{</span>
<span style="color: #F0DFAF; font-weight: bold;">goto</span> <span style="color: #BFEBBF;">fail</span>;
<span style="color: #DCDCCC;">}</span>
password = read<span style="color: #DCDCCC;">(</span>open<span style="color: #BFEBBF;">(</span><span style="color: #CC9393;">"/home/guesspw/password"</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
attempt = read<span style="color: #DCDCCC;">(</span>open<span style="color: #BFEBBF;">(</span>inputfile<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">if</span> <span style="color: #DCDCCC;">(</span>strcmp<span style="color: #BFEBBF;">(</span>password,attempt<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>
<span style="color: #DCDCCC;">{</span>
system<span style="color: #BFEBBF;">(</span><span style="color: #CC9393;">"/bin/sh"</span><span style="color: #BFEBBF;">)</span>;
<span style="color: #DCDCCC;">}</span>
</pre>
</div>
</section>
<section id="slide-sec-10-6-1">
<h4 id="sec-10-6-1">guesspw solutions</h4>
<ul>
<li class="fragment -">/dev/fd/3</li>
<li class="fragment -">race condition (TOCTTOU)</li>
<li class="fragment -">MAXSYMLINKS (SYMLOOP_PMAX)</li>
</ul>
<aside class="notes">
<p>
Who knows about MAXSYMLINKS? (BSD), or SYMLOOP_PMAX (POSIX)?
Who knows what the values are commonly defined as? (8, 40)
</p>
</aside>
</section>
<section id="slide-sec-10-7">
<h3 id="sec-10-7">bound payloads / chflags</h3>
<aside class="notes">
<p>
A number of the same techniques Patrick mentioned yesterday in his BADA$$ OS X
Malware talk have been fielded over the past few years in CTFs. Our team
encrypted payloads using unique properties of the target host, for example four
years ago. It makes 'overnight analysis' difficult or impossible.
</p>
<p>
Additionally, the example he cited of chflags settings as well has been used
back when DEF CON was BSD based.
</p>
<p>
Ask me afterward about de-anonymizing hosts on a reverse-NAT through the TCP
timestamp field too.
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-11">
<h2 id="sec-11">Free Tools!</h2>
<div class="figure">
<p><img src="./images/freelabor.jpg" alt="freelabor.jpg" />
</p>
</div>
<aside class="notes">
<p>
Crowd-sourced bugs.
</p>
<p>
Tested SCC as a GitS challenge, measured how long reversing would take for
protection of DEF CON CTF payloads.
</p>
<p>
Want someone to build a free IDA loader for you if one doesn't exist for the
platform you're working on? Just release a CTF challenge on it, and someone will
publish it! Somewhat kidding about this, but it has happened multiple times. I
know multiple people who've released challenges specifically for that, and even
as recently as a few months ago, a Nintendo 3DSX loader for IDA was created
specifically because of a CTF challenge.
</p>
<p>
<a href="https://github.com/0xEBFE/3DSX-IDA-PRO-Loader">https://github.com/0xEBFE/3DSX-IDA-PRO-Loader</a>
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-12">
<h2 id="sec-12">CTF Gaming Challenges</h2>
<p>
(a most certainly non-exhaustive list)
</p>
<aside class="notes">
<p>
(20min)
</p>
<ul class="org-ul">
<li>PPP/GitS one upping / inspiration (explain PPP/GitS!)
</li>
<li>Complexity on the rise
</li>
</ul>
</aside>
</section>
<section id="slide-sec-12-1">
<h3 id="sec-12-1"></h3>
<pre class="example">
________
/ ____/ /_ ____ ____ ________ __ ______ __ _______
/ / / __ \/ __ \/ __ \/ ___/ _ \ / / / / __ \/ / / / ___/
/ /___/ / / / /_/ / /_/ (__ ) __/ / /_/ / /_/ / /_/ / /
\____/_/ /_/\____/\____/____/\___/ \__, /\____/\__,_/_/
____ ___ __ /____/ __
/ __ \_ ______ / | ____/ / _____ ____ / /___ __________
/ /_/ / | /| / / __ \ / /| |/ __ / | / / _ \/ __ \/ __/ / / / ___/ _ \
/ ____/| |/ |/ / / / / / ___ / /_/ /| |/ / __/ / / / /_/ /_/ / / / __/
/_/ |__/|__/_/ /_/ /_/ |_\__,_/ |___/\___/_/ /_/\__/\__,_/_/ \___/
You hold in your hands a map to a vast treasure under the mountain. Your
desire to be rich far outweighs your desire to cooperate with others, so
you are obviously going on this quest alone, with only your wits and your
awesome hacker magic to aid you.
You start your quest on a road just outside of town.
You feel a strange forboding feeling eminating from the map, like it has
an alien magic all of its own.
What do you do?
1) Follow the road toward the mountain.
2) Turn around and ask the mage in town what is going on.
Choice:
</pre>
<aside class="notes">
<p>
Feb 15, 2013
Started the name of the series, "Chose your Pwn Adventure" because you could
solve it multiple ways.
</p>
</aside>
</section>
<section id="slide-sec-12-2">
<h3 id="sec-12-2">Blocky</h3>
<div class="figure">
<p><img src="./images/blocky-02-overview.png" alt="blocky-02-overview.png" />
</p>
</div>
<aside class="notes">
<p>
January 27, 2012
<a href="http://andrewl.dreamhosters.com/blog/2012-02-07/">http://andrewl.dreamhosters.com/blog/2012-02-07/</a>
Explain context of SMT solvers to modern exploitation
</p>
</aside>
</section>
<section id="slide-sec-12-3">
<h3 id="sec-12-3">Blocky</h3>
<div class="figure">
<p><img src="./images/blocky-03-westdetail.png" alt="blocky-03-westdetail.png" />
</p>
</div>
<aside class="notes">
<p>
January 27, 2012
<a href="http://andrewl.dreamhosters.com/blog/2012-02-07/">http://andrewl.dreamhosters.com/blog/2012-02-07/</a>
</p>
</aside>
</section>
<section id="slide-sec-12-4">
<h3 id="sec-12-4">Escape from Minecraft</h3>
<ul>
<li><a href="http://blog.dragonsector.pl/2014/02/ph4quals-escape-from-minecraft.html">Dragon Sector Writeup</a></li>
</ul>
<div class="figure">
<p><img src="./images/logic_overview.png" alt="logic_overview.png" />
</p>
</div>
<aside class="notes">
<p>
PHDays
Jan 25, 2014 - Jan 27, 2014
Four stage, 4-bit shift register
</p>
</aside>
</section>
<section id="slide-sec-12-5">
<h3 id="sec-12-5">Plaid CTF v1</h3>
<div class="figure">
<p><img src="./images/worldmap.png" alt="worldmap.png" />
</p>
</div>
<aside class="notes">
<p>
Apr 27, 2012 - Apr 28, 2012
</p>
</aside>
</section>
<section id="slide-sec-12-6">
<h3 id="sec-12-6">Plaid CTF v2</h3>
<div class="figure">
<p><img src="./images/pctf2013.jpg" alt="pctf2013.jpg" />
</p>
</div>
<aside class="notes">
<p>
April 19, 2013 - April 20, 2013
</p>
</aside>
</section>
<section id="slide-sec-12-7">
<h3 id="sec-12-7">Pwn Adventure (2)</h3>
<video width="960" height="540" controls data-autoplay><source src="media/gits2014teaser-small.mp4" type="video/mp4"></video>
<aside class="notes">
<p>
Jan 17, 2014 — Jan 19, 2014
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-13">
<h2 id="sec-13">Pwn Adventure 3 Demo</h2>
<aside class="notes">
<p>
(30min)
</p>
</aside>
</section>
<section id="slide-sec-13-1">
<h3 id="sec-13-1">Challenges</h3>
<ul>
<li>Unbearable Revenge</li>
<li>Fire and Ice</li>
<li>Overachiever</li>
<li>Until the Cows Come Home</li>
<li>Pirate's Treasure</li>
<li>Blocky's Revenge</li>
<li>Egg Hunt</li>
</ul>
</section>
</section>
<section>
<section id="slide-sec-14">
<h2 id="sec-14">3rd Party Hacks</h2>
<aside class="notes">
<p>
(45min)
</p>
</aside>
</section>
<section id="slide-sec-14-1">
<h3 id="sec-14-1">LD_PRELOAD</h3>
</section>
<section id="slide-sec-14-2">
<h3 id="sec-14-2">Wireshark Dissector</h3>
<ul>
<li><a href="https://github.com/maetrics/wireshark-scripts/blob/master/gits.lua">https://github.com/maetrics/wireshark-scripts/blob/master/gits.lua</a></li>
</ul>
<div class="org-src-container">
<pre class="src src-js">-- gits.lua
-- A wireshark plug-<span style="color: #F0DFAF; font-weight: bold;">in</span> to reverse engineer PwnAdventure <span style="color: #BFEBBF;">3</span> traffic
--
-- http:<span style="color: #5F7F5F;">//</span><span style="color: #7F9F7F; font-style: italic;">pwnadventure.com/ for more information.</span>
--
gits_proto=Proto<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">"GitS"</span>, <span style="color: #CC9393;">"Pwn Adventure 3"</span><span style="color: #DCDCCC;">)</span>
<span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #93E0E3;">addLocation</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">tvb</span>, <span style="color: #DFAF8F;">pos</span>, <span style="color: #DFAF8F;">tree</span><span style="color: #DCDCCC;">)</span>
local branch
branch=tree:add<span style="color: #DCDCCC;">(</span>tvb<span style="color: #BFEBBF;">(</span>pos,<span style="color: #BFEBBF;">12</span><span style="color: #BFEBBF;">)</span>, <span style="color: #CC9393;">"Location"</span><span style="color: #DCDCCC;">)</span>
branch:add<span style="color: #DCDCCC;">(</span>tvb<span style="color: #BFEBBF;">(</span>pos,<span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span>, <span style="color: #CC9393;">"X Coordinates: "</span>..tvb<span style="color: #BFEBBF;">(</span>pos,<span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span>:le_uint<span style="color: #BFEBBF;">()</span><span style="color: #DCDCCC;">)</span>
branch:add<span style="color: #DCDCCC;">(</span>tvb<span style="color: #BFEBBF;">(</span>pos+<span style="color: #BFEBBF;">4</span>,<span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span>, <span style="color: #CC9393;">"Y Coordinates: "</span>..tvb<span style="color: #BFEBBF;">(</span>pos+<span style="color: #BFEBBF;">4</span>,<span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span>:le_uint<span style="color: #BFEBBF;">()</span><span style="color: #DCDCCC;">)</span>
branch:add<span style="color: #DCDCCC;">(</span>tvb<span style="color: #BFEBBF;">(</span>pos+<span style="color: #BFEBBF;">8</span>,<span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span>, <span style="color: #CC9393;">"Z Coordinates: "</span>..tvb<span style="color: #BFEBBF;">(</span>pos+<span style="color: #BFEBBF;">8</span>,<span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span>:le_uint<span style="color: #BFEBBF;">()</span><span style="color: #DCDCCC;">)</span>
end
</pre>
</div>
</section>
<section id="slide-sec-14-3">
<h3 id="sec-14-3">PwnAdventure3Hacks Github</h3>
<ul>
<li>DirectX Overlay</li>
<li><a href="https://github.com/zku/PwnAdventure3Hacks">github.com/zku/PwnAdventure3Hacks</a></li>
</ul>
<div class="figure">
<p><img src="./images/overlay.png" alt="overlay.png" />
</p>
</div>
</section>
<section id="slide-sec-14-4">
<h3 id="sec-14-4">Samurai PwnHax.cpp</h3>
<p>
<a href="https://gist.github.com/dropkickgit/2b65c0ac18506e5c5f0f">gist.github.com/dropkickgit/2b65c0ac18506e5c5f0f</a>
</p>
<div class="org-src-container">
<pre class="src src-C"><span style="color: #94BFF3;">#include</span> <span style="color: #CC9393;"><Windows.h></span>
<span style="color: #94BFF3;">#include</span> <span style="color: #CC9393;"><detours.h></span>
<span style="color: #94BFF3;">#include</span> <span style="color: #CC9393;"><fstream></span>
<span style="color: #94BFF3;">#include</span> <span style="color: #CC9393;"><cstdio></span>
<span style="color: #94BFF3;">#include</span> <span style="color: #CC9393;"><cstdlib></span>
<span style="color: #94BFF3;">#pragma</span> comment<span style="color: #DCDCCC;">(</span>lib, <span style="color: #CC9393;">"detours.lib"</span><span style="color: #DCDCCC;">)</span>
<span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">Classes</span>
<span style="color: #7CB8BB;">class</span> <span style="color: #DFAF8F;">TCPSocket</span> <span style="color: #DCDCCC;">{}</span>;
<span style="color: #7CB8BB;">class</span> <span style="color: #DFAF8F;">Player</span> <span style="color: #DCDCCC;">{}</span>;
<span style="color: #7CB8BB;">class</span> <span style="color: #DFAF8F;">Actor</span> <span style="color: #DCDCCC;">{}</span>;
<span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">Structs</span>
<span style="color: #F0DFAF; font-weight: bold;">struct</span> <span style="color: #7CB8BB;">Vector3</span> <span style="color: #DCDCCC;">{</span>
<span style="color: #7CB8BB;">float</span> <span style="color: #DFAF8F;">x</span>, <span style="color: #DFAF8F;">y</span>, <span style="color: #DFAF8F;">z</span>;
<span style="color: #DCDCCC;">}</span>;
<span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">Typedefs</span>
<span style="color: #F0DFAF; font-weight: bold;">typedef</span> <span style="color: #7CB8BB;">bool</span><span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">__thiscall</span> *<span style="color: #DFAF8F;">SendFunc</span><span style="color: #DCDCCC;">)(</span><span style="color: #7CB8BB;">TCPSocket</span> *, <span style="color: #F0DFAF; font-weight: bold;">const</span> <span style="color: #7CB8BB;">void</span>*, <span style="color: #7CB8BB;">unsigned</span> <span style="color: #7CB8BB;">int</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">typedef</span> <span style="color: #7CB8BB;">bool</span><span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">__thiscall</span> *<span style="color: #DFAF8F;">RecvFunc</span><span style="color: #DCDCCC;">)(</span><span style="color: #7CB8BB;">TCPSocket</span> *, <span style="color: #7CB8BB;">void</span>*, <span style="color: #7CB8BB;">unsigned</span> <span style="color: #7CB8BB;">int</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">typedef</span> <span style="color: #7CB8BB;">bool</span><span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">__thiscall</span> *<span style="color: #DFAF8F;">CanJumpFunc</span><span style="color: #DCDCCC;">)(</span><span style="color: #7CB8BB;">Player</span> *<span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">typedef</span> <span style="color: #7CB8BB;">bool</span><span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">__thiscall</span> *<span style="color: #DFAF8F;">PlayerChatFunc</span><span style="color: #DCDCCC;">)(</span><span style="color: #7CB8BB;">Player</span> *, <span style="color: #F0DFAF; font-weight: bold;">const</span> <span style="color: #7CB8BB;">char</span> *<span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">typedef</span> <span style="color: #7CB8BB;">void</span><span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">__thiscall</span> *<span style="color: #DFAF8F;">PlayerFastTravelFunc</span><span style="color: #DCDCCC;">)(</span><span style="color: #7CB8BB;">Player</span> *, <span style="color: #F0DFAF; font-weight: bold;">const</span> <span style="color: #7CB8BB;">char</span> *, <span style="color: #F0DFAF; font-weight: bold;">const</span> <span style="color: #7CB8BB;">char</span> *<span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">typedef</span> <span style="color: #7CB8BB;">void</span><span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">__thiscall</span> *<span style="color: #DFAF8F;">ActorSetPositionFunc</span><span style="color: #DCDCCC;">)(</span><span style="color: #7CB8BB;">Actor</span> *, <span style="color: #7CB8BB;">Vector3</span> *<span style="color: #DCDCCC;">)</span>;
<span style="color: #5F7F5F;">// </span><span style="color: #7F9F7F; font-style: italic;">Globals</span>
<span style="color: #7CB8BB;">SendFunc</span> <span style="color: #DFAF8F;">RealSend</span>;
<span style="color: #7CB8BB;">RecvFunc</span> <span style="color: #DFAF8F;">RealRecv</span>;
<span style="color: #7CB8BB;">CanJumpFunc</span> <span style="color: #DFAF8F;">RealCanJump</span>;
<span style="color: #7CB8BB;">PlayerChatFunc</span> <span style="color: #DFAF8F;">RealChat</span>;
<span style="color: #7CB8BB;">PlayerFastTravelFunc</span> <span style="color: #DFAF8F;">PlayerFastTravel</span>;
<span style="color: #7CB8BB;">ActorSetPositionFunc</span> <span style="color: #DFAF8F;">ActorSetPosition</span>;
<span style="color: #7CB8BB;">Player</span> *<span style="color: #DFAF8F;">playerObj</span> = <span style="color: #BFEBBF;">0</span>;
<span style="color: #7CB8BB;">TCPSocket</span> *<span style="color: #DFAF8F;">clientSock</span> = <span style="color: #BFEBBF;">0</span>;
std::ofstream DbgLogger;
</pre>
</div>
</section>
</section>
<section>
<section id="slide-sec-15" data-background="./images/bees.jpg" data-background-transition="none">
<h2 id="sec-15">Unintended Bugs</h2>
</section>
<section id="slide-sec-15-1" data-background="./images/theft.jpg" data-background-transition="none">
<h3 id="sec-15-1">OmniTheft</h3>
<aside class="notes">
nil
</aside>
</section>
<section id="slide-sec-15-2" data-background="./images/golden.jpg" data-background-transition="none">
<h3 id="sec-15-2">Bearly Assasinated</h3>
<aside class="notes">
nil
</aside>
</section>
<section id="slide-sec-15-3" data-background="./images/flying.jpg" data-background-transition="none">
<h3 id="sec-15-3">Flying Bodies</h3>
<aside class="notes">
nil
</aside>
</section>
<section id="slide-sec-15-4" data-background="./images/eggs.jpg" data-background-transition="none">
<h3 id="sec-15-4">Eggcellent Solution</h3>
<aside class="notes">
nil
</aside>
</section>
<section id="slide-sec-15-5" data-background="./images/engine.jpg" data-background-transition="none">
<h3 id="sec-15-5">Cheat Engine</h3>
<aside class="notes">
nil
</aside>
</section>
<section id="slide-sec-15-6" data-background="./images/cave.jpg" data-background-transition="none">
<h3 id="sec-15-6">Spelunking</h3>
<aside class="notes">
<p>
Unintended solution killed via testing.
</p>
</aside>
</section>
</section>
<section>
<section id="slide-sec-16">
<h2 id="sec-16">Useful CTF Tools</h2>
<ul>
<li>xortool <a href="https://github.com/hellman/xortool">github.com/hellman/xortool</a></li>
<li>pwntools <a href="https://github.com/Gallopsled/pwntools">github.com/Gallopsled/pwntools</a></li>
<li>qira <a href="https://github.com/BinaryAnalysisPlatform/qira">github.com/BinaryAnalysisPlatform/qira</a> / <a href="http://qira.me">qira.me</a></li>
</ul>
</section>
</section>
<section>
<section id="slide-sec-17">
<h2 id="sec-17">More CTF Resources</h2>
<ul>
<li><a href="https://ctftime.org/">ctftime.org</a> - Events, team scores, writeups</li>
<li><a href="http://captf.com/">captf.com</a> - dump site, mirrors, calendar</li>
<li><a href="http://golden-flags.com/">golden-flags.com</a> - yearly CTF awards</li>
<li><a href="https://github.com/ctfs/">github.com/ctfs</a> - best maintained collection of writeups</li>
</ul>
</section>
</section>
<section>
<section id="slide-sec-18">
<h2 id="sec-18">Meta</h2>
<div class="org-src-container">
<pre class="src src-text">Thanks to:
Dragon Sector Escape from Minecraft Writeup used with Permission:
http://blog.dragonsector.pl/2014/02/ph4quals-escape-from-minecraft.html
Made with:
Spacemacs: https://github.com/syl20bnr/spacemacs