-
Notifications
You must be signed in to change notification settings - Fork 0
/
deconstructing_some_challenges.tex
executable file
·550 lines (446 loc) · 13.8 KB
/
deconstructing_some_challenges.tex
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
\documentclass[]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{listings}
\lstset{
basicstyle=\fontsize{10}{12}\selectfont\ttfamily,
keywordstyle=\color{blue},
breaklines=true,
showtabs=false,
showstringspaces=false,
numberstyle=\tiny\color{mygray}
}
\usepackage{pslatex} % for better PDF on screen
%\usepackage{textcomp}
%\usetheme{AnnArbor}
%\usetheme{Antibes}
%\usetheme{Berkeley}
%\usetheme{Berlin}
%\usetheme{Boadilla}
\usetheme{CambridgeUS}
%\usetheme{Copenhagen}
%\usetheme{Dresden}
%\usetheme{Frankfurt}
%\usetheme{Goettingen}
%\usetheme{Hannover}
%\usetheme{JuanLesPins}
%\usetheme{Marburg}
%\usetheme{Montpellier}
%\usetheme{PaloAlto}
%\usetheme{Pittsburgh}
%\usetheme{Rochester}
%\usetheme{Singapore}
%\usetheme{Szeged}
%\usetheme{Warsaw}
% Force full screen
% \hypersetup{pdfpagemode=FullScreen}
% Navigation menu
\setbeamertemplate{navigation symbols}{%
% \insertslidenavigationsymbol
% \insertframenavigationsymbol
% \insertsubsectionnavigationsymbol
% \insertsectionnavigationsymbol
% \insertdocnavigationsymbol
% \insertbackfindforwardnavigationsymbol
}
% contenu de la page de titre
\title[Deconstructing some challenges from LCSC 2019]{Lëtz Cybersecurity Challenge 2019}
\subtitle{Deconstructing some challenges}
\author{C\'{e}dric Bonhomme}
\institute[CIRCL]{CIRCL - Security Made In Lëtzebuerg}
\date{March 09, 2019}
% \logo{\includegraphics[height=0.5cm]{./images/logo.png}}
\newsavebox{\logoA}
\newsavebox{\logoB}
\savebox{\logoA}{\includegraphics[width=4.0cm]{./images/logo-circl.png}}
\savebox{\logoB}{\includegraphics[width=3.0cm]{./images/logo.png}}
\titlegraphic{%
\raisebox{.5\dimexpr\ht\logoB-\ht\logoA}{\usebox{\logoA}}% raise smaller logo into position
\hspace*{5cm}%
\usebox{\logoB}
}
% End of preamble
\begin{document}
\begin{frame}
\titlepage
\end{frame}
%
% SECTION: What is this workshop about?
%
\section*{What is this workshop about?}
\begin{frame}
\frametitle{What is this workshop about?}
\begin{center}
\begin{itemize}
\item we will present and deconstruct \href{https://github.com/cscluxembourg/vestatech}{some challenges} of the Lëtz Cybersecurity Challenge 2019;
\item in the framework of the ENISA European Cyber Security Challenge;
\item not yet registered ? Let's go: \href{https://vestatech.cybersecuritychallenge.lu}{https://vestatech.cybersecuritychallenge.lu}
\item I won't give you all solutions.
\end{itemize}
\end{center}
\end{frame}
% --------- Summary ---------
\setcounter{tocdepth}{1}
\begin{frame}
\frametitle{Summary at a glance}
\tableofcontents
\end{frame}
\setcounter{tocdepth}{4}
% ----------------------------
%
% SECTION: Network analysis
%
\section{Network analysis}
\begin{frame}
\frametitle{Summary}
\begin{columns}[t]
\begin{column}{5cm}
\tableofcontents[sections={1-3}, currentsection, hideothersubsections]
\end{column}
\begin{column}{5cm}
\tableofcontents[sections={4-5}, currentsection, hideothersubsections]
\end{column}
\end{columns}
\end{frame}
\subsection{Presentation}
\begin{frame}
\frametitle{Presentation}
\framesubtitle{}
\begin{itemize}
\item analysis of network captures;
\item \textbf{Wireshark} is a popular graphical network packet analysis tool;
\item promiscious mode: \texttt{ifconfig eth0 promisc}
\item other interception methods: bridge interception, honeypot.
\end{itemize}
Some tools:
\begin{itemize}
\item Berkeley Packet Filter (BPF), tcpdump, tcpslice;
\item tshark;
\item tcpflow;
\item ssldump;
\item Libpcap libraries, pypacker;
\item visualization tools;
\item ...
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Wireshark}
\framesubtitle{Example: Follow TCP stream}
\begin{center}
\includegraphics[height=6.5cm, width=12.0cm]{./images/Wireshark_follow_tcp_stream.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Wireshark}
\framesubtitle{Example: Search for specific packets}
\begin{itemize}
\item \texttt{frame contains "gift"};
\item \texttt{tcp.port == 443};
\item \texttt{dns.resp.len > 0};
\item \texttt{ip.addr == 52.7.23.87}.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{tcpdump and Berkeley Packet Filter}
\framesubtitle{}
BPF provides a raw interface to data link layers (between link-level driver and the user space).
\bigskip
Example of filter with tcpdump:
\hspace{1cm}matching any TCP traffic with a source port $>$ 1024:\\
\hspace{2cm}\texttt{tcpdump -i eth0 -vv 'tcp[0:2] > 1024'}
\bigskip
You probably already used tcpdump to simply capture a network traffic.
\end{frame}
\begin{frame}
\frametitle{TCP header}
\begin{center}
\includegraphics[width=10.0cm]{./images/TCP-Header.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{IP header}
\begin{center}
\includegraphics[width=10.0cm]{./images/IP-Header.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Little exercice 1}
Filter \textit{destination port less than 1024}
\end{frame}
\begin{frame}
\frametitle{Little exercice 1}
\framesubtitle{Solution}
$tcp[2:2] < 1024$
\end{frame}
\begin{frame}
\frametitle{Little exercice 2}
Filter \textit{source ip equal to destination ip} (classic land attack)
\end{frame}
\begin{frame}
\frametitle{Little exercice 2}
\framesubtitle{Solution}
$ip[12:4] = ip[16:4]$
\vspace{3cm}
You can do really complex queries.
\end{frame}
\subsection{Related challenge}
\begin{frame}
\frametitle{Related challenge}
\begin{itemize}
\item \href{https://github.com/cscluxembourg/vestatech/blob/master/challenges/find-the-author/gift.cap}{Find the author. The line was not secured.} - 1 star (super easy);
\end{itemize}
\bigskip
How did you solved this challenge?
\bigskip
From the feedbacks we got, it seems that the majority of participants used Wireshark.
\end{frame}
\begin{frame}
\frametitle{Solution with Wireshark}
\begin{center}
\includegraphics[height=6.5cm, width=12.0cm]{./images/Wireshark_follow_http_stream.png}
\end{center}
The size of the pcap is almost the size of the payload (and not encrypted).
\end{frame}
\begin{frame}[fragile]
\frametitle{A pythonic solution}
\begin{lstlisting}[language=Python]
#! /usr/bin/python
# -*- coding: utf-8 -*-
# tcpflow -r gift.cap
with open("185.031.040.011.00080-010.008.000.006.37558" ,
"r") as flow:
data = flow.readlines()
for i, line in enumerate(data):
if "Content-Type" in line:
file_type = line.split("/")[1]
with open("result", "w") as result:
result.write("".join(data[i+1:]))
exit()
\end{lstlisting}
\end{frame}
%
% SECTION: Steganography
%
\section{Steganography}
\begin{frame}
\frametitle{Summary}
\begin{columns}[t]
\begin{column}{5cm}
\tableofcontents[sections={1-3}, currentsection, hideothersubsections]
\end{column}
\begin{column}{5cm}
\tableofcontents[sections={4-5}, currentsection, hideothersubsections]
\end{column}
\end{columns}
\end{frame}
\subsection{Presentation}
\begin{frame}[fragile]
\frametitle{What is steganography?}
\framesubtitle{}
\begin{itemize}
\item hiding messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message;
\item a form of security through obscurity;
\item steganography \textbf{is not} cryptography;
\item the message can be hidden in different kind of data: pictures, video, sound, network traffic, printed steganography.
\item different techniques: using metadata, using the red portion of a pixel, Least Significant Bit, etc.
\end{itemize}
\begin{lstlisting}[language=Bash]
$ zip text-to-hide.zip text-to-hide.txt
$ cat song.ogg test-to-hide.zip > song-1.ogg
\end{lstlisting}
\end{frame}
\subsection{Related challenges}
\begin{frame}
\frametitle{Related challenges}
\begin{itemize}
\item \href{https://github.com/cscluxembourg/vestatech/blob/master/challenges/Vesta-asteroid/vesta.png}{Vesta asteroid} - 2 stars.
\item \href{https://github.com/cscluxembourg/vestatech/blob/master/challenges/sergei/Sergei.png}{Sergei, our chief scientific officer} - 3 stars;
\end{itemize}
\bigskip
How did you solved these challenges?
\end{frame}
\begin{frame}
\frametitle{A picture can hide a lot of things...}
\framesubtitle{Background picture of the VestaTech challenge platform}
\begin{center}
\includegraphics[height=6.2cm, width=12.0cm]{./images/vesta.png}
\end{center}
... thankfully, two gentle clues were placed on the VestaTech website.
\end{frame}
\begin{frame}
\frametitle{Detection - Parity steganalysis}
\begin{center}
\includegraphics[height=6.0cm, width=12.0cm]{./images/vesta_steg.png}
\end{center}
Replace odd components by 255 and even by 0.
(132, 247, 123) $\longrightarrow$ (0, 255, 255)
\end{frame}
\begin{frame}
\frametitle{Detection - Parity steganalysis}
\begin{center}
\includegraphics[width=12.0cm]{./images/vesta_steg_zoom.png}
\end{center}
\bigskip
So, now?
\bigskip
Try here with this tool: \href{https://stegano-web.herokuapp.com}{https://stegano-web.herokuapp.com}
\bigskip
Steganalysis is too easy! What can we do? Let put some mess!
\end{frame}
\begin{frame}
\frametitle{Sergei, our chief scientific officer}
\begin{center}
\includegraphics[height=6.0cm, width=10.0cm]{./images/Sergei.png}
\end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{A pythonic solution}
\begin{lstlisting}[language=Bash]
$ wget https://raw.githubusercontent.com/cscluxembourg/vestatech/master/challenges/sergei/Sergei.png
$ stegano-lsb reveal -i Sergei.png
\end{lstlisting}
Not yet the solution but close... Maybe the metadata will help you.\\Just saying.
\bigskip
\begin{lstlisting}[language=Bash]
$ stegano-lsb-set reveal -i Sergei.png -g fibonacci -s 9
\end{lstlisting}
\end{frame}
%
% SECTION: Symetric cryptography
%
\section{Symetric cryptography}
\begin{frame}
\frametitle{Summary}
\begin{columns}[t]
\begin{column}{5cm}
\tableofcontents[sections={1-3}, currentsection, hideothersubsections]
\end{column}
\begin{column}{5cm}
\tableofcontents[sections={4-5}, currentsection, hideothersubsections]
\end{column}
\end{columns}
\end{frame}
\subsection{Presentation}
\begin{frame}
\frametitle{Examples}
\framesubtitle{}
\begin{itemize}
\item César, Vigenère, Hill, Enigma;
\end{itemize}
Bits manipulations:
\begin{itemize}
\item DES, 3DES, AES (Rijndael);
\item Blowfish.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Something fun: Enigma}
\framesubtitle{}
\begin{center}
\includegraphics[height=7.0cm, width=5.5cm]{./images/Enigma_machine.png}
\end{center}
\end{frame}
\subsection{Related challenge}
\begin{frame}
\frametitle{Related challenges}
\framesubtitle{}
\begin{itemize}
\item \href{https://github.com/cscluxembourg/vestatech/tree/master/challenges/the-missing-piece}{A piece of the prototype is missing} - 1 star;
\end{itemize}
\bigskip
How did you solved this challenge?
\end{frame}
\begin{frame}
\frametitle{Solution}
\begin{center}
\includegraphics[width=12.0cm]{./images/Enigma_solution1.png}
\end{center}
\end{frame}
%
% SECTION: Asymetric cryptography
%
\section{Asymetric cryptography}
\begin{frame}
\frametitle{Summary}
\begin{columns}[t]
\begin{column}{5cm}
\tableofcontents[sections={1-3}, currentsection, hideothersubsections]
\end{column}
\begin{column}{5cm}
\tableofcontents[sections={4-5}, currentsection, hideothersubsections]
\end{column}
\end{columns}
\end{frame}
\subsection{Presentation}
\begin{frame}
\frametitle{Who ? When ? How ?}
\framesubtitle{}
\begin{columns}
\begin{column}{5cm}
\begin{center}
\includegraphics[height=6.0cm, width=4.0cm]{./images/Whitfield_Diffie_Royal_Society.jpg}
\end{center}
\end{column}
\begin{column}{5cm}
\begin{itemize}
\item cryptography with public key. Diffie Hellman in 1975
\item keys exchange: Diffie Hellman and Merkle in 1976
\item RSA: Rivest, Shamir, Adleman in 1977
\item PGP (asymetric and symetric): Philip Zimmermann in 1991
\item how? see first RSA related challenge...
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Examples}
\framesubtitle{}
\begin{itemize}
\item Secure Socket Layer, Transport Layer Security;
\item Secure Electronic Transaction;
\item Elliptic curve.
\end{itemize}
\end{frame}
\subsection{Related challenges}
\begin{frame}
\frametitle{Related challenges}
\begin{itemize}
\item \href{https://github.com/cscluxembourg/vestatech/blob/master/challenges/Sergei_forgot_his_formula/wip.py}{Sergei forgot his formula} - 2 stars;
\item \href{https://github.com/cscluxembourg/vestatech/tree/master/challenges/A_key_from_the_past}{A key from the past} - 3 stars.
\item \href{https://github.com/cscluxembourg/vestatech/tree/master/challenges/SecureBox}{SecureBox} - 2 stars. \textit{This time with a real key}.
\end{itemize}
\bigskip
How did you solved these challenges?
\end{frame}
\begin{frame}
\frametitle{Sergei forgot his formula}
\framesubtitle{Do you know how is generated a RSA key?}
\begin{center}
\includegraphics[height=6.2cm, width=12.0cm]{./images/RSA-algo-key-generation.png}
\end{center}
\href{https://en.wikipedia.org/wiki/RSA_(cryptosystem)\#Decryption}{Super easy} ;-)
\end{frame}
\begin{frame}
\frametitle{A key from the past}
\framesubtitle{A weakness of RSA: the \textit{quality} of your key}
\begin{center}
\includegraphics[height=6.2cm, width=12.0cm]{./images/RSA-weak-prime-factors.png}
\end{center}
And random implementation flaws...
\end{frame}
%
% SECTION: End of the presentation
%
\section*{End of the presentation}
\begin{frame}
\frametitle{End of the presentation}
\framesubtitle{Q and A}
\begin{center}
\begin{itemize}
\item Thanks for listening.
\item Which challenge did you enjoyed the most?
\item What's your opinion? Do you want more difficult challenges for the next year?
\end{itemize}
\end{center}
\end{frame}
\end{document}