slides/slides03.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 07 Oct 2014 00:26:40 +0100
changeset 219 c2ac0cb1d00b
parent 216 38718062709a
child 220 74772c30e0f4
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     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
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 115
diff changeset
     7
\newfontfamily{\consolas}{Consolas}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
     9
\hfuzz=220pt 
111
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
    10
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
% beamer stuff 
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    12
\renewcommand{\slidecaption}{APP 03, King's College London}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\begin{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    18
\begin{frame}[t]
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
\frametitle{%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
  \begin{tabular}{@ {}c@ {}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  \\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  \LARGE Access Control and \\[-3mm] 
111
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
    23
  \LARGE Privacy Policies (3)\\[-6mm] 
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  \end{tabular}}\bigskip\bigskip\bigskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    26
  \normalsize
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  \begin{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  \begin{tabular}{ll}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  Email:  & christian.urban at kcl.ac.uk\\
111
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
    30
  Office: & S1.27 (1st floor Strand Building)\\
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
    31
  Slides: & KEATS (also home work is there)
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  \end{tabular}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  \end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    35
\end{frame}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    36
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    38
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    39
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{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    42
\frametitle{\begin{tabular}{c}Network Applications:\\[-1mm] Privilege Separation\end{tabular}}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    43
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    44
\begin{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    45
  \begin{tikzpicture}[scale=1]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    46
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    47
  \draw[line width=1mm] (-.3, 0) rectangle (1.5,2);
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    48
  \draw (4.7,1) node {Internet};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    49
  \draw (-2.7,1.7) node {\footnotesize Application};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    50
  \draw (0.6,1.7) node {\footnotesize Interface};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    51
  \draw (0.6,-0.4) node {\footnotesize \begin{tabular}{c}unprivileged\\[-1mm] process\end{tabular}};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    52
  \draw (-2.7,-0.4) node {\footnotesize \begin{tabular}{c}privileged\\[-1mm] process\end{tabular}};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    53
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    54
  \draw[line width=1mm] (-1.8, 0) rectangle (-3.6,2);
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
  \draw[white] (1.7,1) node (X) {};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    57
  \draw[white] (3.7,1) node (Y) {};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    58
  \draw[red, <->, line width = 2mm] (X) -- (Y);
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
  \draw[red, <->, line width = 1mm] (-0.6,1) -- (-1.6,1);
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    61
  \end{tikzpicture}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    62
\end{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    63
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    64
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    65
\item the idea is make the attack surface smaller and 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    66
mitigate the consequences of an attack
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    67
\item you need an OS that supports different roles (root vs.~users)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    68
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    69
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    70
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    71
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    72
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    73
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    74
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    75
\frametitle{Weaknesses of Unix AC}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    76
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    77
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    78
\item if you have too many roles (for example too finegrained AC), then
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    79
  hierarchy is too complex\medskip\\ \textcolor{gray}{you invite situations
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    80
    like\ldots let's be root}\bigskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    81
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    82
\item you can still abuse the system\ldots
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    83
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    84
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    85
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    86
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
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
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    90
\frametitle{A ``Cron''-Attack}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    91
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    92
The idea is to trick a privileged person to do something on your
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    93
behalf:
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    94
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    95
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    96
\item root:\\\texttt{rm /tmp/*/*}\bigskip\bigskip\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    97
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    98
\small
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    99
\begin{minipage}{1.1\textwidth}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   100
\textcolor{gray}{the shell behind the scenes:}\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   101
\textcolor{gray}{\texttt{rm /tmp/dir$_1$/file$_1$ /tmp/dir$_1$/file$_2$ /tmp/dir$_2$/file$_1$ \ldots}}\bigskip\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   102
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   103
\textcolor{gray}{this takes time}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   104
\end{minipage}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   105
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   106
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   107
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   108
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   109
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   110
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   111
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   112
\frametitle{A ``Cron''-Attack}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   113
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   114
\begin{enumerate}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   115
\item attacker \textcolor{gray}{(creates a fake passwd file)}\\ 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   116
\texttt{mkdir /tmp/a; cat > /tmp/a/passwd}\medskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   117
\item root \textcolor{gray}{(does the daily cleaning)}\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   118
\texttt{rm /tmp/*/*}\medskip\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   119
\hspace{2cm}\textcolor{gray}{records that \texttt{/tmp/a/passwd}}\\ 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   120
\hspace{2cm}\textcolor{gray}{should be deleted, but does not do it yet}\medskip\\
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
\item attacker \textcolor{gray}{(meanwhile deletes the fake passwd file, and establishes a link to 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   123
the real passwd file)}\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   124
\texttt{rm /tmp/a/passwd; rmdir /tmp/a;}\\\texttt{ln -s /etc /tmp/a}\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   125
\item root now deletes  the real passwd file
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   126
\end{enumerate}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   127
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   128
\only<2>{
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   129
\begin{textblock}{11}(2,5)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   130
\begin{tikzpicture}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   131
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   132
{\normalsize\color{darkgray}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   133
\begin{minipage}{9.5cm}\raggedright
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   134
To prevent this kind of attack, you need additional
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   135
policies (don't do such operations as root).
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   136
\end{minipage}};
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   137
\end{tikzpicture}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   138
\end{textblock}}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   139
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   140
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   141
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
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
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
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   146
\frametitle{\Large Buffer Overflow Attacks}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   147
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   148
\begin{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   149
\begin{columns}[b]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   150
\begin{column}{.4\textwidth}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   151
\centering
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   152
\includegraphics[scale=1.2]{../pics/barrier.jpg}\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   153
lectures so far
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   154
\end{column}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   155
\begin{column}<2>{.4\textwidth}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   156
\centering
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   157
\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
   158
today
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   159
\end{column}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   160
\end{columns}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   161
\end{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   162
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   163
\end{frame}
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
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   166
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   167
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   168
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   169
\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
   170
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   171
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   172
\item {\bf Buffer Overflow Attacks} or\\ {\bf Smashing the Stack Attacks}\medskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   173
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   174
\item one of the most popular attacks, unfortunately\\ 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   175
($>$ 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
   176
to buffer overflows)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   177
\begin{flushright}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   178
\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
   179
\end{flushright}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   180
\medskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   181
\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
   182
(also known as Aleph One):\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   183
\begin{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   184
{\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
   185
\end{center}\medskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   186
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   187
\begin{flushright}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   188
\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
   189
\end{flushright} 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   190
 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   191
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   192
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   193
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   194
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   195
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   196
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   197
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   198
\frametitle{A Long Printed ``Twice''}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   199
\mbox{}\\[-10mm]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   200
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   201
\footnotesize
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   202
\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
   203
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   204
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   205
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   206
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
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   209
\frametitle{``A Login Function'' (1)}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   210
\mbox{}\\[-10mm]
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
\footnotesize
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   213
\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
   214
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   215
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   216
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   217
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   218
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   219
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   220
\frametitle{``A Login Function'' (2)}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   221
\mbox{}\\[-10mm]
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
\footnotesize
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   224
\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
   225
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   226
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   227
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   228
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   229
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   230
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   231
\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
   232
216
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
   233
\begin{itemize}
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
   234
\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
   235
\end{itemize}
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
   236
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   237
\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
   238
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   239
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   240
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   241
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   242
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   243
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   244
\frametitle{Memory}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   245
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   246
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   247
\item each process will get a chunk of memory that is organised as
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   248
follows:
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   249
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   250
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   251
\begin{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   252
  \begin{tikzpicture}[scale=0.8]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   253
  %\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
   254
  \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
   255
  \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
   256
  \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
   257
  \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
   258
  \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
   259
  \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
   260
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   261
  \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
   262
  \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
   263
  \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
   264
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   265
  \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
   266
  \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
   267
  \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
   268
  \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
   269
  \end{tikzpicture}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   270
\end{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   271
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   272
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   273
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   274
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   275
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   276
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   277
\frametitle{The Stack}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   278
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   279
\begin{textblock}{7}(1,1)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   280
  \begin{tikzpicture}[scale=0.8]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   281
  %\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
   282
  \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
   283
  \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
   284
  \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
   285
  \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
   286
  \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
   287
  \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
   288
  \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
   289
  \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
   290
  \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
   291
  \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
   292
  \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
   293
  \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
   294
  \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
   295
  \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
   296
  \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
   297
  \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
   298
  \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
   299
  \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
   300
  \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
   301
  \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
   302
  \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
   303
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   304
  \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
   305
  \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
   306
  \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
   307
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   308
  \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
   309
\end{tikzpicture}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   310
\end{textblock}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   311
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   312
\begin{textblock}{7}(6.4,8)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   313
\begin{bubble}[6.8cm]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   314
\footnotesize
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   315
\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
   316
\end{bubble}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   317
\end{textblock}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   318
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   319
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   320
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   321
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   322
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   323
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   324
\frametitle{Behind the Scenes}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   325
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   326
machine code
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   327
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   328
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   329
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   330
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   331
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   332
\begin{frame}[c]
204
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   333
\frametitle{\begin{tabular}{c}Network Applications:\\[-1mm] Privilege Separation\end{tabular}}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   334
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   335
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   336
\begin{center}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   337
  \begin{tikzpicture}[scale=1]
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   338
  
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   339
  \draw[line width=1mm] (-.3, 0) rectangle (1.5,2);
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   340
  \draw (4.7,1) node {Internet};
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   341
  \draw (-2.7,1.7) node {\footnotesize Application};
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   342
  \draw (0.6,1.7) node {\footnotesize Interface};
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   343
  \draw (0.6,-0.4) node {\footnotesize \begin{tabular}{c}unprivileged\\[-1mm] process\end{tabular}};
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   344
  \draw (-2.7,-0.4) node {\footnotesize \begin{tabular}{c}privileged\\[-1mm] process\end{tabular}};
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   345
  
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   346
  \draw[line width=1mm] (-1.8, 0) rectangle (-3.6,2);
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   347
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   348
  \draw[white] (1.7,1) node (X) {};
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   349
  \draw[white] (3.7,1) node (Y) {};
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   350
  \draw[red, <->, line width = 2mm] (X) -- (Y);
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   351
 
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   352
  \draw[red, <->, line width = 1mm] (-0.6,1) -- (-1.6,1);
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   353
  \end{tikzpicture}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   354
\end{center}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   355
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   356
\begin{itemize}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   357
\item the idea is make the attack surface smaller and mitigate the
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   358
  consequences of an attack
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   359
\item you need an OS that supports different roles (root vs.~users)
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   360
\end{itemize}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   361
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   362
\end{frame}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   363
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   364
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   365
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   366
\begin{frame}[c]
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   367
\frametitle{Weaknesses of Unix AC}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   368
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   369
Not just restricted to Unix:
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   370
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   371
\begin{itemize}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   372
\item if you have too many roles (i.e.~too finegrained AC), then
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   373
  hierarchy is too complex\\ \textcolor{gray}{you invite situations
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   374
    like\ldots let's be root}\bigskip
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   375
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   376
\item you can still abuse the system\ldots
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   377
\end{itemize}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   378
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   379
\end{frame}
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   380
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
8fe0dc898c73 added example1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 199
diff changeset
   381
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   382
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   383
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   384
\begin{frame}[c]
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   385
\frametitle{A ``Cron''-Attack}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   386
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   387
\begin{enumerate}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   388
\item attacker \textcolor{gray}{(creates a fake passwd file)}\\ 
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   389
\texttt{mkdir /tmp/a; cat > /tmp/a/passwd}\medskip
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   390
\item root \textcolor{gray}{(does the daily cleaning)}\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   391
\texttt{rm /tmp/*/*}\medskip\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   392
\hspace{2cm}\textcolor{gray}{\small records that \texttt{/tmp/a/passwd}}\\ 
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   393
\hspace{2cm}\textcolor{gray}{\small should be deleted, but does not do it yet}\medskip\\
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   395
\item attacker \textcolor{gray}{(meanwhile deletes the fake passwd file, and establishes a link to 
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   396
the real passwd file)}\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   397
\texttt{rm /tmp/a/passwd; rmdir /tmp/a;}\\\texttt{ln -s /etc /tmp/a}\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   398
\item root now deletes  the real passwd file
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   399
\end{enumerate}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   400
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   401
\only<2>{
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   402
\begin{textblock}{11}(2,5)
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   403
\begin{bubble}[8cm]
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   404
\normalsize To prevent this kind of attack, you need additional
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   405
policies (don't do such operations as root).
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   406
\end{bubble}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   407
\end{textblock}}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   408
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   409
\end{frame}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   410
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   411
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   412
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   413
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   414
\begin{frame}[c]
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   415
\frametitle{The Problem}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   416
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   417
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   418
\item The basic problem is that library routines in C look as follows:
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   419
\end{itemize}
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   420
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   421
\begin{center}
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   422
\small\lstinputlisting[language=C,numbers=none]{../progs/app5.c}
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   423
\end{center}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   424
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   425
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   426
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   427
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   428
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   429
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   430
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   431
\frametitle{Variants}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   432
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   433
There are many variants:
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   434
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   435
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   436
\item return-to-lib-C attacks
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   437
\item heap-smashing attacks\\
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   438
\textcolor{gray}{\small(Slammer Worm in 2003 infected 90\% of vulnerable systems within 10 minutes)}\bigskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   439
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   440
\item ``zero-days-attacks'' (new unknown vulnerability)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   441
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   442
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   443
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   444
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   445
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   446
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   447
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   448
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   449
{\small\lstinputlisting[language=C]{../progs/C2.c}}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   450
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   451
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   452
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   453
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   454
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   455
%\mode<presentation>{
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   456
%\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   457
%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   458
%\small
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   459
%A programmer might be careful, but still introduce vulnerabilities:\bigskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   460
%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   461
%{\lstset{language=Java}\footnotesize
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   462
%\texttt{\lstinputlisting{../progs/C2a.c}}}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   463
%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   464
% 
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   465
%\end{frame}}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   466
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   467
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   468
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   469
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   470
\frametitle{Payloads}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   471
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   472
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   473
\item the idea is you store some code to the buffer
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   474
\item you then override the return address to execute this payload\medskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   475
\item normally you start a root-shell\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   476
\item difficulty is to guess the right place where to ``jump''
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   477
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   478
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   479
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   480
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   481
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   482
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   483
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   484
\frametitle{Payloads (2)}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   485
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   486
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   487
\item another difficulty is that the code is not allowed to contain \texttt{$\backslash$x00}:
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   488
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   489
\begin{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   490
\texttt{xorl   \%eax, \%eax}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   491
\end{center}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   492
\end{itemize}\bigskip\bigskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   493
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   494
{\small
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   495
\lstinputlisting[language=C]{../progs/app5.c}}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   496
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   497
\end{frame}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   498
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   499
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   500
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   501
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   502
\begin{frame}[c]
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   503
\frametitle{Format String Vulnerability}
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   504
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   505
\small
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   506
\texttt{string} is nowhere used:\bigskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   507
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   508
{\footnotesize\lstinputlisting[language=C]{../progs/C4.c}}\bigskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   509
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   510
this vulnerability can be used to read out the stack
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   511
  
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   512
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   513
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   514
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   515
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   516
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   517
\frametitle{\begin{tabular}{c}Protections against\\ Buffer Overflow Attacks\end{tabular}}
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   518
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   519
\begin{itemize}
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   520
\item use safe library functions
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   521
\item stack caneries
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   522
\item ensure stack data is not executable (can be defeated)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   523
\item address space randomisation (makes one-size-fits-all more difficult)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   524
\item choice of programming language (one of the selling points of Java)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   525
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   526
\end{itemize}
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   527
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   528
\end{frame}
211
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   529
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   530
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   531
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   532
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   533
\frametitle{Security Goals}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   534
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   535
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   536
\item Prevent common vulnerabilities from occurring (e.g. buffer overflows)\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   537
\item Recover from attacks (traceability and auditing of security-relevant actions)\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   538
\item Monitoring (detect attacks)\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   539
\item Privacy, confidentiality, anonymity (to protect secrets)\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   540
\item Authenticity (needed for access control)\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   541
\item Integrity (prevent unwanted modification or tampering)\pause
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   542
\item Availability and reliability (reduce the risk of DoS attacks)
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   543
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   544
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   545
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   546
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   547
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   548
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   549
\begin{frame}[c]
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   550
\frametitle{Homework}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   551
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   552
\begin{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   553
\item Assume format string attacks allow you to read out the stack. What can you do
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   554
	with this information?\bigskip
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   555
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   556
\item Assume you can crash a program remotely. Why is this a problem?
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   557
\end{itemize}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   558
  
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   559
\end{frame}
e6e160c7ea33 added files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   560
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   561
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   562
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   563
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   564
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   565
\frametitle{Access Control in Unix}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   566
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   567
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   568
\item access control provided by the OS
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   569
\item authenticate principals (login)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   570
\item mediate access to files, ports, processes according to \alert{roles} (user ids)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   571
\item roles get attached with privileges\bigskip\\%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   572
\hspace{8mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   573
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   574
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   575
{\begin{minipage}{8cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   576
\alert{The principle of least privilege:}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   577
programs should only have as much privilege as they need 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   578
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   579
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   580
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   581
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   582
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   583
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   584
114
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   585
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   586
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   587
\begin{frame}[t]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   588
\frametitle{Process Ownership}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   589
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   590
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   591
\item access control in Unix is very coarse
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   592
\end{itemize}\bigskip\bigskip\bigskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   593
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   594
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   595
\begin{tabular}{c}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   596
root\\
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   597
\hline
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   598
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   599
user$_1$ user$_2$ \ldots www, mail, lp
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   600
\end{tabular}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   601
\end{center}\bigskip\bigskip\bigskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   602
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   603
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   604
\textcolor{gray}{\small root has UID $=$ 0}\\\pause
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   605
\textcolor{gray}{\small you also have groups that can share access to a file}\\
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   606
\textcolor{gray}{\small but it is difficult to exclude access selectively}\\
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   607
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   608
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   609
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   610
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   611
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   612
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   613
\frametitle{Access Control in Unix (2)}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   614
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   615
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   616
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   617
\item privileges are specified by file access permissions (``everything is a file'') 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   618
\item there are 9 (plus 2) bits that specify the permissions of a file
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   619
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   620
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   621
\begin{tabular}{l}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   622
\texttt{\$ ls - la}\\
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   623
\texttt{-rwxrw-r-{}- \hspace{3mm} foo\_file.txt}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   624
\end{tabular}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   625
\end{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   626
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   627
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   628
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   629
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   630
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   631
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   632
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   633
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   634
\frametitle{Login Process}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   635
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   636
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   637
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   638
\item login processes run under UID $=$ 0\medskip 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   639
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   640
\texttt{ps -axl | grep login}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   641
\end{center}\medskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   642
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   643
\item after login, shells run under UID $=$ user (e.g.~501)\medskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   644
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   645
\texttt{id cu}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   646
\end{center}\medskip\pause
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   647
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   648
\item non-root users are not allowed to change the UID --- would break 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   649
access control
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   650
\item but needed for example for \texttt{passwd}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   651
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   652
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   653
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   654
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   655
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   656
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   657
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   658
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   659
\frametitle{Setuid and Setgid}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   660
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   661
The solution is that unix file permissions are 9 + \underline{2 Bits}:
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   662
\alert{Setuid} and \alert{Setgid} Bits
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   663
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   664
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   665
\item When a file with setuid is executed, the resulting process will assume the UID given to the owner of the file. 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   666
\item This enables users to create processes as root (or another user).\bigskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   667
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   668
\item Essential for changing passwords, for example.
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   669
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   670
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   671
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   672
\texttt{chmod 4755 fobar\_file}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   673
\end{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   674
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   675
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   676
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   677
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   678
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   679
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   680
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   681
\frametitle{\begin{tabular}{c}Privilege Separation in\\ OpenSSH\end{tabular}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   682
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   683
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   684
\begin{tikzpicture}[scale=1]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   685
  
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   686
  \draw[line width=1mm] (0, 1.1) rectangle (1.2,2);
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   687
  \draw (4.7,1) node {Internet};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   688
  \draw (0.6,1.7) node {\footnotesize Slave};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   689
  \draw[line width=1mm] (0, 0) rectangle (1.2,0.9);
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   690
  \draw (0.6,1.7) node {\footnotesize Slave};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   691
  \draw (0.6,0.6) node {\footnotesize Slave};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   692
  \draw (0.6,-0.5) node {\footnotesize \begin{tabular}{c}unprivileged\\[-1mm] processes\end{tabular}};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   693
  \draw (-2.7,-0.4) node {\footnotesize \begin{tabular}{c}privileged\\[-1mm] process\end{tabular}};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   694
  
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   695
  \draw[line width=1mm] (-1.8, 0) rectangle (-3.6,2);
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   696
  \draw (-2.9,1.7) node {\footnotesize Monitor};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   697
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   698
  \draw[white] (1.7,1) node (X) {};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   699
  \draw[white] (3.7,1) node (Y) {};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   700
  \draw[red, <->, line width = 2mm] (X) -- (Y);
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   701
 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   702
  \draw[red, <->, line width = 1mm] (-0.4,1.4) -- (-1.4,1.1);
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   703
  \draw[red, <->, line width = 1mm] (-0.4,0.6) -- (-1.4,0.9);
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   704
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   705
  \end{tikzpicture}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   706
\end{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   707
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   708
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   709
\item pre-authorisation slave 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   710
\item post-authorisation\bigskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   711
\item 25\% codebase is privileged, 75\% is unprivileged
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   712
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   713
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   714
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   715
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   716
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   717
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   718
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   719
\frametitle{Network Applications}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   720
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   721
ideally network application in Unix should be designed as follows:
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   722
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   723
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   724
\item need two distinct processes
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   725
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   726
\item one that listens to the network; has no privilege
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   727
\item one that is privileged and listens to the latter only (but does not trust it)
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   728
 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   729
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   730
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   731
\item to implement this you need a parent process, which forks a child process
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   732
\item this child process drops privileges and listens to hostile data\medskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   733
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   734
\item after authentication the parent forks again and the new child becomes the user
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   735
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   736
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   737
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   738
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   739
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   740
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   741
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   742
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   743
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   744
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   745
\frametitle{\begin{tabular}{@ {}c@ {}}Famous Security Flaws\\[-1mm] in Unix\end{tabular}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   746
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   747
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   748
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   749
\item \texttt{lpr} unfortunately runs with root privileges; you had the option to delete files after printing \ldots\pause\pause
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   750
\item for debugging purposes (FreeBSD) Unix provides a ``core dump'', but allowed to follow links \ldots\pause
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   751
\item \texttt{mkdir foo} is owned by root\medskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   752
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   753
\texttt{-rwxr-xr-x  1 root  wheel /bin/mkdir}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   754
\end{center}\medskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   755
it first creates an i-node as root and then changes to ownership to the user's id\\ \textcolor{gray}{\small (race condition -- can be automated with a shell script)}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   756
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   757
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   758
\only<5->{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   759
\begin{textblock}{1}(3,7)
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   760
\begin{tikzpicture}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   761
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   762
{\begin{minipage}{8cm}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   763
Only failure makes us experts.
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   764
	-- Theo de Raadt (OpenBSD, OpenSSH)
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   765
\end{minipage}};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   766
\end{tikzpicture}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   767
\end{textblock}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   768
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   769
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   770
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   771
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   772
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   773
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   774
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   775
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   776
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   777
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   778
%%% Local Variables:  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   779
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   780
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   781
%%% End: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   782