slides/slides03.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 04 Oct 2014 15:55:05 +0100
changeset 203 c75a03ab8ac9
parent 199 20af800ce736
child 204 8fe0dc898c73
permissions -rw-r--r--
test
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
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    38
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    39
\begin{frame}[c]
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    40
\frametitle{A ``Cron''-Attack}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    41
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    42
The idea is to trick a privileged person to do something on your
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    43
behalf:
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    44
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    45
\begin{itemize}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    46
\item root:\\\texttt{rm /tmp/*/*}\bigskip\bigskip\pause
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    47
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    48
\footnotesize
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    49
\begin{minipage}{1.1\textwidth}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    50
\textcolor{gray}{the shell behind the scenes:}\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    51
\textcolor{gray}{\texttt{rm /tmp/dir$_1$/file$_1$ /tmp/dir$_1$/file$_2$ /tmp/dir$_2$/file$_1$ \ldots}}\bigskip\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    52
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    53
\textcolor{gray}{this takes time}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    54
\end{minipage}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    55
\end{itemize}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    56
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    57
\end{frame}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    58
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    59
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    60
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    61
\begin{frame}[c]
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    62
\frametitle{A ``Cron''-Attack}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    63
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    64
\begin{enumerate}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    65
\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
    66
\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
    67
\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
    68
\texttt{rm /tmp/*/*}\medskip\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    69
\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
    70
\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
    71
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    72
\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
    73
the real passwd file)}\\
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    74
\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
    75
\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
    76
\end{enumerate}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    77
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    78
\only<2>{
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    79
\begin{textblock}{11}(2,5)
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    80
\begin{bubble}[8cm]
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    81
\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
    82
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
    83
\end{bubble}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    84
\end{textblock}}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    85
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    86
\end{frame}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    87
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    88
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    90
\begin{frame}[c]
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    91
\frametitle{\Large Buffer Overflow Attacks}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    92
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    93
\begin{center}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    94
\begin{columns}[b]
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    95
\begin{column}{.4\textwidth}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    96
\centering
199
20af800ce736 updated pics
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
    97
\includegraphics[scale=1.2]{../pics/barrier.jpg}\\
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    98
lectures so far
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
    99
\end{column}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   100
\begin{column}<2>{.4\textwidth}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   101
\centering
199
20af800ce736 updated pics
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   102
\includegraphics[scale=0.32]{../pics/trainwreck.jpg}\\
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   103
today
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   104
\end{column}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   105
\end{columns}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   106
\end{center}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   107
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   108
\end{frame}
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   109
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   111
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   113
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   114
\frametitle{\begin{tabular}{c}Network Applications:\\[-1mm] Privilege Separation\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   115
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   116
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   117
  \begin{tikzpicture}[scale=1]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   118
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   119
  \draw[line width=1mm] (-.3, 0) rectangle (1.5,2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   120
  \draw (4.7,1) node {Internet};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   121
  \draw (-2.7,1.7) node {\footnotesize Application};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   122
  \draw (0.6,1.7) node {\footnotesize Interface};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   123
  \draw (0.6,-0.4) node {\footnotesize \begin{tabular}{c}unprivileged\\[-1mm] process\end{tabular}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   124
  \draw (-2.7,-0.4) node {\footnotesize \begin{tabular}{c}privileged\\[-1mm] process\end{tabular}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   125
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   126
  \draw[line width=1mm] (-1.8, 0) rectangle (-3.6,2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   127
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   128
  \draw[white] (1.7,1) node (X) {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   129
  \draw[white] (3.7,1) node (Y) {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   130
  \draw[red, <->, line width = 2mm] (X) -- (Y);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   131
 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   132
  \draw[red, <->, line width = 1mm] (-0.6,1) -- (-1.6,1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   133
  \end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   134
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   135
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   136
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   137
\item the idea is make the attack surface smaller and 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   138
mitigate the consequences of an attack
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   139
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   140
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   141
\end{frame}
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   142
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   143
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   144
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   145
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   146
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   147
\frametitle{Access Control in Unix}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   148
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   149
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   150
\item access control provided by the OS
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   151
\item authenticate principals (login)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   152
\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
   153
\item roles get attached with privileges\bigskip\\%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   154
\hspace{8mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   155
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   156
\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
   157
{\begin{minipage}{8cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   158
\alert{The principle of least privilege:}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   159
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
   160
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   161
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   162
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   163
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   164
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   165
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   166
114
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   167
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   168
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   169
\begin{frame}[t]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   170
\frametitle{Process Ownership}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   171
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   172
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   173
\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
   174
\end{itemize}\bigskip\bigskip\bigskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   175
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   176
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   177
\begin{tabular}{c}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   178
root\\
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   179
\hline
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   180
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   181
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
   182
\end{tabular}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   183
\end{center}\bigskip\bigskip\bigskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   184
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   185
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   186
\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
   187
\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
   188
\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
   189
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   190
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   191
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   192
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   193
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   194
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   195
\frametitle{Access Control in Unix (2)}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   196
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   197
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   198
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   199
\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
   200
\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
   201
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   202
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   203
\begin{tabular}{l}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   204
\texttt{\$ ls - la}\\
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   205
\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
   206
\end{tabular}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   207
\end{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   208
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   209
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   210
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   211
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   212
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   213
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   214
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   215
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   216
\frametitle{Login Process}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   217
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   218
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   219
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   220
\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
   221
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   222
\texttt{ps -axl | grep login}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   223
\end{center}\medskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   224
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   225
\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
   226
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   227
\texttt{id cu}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   228
\end{center}\medskip\pause
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   229
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   230
\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
   231
access control
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   232
\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
   233
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   234
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   235
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   236
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   237
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   238
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   239
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   240
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   241
\frametitle{Setuid and Setgid}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   242
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   243
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
   244
\alert{Setuid} and \alert{Setgid} Bits
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   245
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   246
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   247
\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
   248
\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
   249
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   250
\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
   251
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   252
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   253
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   254
\texttt{chmod 4755 fobar\_file}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   255
\end{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   256
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   257
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   258
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   259
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   260
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   261
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   262
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   263
\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
   264
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   265
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   266
\begin{tikzpicture}[scale=1]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   267
  
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   268
  \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
   269
  \draw (4.7,1) node {Internet};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   270
  \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
   271
  \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
   272
  \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
   273
  \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
   274
  \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
   275
  \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
   276
  
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   277
  \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
   278
  \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
   279
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   280
  \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
   281
  \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
   282
  \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
   283
 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   284
  \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
   285
  \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
   286
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   287
  \end{tikzpicture}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   288
\end{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   289
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   290
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   291
\item pre-authorisation slave 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   292
\item post-authorisation\bigskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   293
\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
   294
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   295
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   296
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   297
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   298
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   299
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   300
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   301
\frametitle{Network Applications}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   302
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   303
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
   304
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   305
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   306
\item need two distinct processes
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   307
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   308
\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
   309
\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
   310
 
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   311
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   312
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   313
\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
   314
\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
   315
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   316
\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
   317
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   318
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   319
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   320
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   321
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   322
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   323
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   324
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   325
\mode<presentation>{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   326
\begin{frame}[c]
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   327
\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
   328
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   329
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   330
\begin{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   331
\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
   332
\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
   333
\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
   334
\begin{center}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   335
\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
   336
\end{center}\medskip
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   337
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
   338
\end{itemize}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   339
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   340
\only<5->{
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   341
\begin{textblock}{1}(3,7)
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   342
\begin{tikzpicture}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   343
\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
   344
{\begin{minipage}{8cm}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   345
Only failure makes us experts.
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   346
	-- Theo de Raadt (OpenBSD, OpenSSH)
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   347
\end{minipage}};
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   348
\end{tikzpicture}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   349
\end{textblock}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   350
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   351
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   352
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   353
\end{frame}}
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   354
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   355
3822d91a4639 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   356
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   357
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   358
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   359
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   360
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   361
\frametitle{\begin{tabular}{@ {}c@ {}}A ``Cron''-Attack\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   362
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   363
\begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   364
\item attacker \textcolor{gray}{(creates a fake passwd file)}\\ 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   365
\texttt{mkdir /tmp/a; cat > /tmp/a/passwd}\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   366
\item root \textcolor{gray}{(does the daily cleaning)}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   367
\texttt{rm /tmp/*/*}\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   368
\hspace{2cm}\textcolor{gray}{\small records that \texttt{/tmp/a/passwd}}\\ 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   369
\hspace{2cm}\textcolor{gray}{\small should be deleted, but does not do it yet}\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   370
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   371
\item attacker \textcolor{gray}{(meanwhile deletes the fake passwd file, and establishes a link to 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   372
the real passwd file)}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   373
\texttt{rm /tmp/a/passwd; rmdir /tmp/a;}\\\texttt{ln -s /etc /tmp/a}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   374
\item root now deletes  the real passwd file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   375
\end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   376
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   377
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   378
\begin{textblock}{11}(2,5)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   379
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   380
\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
   381
{\normalsize\color{darkgray}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   382
\begin{minipage}{9cm}\raggedright
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   383
To prevent this kind of attack, you need additional
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   384
policies (don't do such operations as root).
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   385
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   386
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   387
\end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   388
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   389
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   390
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   391
115
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   392
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   393
\mode<presentation>{
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   394
\begin{frame}[c]
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   395
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   396
\begin{center}
199
20af800ce736 updated pics
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   397
\includegraphics[scale=0.45]{../pics/trainwreck.jpg}\\
115
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   398
one general defence mechanism is\\\alert{\bf defence in depth}
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   399
\end{center}
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   400
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   401
  
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   402
\end{frame}}
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   403
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   404
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   405
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   406
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   407
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   408
\frametitle{Smash the Stack for Fun\ldots}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   409
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   410
\begin{itemize}
111
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   411
\item ``smashing the stack attacks'' or\\ ``buffer overflow attacks''\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   412
\item one of the most popular attacks\\ ($>$ 50\% of security incidents reported at CERT are related to buffer overflows)
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   413
\begin{flushright}\small
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   414
\textcolor{gray}{\url{http://www.kb.cert.org/vuls}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   415
\end{flushright}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   416
\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   417
\item made popular in an article by Elias Levy\\ (also known as Aleph One):\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   418
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   419
{\bf ``Smashing The Stack For Fun and Profit''}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   420
\end{center}\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   421
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   422
\begin{flushright}
111
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   423
\small\textcolor{gray}{Issue 49, Article 14}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   424
\end{flushright} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   425
 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   426
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   427
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   428
\end{frame}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   429
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   430
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   431
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   432
\begin{frame}[c]
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   433
\frametitle{A Float Printed ``Twice''}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   434
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   435
\footnotesize
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   436
\lstinputlisting[language=C]{../progs/C1.c}
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   437
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   438
\end{frame}
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   439
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   440
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   441
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   442
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   443
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   444
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   445
\frametitle{The Problem}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   446
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   447
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   448
\item The basic problem is that library routines in C look as follows:
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   449
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   450
\begin{center}
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   451
\footnotesize\lstinputlisting[language=C]{../progs/app5.c}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   452
\end{center}
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   453
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   454
\item the resulting problems are often remotely exploitable 
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   455
\item can be used to circumvents all access control\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   456
(for grooming botnets for further attacks)
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   457
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   458
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   459
\end{frame}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   460
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   461
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   462
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   463
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   464
\frametitle{Variants}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   465
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   466
There are many variants:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   467
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   468
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   469
\item return-to-lib-C attacks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   470
\item heap-smashing attacks\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   471
\textcolor{gray}{\small(Slammer Worm in 2003 infected 90\% of vulnerable systems within 10 minutes)}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   472
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   473
\item ``zero-days-attacks'' (new unknown vulnerability)
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   475
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   476
\end{frame}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   477
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   479
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   480
\begin{frame}[c]
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   482
\begin{center}
199
20af800ce736 updated pics
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   483
\only<1>{\includegraphics[scale=0.9]{../pics/stack1}\;\;}
20af800ce736 updated pics
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   484
\only<2>{\includegraphics[scale=0.9]{../pics/stack2}\;\;}
20af800ce736 updated pics
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   485
\only<3>{\includegraphics[scale=0.9]{../pics/stack3}\;\;}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   486
\end{center}
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   487
    
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   488
\end{frame}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   489
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   491
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   492
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   493
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   494
{\small\lstinputlisting[language=C]{../progs/C2.c}}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   495
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   496
\end{frame}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   497
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   498
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   499
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   500
%\mode<presentation>{
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   501
%\begin{frame}[c]
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   502
%
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   503
%\small
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   504
%A programmer might be careful, but still introduce vulnerabilities:\bigskip
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   505
%
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   506
%{\lstset{language=Java}\footnotesize
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   507
%\texttt{\lstinputlisting{../progs/C2a.c}}}
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   508
%
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   509
% 
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   510
%\end{frame}}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   511
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
29
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   512
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   513
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   514
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   515
\frametitle{Payloads}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   516
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   517
\begin{itemize}
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   518
\item the idea is you store some code to the buffer
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   519
\item you then override the return address to execute this payload\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   520
\item normally you start a root-shell\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   521
\item difficulty is to guess the right place where to ``jump''
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   522
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   523
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   524
\end{frame}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   525
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   526
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   527
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   528
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   529
\frametitle{Payloads (2)}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   530
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   531
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   532
\item another difficulty is that the code is not allowed to contain \texttt{$\backslash$x00}:
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   533
29
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   534
\begin{center}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   535
\texttt{xorl   \%eax, \%eax}
29
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   536
\end{center}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   537
\end{itemize}\bigskip\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   538
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   539
{\small
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   540
\lstinputlisting[language=C]{../progs/app5.c}}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   541
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   542
\end{frame}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   543
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   544
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   545
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   546
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   547
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   548
\frametitle{Format String Vulnerability}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   549
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   550
\small
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   551
\texttt{string} is nowhere used:\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   552
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   553
{\footnotesize\lstinputlisting[language=C]{../progs/C4.c}}\bigskip
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   554
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   555
this vulnerability can be used to read out the stack
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   556
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   557
\end{frame}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   558
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   559
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   560
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   561
\begin{frame}[c]
115
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   562
\frametitle{\begin{tabular}{c}Protections against\\ Buffer Overflow Attacks\end{tabular}}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   563
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
\begin{itemize}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   565
\item use safe library functions
115
c4008b31df8e added material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 114
diff changeset
   566
\item stack caneries
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   567
\item ensure stack data is not executable (can be defeated)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   568
\item address space randomisation (makes one-size-fits-all more difficult)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   569
\item choice of programming language (one of the selling points of Java)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   570
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   571
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   572
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   573
\end{frame}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   574
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   575
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   576
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   577
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   578
\frametitle{Security Goals}
29
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   579
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   580
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   581
\item Prevent common vulnerabilities from occurring (e.g. buffer overflows)\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   582
\item Recover from attacks (traceability and auditing of security-relevant actions)\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   583
\item Monitoring (detect attacks)\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   584
\item Privacy, confidentiality, anonymity (to protect secrets)\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   585
\item Authenticity (needed for access control)\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   586
\item Integrity (prevent unwanted modification or tampering)\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   587
\item Availability and reliability (reduce the risk of DoS attacks)
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   588
\end{itemize}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   589
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   590
\end{frame}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   591
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   592
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   593
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   594
\begin{frame}[c]
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   595
\frametitle{Homework}
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   596
29
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   597
\begin{itemize}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   598
\item Assume format string attacks allow you to read out the stack. What can you do
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   599
	with this information?\bigskip
31
Christian Urban <urbanc@in.tum.de>
parents: 30
diff changeset
   600
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   601
\item Assume you can crash a program remotely. Why is this a problem?
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   602
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   603
  
196
22f027da67ec updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 152
diff changeset
   604
\end{frame}
30
Christian Urban <urbanc@in.tum.de>
parents: 29
diff changeset
   605
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
29
Christian Urban <urbanc@in.tum.de>
parents: 28
diff changeset
   606
28
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   607
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   608
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   609
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   610
%%% Local Variables:  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   611
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   612
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   613
%%% End: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   614