author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Wed, 07 Oct 2015 10:14:04 +0100 | |
changeset 398 | b183036ba675 |
parent 396 | 2f4296a0ab21 |
child 400 | f05368d007dd |
permissions | -rw-r--r-- |
28 | 1 |
\documentclass[dvipsnames,14pt,t]{beamer} |
196
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
2 |
\usepackage{../slides} |
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
3 |
\usepackage{../graphics} |
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
4 |
\usepackage{../langs} |
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
5 |
|
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
6 |
\setmonofont[Scale=.88]{Consolas} |
152
0c62ec6dc691
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
115
diff
changeset
|
7 |
\newfontfamily{\consolas}{Consolas} |
28 | 8 |
|
196
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
9 |
\hfuzz=220pt |
111
677179c76e35
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
105
diff
changeset
|
10 |
|
28 | 11 |
% beamer stuff |
381
036a762b02cf
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
239
diff
changeset
|
12 |
\renewcommand{\slidecaption}{SEN 03, King's College London} |
28 | 13 |
|
14 |
||
15 |
\begin{document} |
|
16 |
||
17 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
196
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
18 |
\begin{frame}[t] |
28 | 19 |
\frametitle{% |
20 |
\begin{tabular}{@ {}c@ {}} |
|
21 |
\\ |
|
381
036a762b02cf
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
239
diff
changeset
|
22 |
\LARGE Security Engineering (3)\\[-3mm] |
28 | 23 |
\end{tabular}}\bigskip\bigskip\bigskip |
24 |
||
196
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
25 |
\normalsize |
28 | 26 |
\begin{center} |
27 |
\begin{tabular}{ll} |
|
28 |
Email: & christian.urban at kcl.ac.uk\\ |
|
111
677179c76e35
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
105
diff
changeset
|
29 |
Office: & S1.27 (1st floor Strand Building)\\ |
105
40c51038c9e4
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
90
diff
changeset
|
30 |
Slides: & KEATS (also home work is there) |
28 | 31 |
\end{tabular} |
32 |
\end{center} |
|
33 |
||
196
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
34 |
\end{frame} |
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
35 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
28 | 36 |
|
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
37 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
38 |
\begin{frame}[c] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
39 |
\frametitle{\Large Buffer Overflow Attacks} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
40 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
41 |
\begin{center} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
42 |
\begin{columns}[b] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
43 |
\begin{column}{.4\textwidth} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
44 |
\centering |
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
45 |
\includegraphics[scale=0.3]{../pics/barrier.jpg}\\ |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
46 |
lectures so far |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
47 |
\end{column} |
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
48 |
\begin{column}{.4\textwidth} |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
49 |
\centering |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
50 |
\includegraphics[scale=0.32]{../pics/trainwreck.jpg}\\ |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
51 |
today |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
52 |
\end{column} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
53 |
\end{columns} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
54 |
\end{center} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
55 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
56 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
57 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
58 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
59 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
60 |
\begin{frame}[c] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
61 |
\frametitle{Smash the Stack for Fun\ldots} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
62 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
63 |
\begin{itemize} |
392
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
64 |
\item \alert{\bf Buffer Overflow Attacks (BOAs)} or\\ |
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
65 |
{\bf Smashing the Stack Attacks}\medskip |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
66 |
|
392
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
67 |
\item unfortunately one of the most popular attacks\\ |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
68 |
($>$ 50\% of security incidents reported at CERT are related |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
69 |
to buffer overflows) |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
70 |
\begin{flushright} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
71 |
\small\url{http://www.kb.cert.org/vuls} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
72 |
\end{flushright} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
73 |
\medskip |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
74 |
\item made popular in an article from 1996 by Elias Levy |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
75 |
(also known as Aleph One):\\ |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
76 |
\begin{center} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
77 |
{\bf ``Smashing The Stack For Fun and Profit''} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
78 |
\end{center}\medskip |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
79 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
80 |
\begin{flushright} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
81 |
\small\url{http://phrack.org/issues/49/14.html} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
82 |
\end{flushright} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
83 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
84 |
\end{itemize} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
85 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
86 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
87 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
88 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
89 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
90 |
\begin{frame}[c] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
91 |
\frametitle{A Long Printed ``Twice''} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
92 |
\mbox{}\\[-10mm] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
93 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
94 |
\footnotesize |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
95 |
\lstinputlisting[language=C,xleftmargin=4mm]{../progs/C0.c} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
96 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
97 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
98 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
99 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
100 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
101 |
\begin{frame}[c] |
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
102 |
\frametitle{Printing Out ``Zombies''} |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
103 |
\mbox{}\\[-10mm] |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
104 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
105 |
\footnotesize |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
106 |
\lstinputlisting[language=C,xleftmargin=4mm]{../progs/C1.c} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
107 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
108 |
\end{frame} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
109 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
110 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
111 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
112 |
\begin{frame}[c] |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
113 |
\frametitle{A ``Login'' Function (1)} |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
114 |
\mbox{}\\[-10mm] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
115 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
116 |
\footnotesize |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
117 |
\lstinputlisting[language=C,xleftmargin=4mm]{../progs/C2a.c} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
118 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
119 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
120 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
121 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
122 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
123 |
\begin{frame}[c] |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
124 |
\frametitle{A ``Login'' Function (2)} |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
125 |
\mbox{}\\[-10mm] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
126 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
127 |
\footnotesize |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
128 |
\lstinputlisting[language=C,xleftmargin=-3mm]{../progs/C2b.c} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
129 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
130 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
131 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
132 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
133 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
134 |
\begin{frame}[c] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
135 |
\frametitle{What the Hell Is Going On?} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
136 |
|
216
38718062709a
updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
137 |
\begin{itemize} |
38718062709a
updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
138 |
\item Let's start with a very simple program: |
38718062709a
updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
139 |
\end{itemize} |
38718062709a
updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
211
diff
changeset
|
140 |
|
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
141 |
\lstinputlisting[language=C,xleftmargin=4mm]{../progs/example1.c} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
142 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
143 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
144 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
145 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
146 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
147 |
\begin{frame}[c] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
148 |
\frametitle{Memory} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
149 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
150 |
\begin{itemize} |
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
151 |
\item each process will get a chunk of memory that is |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
152 |
organised as follows: |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
153 |
\end{itemize} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
154 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
155 |
\begin{center} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
156 |
\begin{tikzpicture}[scale=0.8] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
157 |
%\draw[step=1cm] (-3,-3) grid (3,3); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
158 |
\draw[line width=1mm] (-2, -3) rectangle (2,3); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
159 |
\draw[line width=1mm] (-2,1) -- (2,1); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
160 |
\draw[line width=1mm] (-2,-1) -- (2,-1); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
161 |
\draw (0,2) node {\large\tt text}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
162 |
\draw (0,0) node {\large\tt heap}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
163 |
\draw (0,-2) node {\large\tt stack}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
164 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
165 |
\draw (-2.7,3) node[anchor=north east] {\tt\begin{tabular}{@{}l@{}}lower\\ address\end{tabular}}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
166 |
\draw (-2.7,-3) node[anchor=south east] {\tt\begin{tabular}{@{}l@{}}higher\\ address\end{tabular}}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
167 |
\draw[->, line width=1mm] (-2.5,3) -- (-2.5,-3); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
168 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
169 |
\draw (2.7,-2) node[anchor=west] {\tt grows}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
170 |
\draw (2.7,-3) node[anchor=south west] {\tt\footnotesize older}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
171 |
\draw (2.7,-1) node[anchor=north west] {\tt\footnotesize newer}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
172 |
\draw[|->, line width=1mm] (2.5,-3) -- (2.5,-1); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
173 |
\end{tikzpicture} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
174 |
\end{center} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
175 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
176 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
177 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
178 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
179 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
180 |
\begin{frame}[c] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
181 |
\frametitle{The Stack} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
182 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
183 |
\begin{textblock}{7}(1,1) |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
184 |
\begin{tikzpicture}[scale=0.8] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
185 |
%\draw[step=1cm] (-3,-1) grid (3,8); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
186 |
\draw[gray!20,fill=gray!20] (-1, 0) rectangle (1,-1); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
187 |
\draw[line width=1mm] (-1,-1.2) -- (-1,7.4); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
188 |
\draw[line width=1mm] ( 1,-1.2) -- ( 1,7.4); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
189 |
\draw (0,-1) node[anchor=south] {\tt main}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
190 |
\draw[line width=1mm] (-1,0) -- (1,0); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
191 |
\draw (0,0) node[anchor=south] {\tt arg$_3$=3}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
192 |
\draw[line width=1mm] (-1,1) -- (1,1); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
193 |
\draw (0,1) node[anchor=south] {\tt arg$_2$=2}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
194 |
\draw[line width=1mm] (-1,2) -- (1,2); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
195 |
\draw (0,2) node[anchor=south] {\tt arg$_1$=1}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
196 |
\draw[line width=1mm] (-1,3) -- (1,3); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
197 |
\draw (0,3.1) node[anchor=south] {\tt ret}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
198 |
\draw[line width=1mm] (-1,4) -- (1,4); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
199 |
\draw (0,4) node[anchor=south] {\small\tt last sp}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
200 |
\draw[line width=1mm] (-1,5) -- (1,5); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
201 |
\draw (0,5) node[anchor=south] {\tt buf$_1$}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
202 |
\draw[line width=1mm] (-1,6) -- (1,6); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
203 |
\draw (0,6) node[anchor=south] {\tt buf$_2$}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
204 |
\draw[line width=1mm] (-1,7) -- (1,7); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
205 |
\draw (2,6.1) node[anchor=south] {\code{$esp}}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
206 |
\draw[<-,line width=0.5mm] (1.1,7) -- (2.5,7); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
207 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
208 |
\draw[->,line width=0.5mm] (1,4.5) -- (1.8,4.5) -- (1.8, 0) -- (1.1,0); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
209 |
\draw[->,line width=0.5mm] (1,3.5) -- (2.5,3.5); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
210 |
\draw (2.6,3.1) node[anchor=south west] {\tt back to main()}; |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
211 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
212 |
\draw[->,red,line width=2mm] (2.5,0.1) -- (4.2,0.1); |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
213 |
\end{tikzpicture} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
214 |
\end{textblock} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
215 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
216 |
\begin{textblock}{7}(6.4,8) |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
217 |
\begin{bubble}[6.8cm] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
218 |
\footnotesize |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
219 |
\lstinputlisting[language=C,xleftmargin=5mm]{../progs/example1.c} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
220 |
\end{bubble} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
221 |
\end{textblock} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
222 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
223 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
224 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
225 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
226 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
227 |
\begin{frame}[c] |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
228 |
\frametitle{Behind the Scenes} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
229 |
|
223
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
230 |
\only<2->{ |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
231 |
\begin{textblock}{7}(1,0.6) |
223
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
232 |
\begin{bubble}[6.8cm] |
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
233 |
\footnotesize |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
234 |
\lstinputlisting[language=C, |
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
235 |
xleftmargin=5mm, |
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
236 |
belowskip=-1mm, |
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
237 |
aboveskip=-1mm]{../progs/example1.c} |
223
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
238 |
\end{bubble} |
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
239 |
\end{textblock}} |
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
240 |
|
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
241 |
\only<2>{ |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
242 |
\begin{textblock}{7}(0.5,6.6) |
223
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
243 |
\footnotesize |
226
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
244 |
\lstinputlisting[language={[x86masm]Assembler},morekeywords={movl},xleftmargin=5mm,numbers=none]{../progs/example1a.s} |
223
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
245 |
\end{textblock}} |
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
246 |
|
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
247 |
\only<3>{ |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
248 |
\begin{textblock}{7}(0.5,6.6) |
223
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
249 |
\footnotesize |
226
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
250 |
\lstinputlisting[language={[x86masm]Assembler},morekeywords={movl,movw},xleftmargin=5mm,numbers=none]{../progs/example1b.s} |
223
2bc8309203c8
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
222
diff
changeset
|
251 |
\end{textblock}} |
211
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
252 |
|
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
253 |
\end{frame} |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
254 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
e6e160c7ea33
added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
206
diff
changeset
|
255 |
|
196
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
256 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
22f027da67ec
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
152
diff
changeset
|
257 |
\begin{frame}[c] |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
258 |
\frametitle{Overwriting the Stack} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
259 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
260 |
\begin{textblock}{7}(1,2) |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
261 |
\begin{tikzpicture}[scale=0.8] |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
262 |
%\draw[step=1cm] (-3,-1) grid (3,8); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
263 |
\draw[gray!20,fill=gray!20] (-1, 0) rectangle (1,-1); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
264 |
\draw[line width=1mm] (-1,-1.2) -- (-1,6.4); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
265 |
\draw[line width=1mm] ( 1,-1.2) -- ( 1,6.4); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
266 |
\draw (0,-1) node[anchor=south] {\tt main}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
267 |
\draw[line width=1mm] (-1,0) -- (1,0); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
268 |
\draw (0,0) node[anchor=south] {\tt arg$_3$=3}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
269 |
\draw[line width=1mm] (-1,1) -- (1,1); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
270 |
\draw (0,1) node[anchor=south] {\tt arg$_2$=2}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
271 |
\draw[line width=1mm] (-1,2) -- (1,2); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
272 |
\draw (0,2) node[anchor=south] {\tt arg$_1$=1}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
273 |
\draw[line width=1mm] (-1,3) -- (1,3); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
274 |
\draw (0,3.1) node[anchor=south] {\tt ret}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
275 |
\draw[line width=1mm] (-1,4) -- (1,4); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
276 |
\draw (0,4) node[anchor=south] {\small\tt last sp}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
277 |
\draw[line width=1mm] (-1,5) -- (1,5); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
278 |
\draw (0,5) node[anchor=south] {\tt buf}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
279 |
\draw[line width=1mm] (-1,6) -- (1,6); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
280 |
\draw (2,5.1) node[anchor=south] {\code{$esp}}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
281 |
\draw[<-,line width=0.5mm] (1.1,6) -- (2.5,6); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
282 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
283 |
\draw[->,line width=0.5mm] (1,4.5) -- (1.8,4.5); |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
284 |
\draw (2.5,4.1) node[anchor=south] {\code{BBBB}}; |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
285 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
286 |
\draw[->,line width=0.5mm] (1,3.5) -- (2.5,3.5); |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
287 |
\draw (2.6,3.1) node[anchor=south west] {\tt jump to \code{\\x080483f4}}; |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
288 |
\end{tikzpicture} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
289 |
\end{textblock} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
290 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
291 |
\begin{textblock}{7}(1,13.5) |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
292 |
\code{char buf[8] = "AAAAAAAABBBB\\xf4\\x83\\x04\\x08\\x00"} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
293 |
\end{textblock} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
294 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
295 |
\end{frame} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
296 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
297 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
298 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
299 |
\begin{frame}[c] |
398
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
300 |
\frametitle{C-Library Functions} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
301 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
302 |
\begin{itemize} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
303 |
\item copy everything up to the zero byte |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
304 |
\end{itemize}\medskip |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
305 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
306 |
{\small |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
307 |
\lstinputlisting[language=C,numbers=none]{../progs/app5.c}} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
308 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
309 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
310 |
\end{frame} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
311 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
312 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
313 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
314 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
315 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
316 |
\begin{frame}[c] |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
317 |
\frametitle{Payloads} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
318 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
319 |
\begin{itemize} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
320 |
\item the idea is that you store some code in the buffer (the payload) |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
321 |
\item you then override the return address to execute this payload\medskip |
398
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
322 |
\item normally you want to start a shell\pause |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
323 |
\item difficulty is to guess the right place where to ``jump'' |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
324 |
\end{itemize} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
325 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
326 |
\end{frame} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
327 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
328 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
329 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
221
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
330 |
\begin{frame}[t] |
239
0db764174afb
updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
226
diff
changeset
|
331 |
\frametitle{Starting a Shell} |
221
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
332 |
|
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
333 |
\small |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
334 |
\lstinputlisting[language=C,numbers=none,xleftmargin=-6mm]{../progs/o1.c} |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
335 |
|
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
336 |
\begin{textblock}{7}(5,7.5) |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
337 |
\begin{bubble}[7cm] |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
338 |
\lstinputlisting[language=C,numbers=none,xleftmargin=-0mm]{../progs/shell.c} |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
339 |
\end{bubble} |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
340 |
\end{textblock} |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
341 |
|
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
342 |
\end{frame} |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
343 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
344 |
|
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
345 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
346 |
\begin{frame}[c] |
221
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
347 |
\frametitle{Avoiding \texttt{$\backslash$x00}} |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
348 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
349 |
\begin{itemize} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
350 |
\item another difficulty is that the code is not allowed to contain \texttt{$\backslash$x00}: |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
351 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
352 |
\begin{center} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
353 |
\texttt{xorl \%eax, \%eax} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
354 |
\end{center} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
355 |
\end{itemize}\bigskip\bigskip |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
356 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
357 |
{\small |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
358 |
\lstinputlisting[language=C,numbers=none]{../progs/app5.c}} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
359 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
360 |
\end{frame} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
361 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
362 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
363 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
364 |
\begin{frame}[c] |
221
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
365 |
\frametitle{Overflow.c} |
222
81f9f0eb1180
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
221
diff
changeset
|
366 |
\mbox{}\\[-10mm] |
221
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
367 |
|
222
81f9f0eb1180
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
221
diff
changeset
|
368 |
\small |
81f9f0eb1180
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
221
diff
changeset
|
369 |
\lstinputlisting[language=C,xleftmargin=-4mm,numbers=none]{../progs/overflow.c} |
221
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
370 |
|
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
371 |
|
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
372 |
\end{frame} |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
373 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
374 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
375 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
376 |
\begin{frame}[c] |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
377 |
\frametitle{Optimising Success} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
378 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
379 |
\begin{center} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
380 |
\begin{tabular}{l@{\hspace{2cm}}l} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
381 |
\begin{tikzpicture}[scale=0.6] |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
382 |
\draw[line width=1mm] (-2, -1) rectangle (2,3); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
383 |
\draw[line width=1mm,fill=blue!30] (-2, 1.9) rectangle (2,3); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
384 |
\draw (0,2.5) node {\small\tt shell code}; |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
385 |
\draw[line width=1mm,fill=black] (0.3, -1) rectangle (2,-0.7); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
386 |
\draw[->,line width=0.3mm] (1.05, -1) -- (1.05,-1.7) -- |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
387 |
(-3,-1.7) -- (-3, 3.7) -- (-1.9, 3.7) -- (-1.9, 3.1); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
388 |
\end{tikzpicture} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
389 |
& |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
390 |
\onslide<2>{ |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
391 |
\begin{tikzpicture}[scale=0.6] |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
392 |
\draw[gray!50,fill=red!30] (-2,0.3) rectangle (2,3); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
393 |
\draw[line width=1mm] (-2, -1) rectangle (2,3); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
394 |
\draw[line width=1mm,fill=blue!30] (-2, 0.3) rectangle (2, -0.7); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
395 |
\draw (0,-0.2) node {\small\tt shell code}; |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
396 |
\draw[line width=1mm,fill=black] (0.3, -1) rectangle (2,-0.7); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
397 |
\draw [line width=0.5,decoration={brace,amplitude=2mm},decorate] |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
398 |
(2.3,3) -- (2.3,0.3); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
399 |
\draw[line width=0.3mm] (1.05, -1) -- (1.05,-1.7) -- |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
400 |
(3,-1.7) -- (3,1.65) -- (2.6, 1.65); |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
401 |
\end{tikzpicture}} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
402 |
\end{tabular} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
403 |
\end{center}\bigskip |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
404 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
405 |
\onslide<2>{ |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
406 |
fill up the red part of the string with \pcode{NOP} operations |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
407 |
(Intel \texttt{$\backslash$x90})} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
408 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
409 |
\end{frame} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
410 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
411 |
|
398
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
412 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
413 |
\begin{frame}[c] |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
414 |
\frametitle{Why BOAs Work?} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
415 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
416 |
\begin{itemize} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
417 |
\item stack grows from higher addresses to lower addresses |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
418 |
\item library functions copy memory until a zero-byte is |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
419 |
encountered |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
420 |
\end{itemize} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
421 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
422 |
\begin{center} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
423 |
\begin{tabular}{@{\hspace{-7mm}}c@{\hspace{2mm}}c@{}} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
424 |
\small |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
425 |
\begin{tikzpicture}[scale=0.45] |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
426 |
%\draw[step=1cm] (-3,-3) grid (3,3); |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
427 |
\draw[line width=1mm] (-2, -3) rectangle (2,3); |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
428 |
\draw[line width=1mm] (-2,1) -- (2,1); |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
429 |
\draw[line width=1mm] (-2,-1) -- (2,-1); |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
430 |
\draw (0,2) node {\tt text}; |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
431 |
\draw (0,0) node {\tt heap}; |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
432 |
\draw (0,-2) node {\tt stack}; |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
433 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
434 |
\draw (-2.7,3) node[anchor=north east] |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
435 |
{\tt\begin{tabular}{@{}l@{}}lower\\ address\end{tabular}}; |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
436 |
\draw (-2.7,-3) node[anchor=south east] |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
437 |
{\tt\begin{tabular}{@{}l@{}}higher\\ address\end{tabular}}; |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
438 |
\draw[->, line width=1mm] (-2.5,3) -- (-2.5,-3); |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
439 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
440 |
\draw (2.7,-3) node[anchor=south west] {\tt\footnotesize older}; |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
441 |
\draw (2.7,-1) node[anchor=north west] {\tt\footnotesize newer}; |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
442 |
\draw[|->, line width=1mm] (2.5,-3.09) -- (2.5,-1); |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
443 |
\end{tikzpicture} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
444 |
& |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
445 |
\raisebox{1.3cm}{\footnotesize |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
446 |
\lstinputlisting[language=C,numbers=none]{../progs/app5.c}} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
447 |
\end{tabular} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
448 |
\end{center} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
449 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
450 |
\end{frame} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
451 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
221
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
452 |
|
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
453 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
ae6074cc446a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
220
diff
changeset
|
454 |
\begin{frame}[c] |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
455 |
\frametitle{Variants} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
456 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
457 |
There are many variants: |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
458 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
459 |
\begin{itemize} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
460 |
\item return-to-lib-C attacks |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
461 |
\item heap-smashing attacks\\ |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
462 |
\textcolor{gray}{\small(Slammer Worm in 2003 infected 90\% of vulnerable systems within 10 minutes)}\bigskip |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
463 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
464 |
\item ``zero-days-attacks'' (new unknown vulnerability) |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
465 |
\end{itemize} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
466 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
467 |
\end{frame} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
468 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
469 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
470 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
471 |
\begin{frame}[c] |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
472 |
\frametitle{\begin{tabular}{c} |
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
473 |
Protections against\\ |
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
474 |
Buffer Overflow Attacks |
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
475 |
\end{tabular}} |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
476 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
477 |
\begin{itemize} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
478 |
\item use safe library functions |
226
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
479 |
\item stack canaries |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
480 |
\item ensure stack data is not executable (can be defeated) |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
481 |
\item address space randomisation (makes one-size-fits-all more difficult) |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
482 |
\item choice of programming language (one of the selling points of Java) |
226
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
483 |
\end{itemize} |
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
484 |
|
226
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
485 |
\only<2>{ |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
486 |
\begin{textblock}{7}(6,1) |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
487 |
\begin{bubble}[5.5cm] |
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
488 |
\begin{tabular}{cp{2.9cm}} |
226
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
489 |
\begin{tikzpicture}[baseline=40mm,scale=0.8] |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
490 |
%\draw[step=1cm] (-3,-1) grid (3,8); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
491 |
\draw[gray!20,fill=gray!20] (-1, 0) rectangle (1,-1); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
492 |
\draw[line width=1mm] (-1,-1.2) -- (-1,7.4); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
493 |
\draw[line width=1mm] ( 1,-1.2) -- ( 1,7.4); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
494 |
\draw (0,-1) node[anchor=south] {\tt main}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
495 |
\draw[line width=1mm] (-1,0) -- (1,0); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
496 |
\draw (0,0) node[anchor=south] {\tt arg$_3$=3}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
497 |
\draw[line width=1mm] (-1,1) -- (1,1); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
498 |
\draw (0,1) node[anchor=south] {\tt arg$_2$=2}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
499 |
\draw[line width=1mm] (-1,2) -- (1,2); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
500 |
\draw (0,2) node[anchor=south] {\tt arg$_1$=1}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
501 |
\draw[line width=1mm] (-1,3) -- (1,3); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
502 |
\draw (0,3.1) node[anchor=south] {\tt ret}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
503 |
\draw[line width=1mm] (-1,4) -- (1,4); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
504 |
\draw (0,4) node[anchor=south] {\small\tt last sp}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
505 |
\draw[line width=1mm] (-1,5) -- (1,5); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
506 |
\draw (0,5) node[anchor=south] {\tt\small\alert{\textbf{random}}}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
507 |
\draw[line width=1mm] (-1,6) -- (1,6); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
508 |
\draw (0,6) node[anchor=south] {\tt buf}; |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
509 |
\draw[line width=1mm] (-1,7) -- (1,7); |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
510 |
\end{tikzpicture} & |
396
2f4296a0ab21
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
392
diff
changeset
|
511 |
\raggedright stack canary: a random value after the local variables |
226
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
512 |
\end{tabular} |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
513 |
\end{bubble} |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
514 |
\end{textblock}} |
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
515 |
|
01fe5aba8781
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
516 |
|
220
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
517 |
\end{frame} |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
518 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
519 |
|
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
520 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74772c30e0f4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
216
diff
changeset
|
521 |
\begin{frame}[c] |
398
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
522 |
\frametitle{In my Examples I Cheated} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
523 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
524 |
I compiled the programs with |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
525 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
526 |
\begin{center} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
527 |
\begin{tabular}{l@{\hspace{1mm}}l} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
528 |
\pcode{/usr/bin/gcc} & \pcode{-ggdb -O0}\\ |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
529 |
& \pcode{-fno-stack-protector}\\ |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
530 |
& \pcode{-mpreferred-stack-boundary=2}\\ |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
531 |
& \pcode{-z execstack} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
532 |
\end{tabular} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
533 |
\end{center} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
534 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
535 |
\end{frame} |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
536 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
537 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
538 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
539 |
|
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
540 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b183036ba675
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
396
diff
changeset
|
541 |
\begin{frame}[c] |
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
542 |
\frametitle{NIST Statistics about BOA} |
204
8fe0dc898c73
added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
199
diff
changeset
|
543 |
|
8fe0dc898c73
added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
199
diff
changeset
|
544 |
\begin{center} |
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
545 |
\begin{tikzpicture} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
546 |
\begin{axis}[ |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
547 |
xlabel={year}, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
548 |
ylabel={\% of total attacks}, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
549 |
ylabel style={yshift=0em}, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
550 |
enlargelimits=false, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
551 |
xtick={1997,1999,2001,...,2015}, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
552 |
xmin=1996.5, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
553 |
xmax=2016, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
554 |
ymax=21, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
555 |
ytick={0,5,...,20}, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
556 |
scaled ticks=false, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
557 |
axis lines=left, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
558 |
width=11cm, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
559 |
height=5cm, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
560 |
ybar, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
561 |
nodes near coords= |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
562 |
{\footnotesize |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
563 |
$\pgfmathprintnumber[fixed,fixed zerofill,precision=1,use comma]{\pgfkeysvalueof{/data point/y}}$}, |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
564 |
x tick label style={font=\footnotesize,/pgf/number format/1000 sep={}}] |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
565 |
\addplot |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
566 |
table [x=Year,y=Percentage] {../handouts/bufferoverflows.data}; |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
567 |
\end{axis} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
568 |
\end{tikzpicture} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
569 |
\end{center} |
204
8fe0dc898c73
added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
199
diff
changeset
|
570 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
571 |
from the US National Vulnerability Database\\ |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
572 |
\small\url{http://web.nvd.nist.gov/view/vuln/statistics} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
573 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
574 |
\end{frame} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
575 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
204
8fe0dc898c73
added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
199
diff
changeset
|
576 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
577 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
578 |
\begin{frame}[fragile] |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
579 |
\frametitle{D-Link Wifi Router, BOA} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
580 |
\small |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
581 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
582 |
As a proof-of-concept, the following URL allows |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
583 |
attackers to control the return value saved on |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
584 |
the stack (the vulnerability is triggered when |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
585 |
executing \pcode{"/usr/sbin/widget"}): |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
586 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
587 |
\begin{center}\footnotesize |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
588 |
\pcode{curl http://<target ip>/post_login.xml?hash=AAA...AAABBBB} |
204
8fe0dc898c73
added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
199
diff
changeset
|
589 |
\end{center} |
8fe0dc898c73
added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
199
diff
changeset
|
590 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
591 |
The value of the "hash" HTTP GET parameter consists of |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
592 |
292 occurrences of the \pcode{'A'} character, followed by four |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
593 |
occurrences of character \pcode{'B'}. In our lab setup, characters |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
594 |
\pcode{'B'} overwrite the saved program counter (\pcode{\%ra}).\bigskip |
114
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
595 |
|
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
596 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
597 |
\begin{tabular}{@{}ll} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
598 |
Discovery date: & 06/03/2013\\ |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
599 |
Release date: & 02/08/2013 |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
600 |
\end{tabular}\bigskip |
114
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
601 |
|
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
602 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
603 |
\footnotesize |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
604 |
\hfill\url{http://roberto.greyhats.it/advisories/20130801-dlink-dir645.txt} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
605 |
\end{frame} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
606 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
607 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
608 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
609 |
\begin{frame}[fragile] |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
610 |
\frametitle{GHOST in Glibc} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
611 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
612 |
\small The GHOST vulnerability is a buffer overflow condition |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
613 |
that can be easily exploited locally and remotely. This |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
614 |
vulnerability is named after the GetHOSTbyname function |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
615 |
involved in the exploit.\medskip |
114
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
616 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
617 |
The attack allows the attacker to execute arbitrary code and |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
618 |
take control of the victim’s vulnerable machine. |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
619 |
Unfortunately, the vulnerability exists in the GNU C Library |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
620 |
(glibc), a code library originally released in 2000, meaning |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
621 |
it has been widely distributed. Although an update released by |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
622 |
Linux in 2013 mitigated this vulnerability, most systems and |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
623 |
products have not installed the patch.\medskip |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
624 |
|
114
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
625 |
|
391
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
626 |
\begin{tabular}{@{}ll} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
627 |
Release date: & 01/28/2015 |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
628 |
\end{tabular}\smallskip |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
629 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
630 |
|
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
631 |
\footnotesize |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
632 |
\hfill\url{https://community.qualys.com/blogs/laws-of-vulnerabilities/2015/01/27/the-ghost-vulnerability} |
a612dd3ddc81
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
381
diff
changeset
|
633 |
\end{frame} |
114
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
634 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
635 |
|
392
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
636 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
637 |
\begin{frame}[c] |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
638 |
\frametitle{Format String Vulnerability} |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
639 |
|
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
640 |
\small |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
641 |
\texttt{string} is nowhere used:\bigskip |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
642 |
|
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
643 |
{\footnotesize\lstinputlisting[language=C]{../progs/C4.c}}\bigskip |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
644 |
|
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
645 |
this vulnerability can be used to read out the stack |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
646 |
|
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
647 |
\end{frame} |
4dff36e2bbc6
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
391
diff
changeset
|
648 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
114
3822d91a4639
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
113
diff
changeset
|
649 |
|
113
0332f8102121
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
112
diff
changeset
|
650 |
|
28 | 651 |
\end{document} |
652 |
||
653 |
%%% Local Variables: |
|
654 |
%%% mode: latex |
|
655 |
%%% TeX-master: t |
|
656 |
%%% End: |
|
657 |