handouts/ho04.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 27 Oct 2016 11:06:55 +0100
changeset 489 5ecc1211752d
parent 443 67d7d239c617
child 495 f5172bb6cf45
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\documentclass{article}
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
\usepackage{../style}
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
\usepackage{../langs}
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
     4
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
\begin{document}
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
     6
\fnote{\copyright{} Christian Urban, 2014, 2015}
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
     8
\section*{Handout 4 (Access Control)}
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
Access control is essentially about deciding whether to grant
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
    11
access to a resource or deny it. Sounds easy, no? Well it
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
    12
turns out that things are not as simple as they seem at first
252
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
    13
glance. Let us first look, as a case-study, at how access
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
    14
control is organised in Unix-like systems (Windows systems
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
    15
have similar access controls, although the details might be
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
    16
quite different). Then we have a look at how secrecy and
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
    17
integrity can be ensured in a system, and finally have a look
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    18
at shared access control in multi-agent systems. But before we
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    19
start, let us motivate access control systems by the kind of
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    20
attacks we have seen in the last lecture. \bigskip
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    21
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    22
\noindent There are two further general approaches for
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    23
countering buffer overflow attacks (and other similar
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    24
attacks). One are Unix-like access controls, which enable a
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    25
particular architecture for network applications, for example
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    26
web-servers. This architecture minimises the attack surface
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    27
that is visible from, for example, the Internet. And if an
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    28
attack occurs the architecture attempts to limit the damage.
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    29
The other approach is to \emph{radically} minimise the attack
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    30
surface by running only the bare essentials on the web-server.
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    31
In this approach, even the operating system is eliminated.
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    32
This approach is called \emph{unikernel}. 
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    33
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    34
A \emph{unikernel} is essentially a single, fixed purpose
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    35
program running on a server. Nothing else is running on the
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    36
server, except potentially many instances of this single
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    37
program are run concurrently with the help of a
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    38
hypervisor.\footnote{Xen is a popular hypervisor; it provides
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    39
the mechanism of several virtual machines on a single
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    40
computer.} This single program implements the functionality
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    41
the server offers (for example serving web-pages). The main
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    42
point is that all the services the operating system normally
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    43
provides (network stack, file system, ssh and so on) are not
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    44
used by default in unikernels. Instead, the single program
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    45
uses libraries (the unikernel) whenever some essential
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    46
functionality is needed. The developer only needs to select a
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    47
minimal set of these libraries in order to implement a server
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    48
for web-pages, for example. In this way, ssh, say, is only
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    49
provided, when it is absolutely necessary.
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    50
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    51
Unikernels are a rather recent idea for hardening servers. I
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    52
have not seen any production use of this idea, but there are
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    53
plenty of examples from academia. The advantage of unikernels
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    54
is the rather small footprint in terms of memory, booting
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    55
times and so on (no big operating system is needed). This
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    56
allows unikernels to run on low-coast hardware such as
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    57
Raspberry Pis or Cubieboards, where they can replace much more
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    58
expensive hardware for the same purpose. The low booting times
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    59
of unikernels are also an advantage when your server needs to
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    60
scale up to higher user-demands. Then it is often possible to
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    61
just run another instance of the single program, which can be
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    62
started almost instantly without the user seeing any delay
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    63
(unlike if you have to start, say, Windows and then on top of
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    64
that start your network application). One of the most
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    65
well-known examples of a unikernel is MirageOS available from
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
    66
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    67
\begin{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    68
\url{https://mirage.io}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    69
\end{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    70
 
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    71
\noindent This unikernel is based on the functional
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    72
programming language Ocaml, which provides added security
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    73
(Ocaml does not allow buffer overflow attacks, for example).
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    74
If you want to test the security of MirageOS, the 
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    75
developers issued a Bitcoin challenge: if you can break into 
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
    76
their system at
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    77
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    78
\begin{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    79
\url{http://ownme.ipredator.se}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    80
\end{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    81
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
    82
\noindent 
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
    83
you can get 10 Bitcoins. This is approximately 
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
    84
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    85
However, sometimes you cannot, or do not want to, get rid of
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    86
the operating system. In such cases it is still a good idea
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    87
to minimise the attack surface. For this it helps if the
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    88
network application can be split into two parts---an 
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    89
application and an interface:
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    90
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    91
\begin{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    92
  \begin{tikzpicture}[scale=1]
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    93
  
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    94
  \draw[line width=1mm] (-.3, 0) rectangle (1.5,2);
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    95
  \draw (4.7,1) node {Internet};
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
    96
  \draw (-2.7,1.5) node {\footnotesize 
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
    97
  \begin{tabular}{c}Application\\(dangerous part)\end{tabular}};
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    98
  \draw (0.6,1.7) node {\footnotesize Interface};
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
    99
  \draw (0.6,-0.4) node {\footnotesize \begin{tabular}{c}unprivileged\\[-1mm] process\end{tabular}};
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   100
  \draw (-2.7,-0.4) node {\footnotesize \begin{tabular}{c}privileged\\[-1mm] process\end{tabular}};
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   101
  
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   102
  \draw[line width=1mm] (-1.6, 0) rectangle (-3.8,2);
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   103
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   104
  \draw[white] (1.7,1) node (X) {};
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   105
  \draw[white] (3.7,1) node (Y) {};
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   106
  \draw[<->, line width = 2mm] (X) -- (Y);
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   107
 
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   108
  \draw[<->, line width = 1mm] (-0.4,1) -- (-1.5,1);
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   109
  \end{tikzpicture}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   110
\end{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   111
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   112
\noindent The idea is that all heavy-duty lifting, or
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   113
dangerous operations, in the application (for example database
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   114
access or writing a file) is done by a privileged process. All user input from
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   115
the internet is received by an \emph{un}privileged process,
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   116
which is restricted to only receive user input from the
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   117
Internet and communicates with the privileged process. This
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   118
communication, however, needs to be sanitised, meaning any
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   119
unexpected user-input needs to be rejected. The idea behind
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 404
diff changeset
   120
this split is that if an attacker can take control of the
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   121
\emph{un}privileged process, then he or she cannot do much
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   122
damage. However, the split into such privileged and
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   123
unprivileged processes requires an operating system that
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   124
supports Unix-style access controls, which look at next.
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   125
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   126
\subsubsection*{Unix-Style Access Control}
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   127
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   128
Following the Unix-philosophy that everything is considered as
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   129
a file, even memory, ports and so on, access control in Unix
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   130
is organised around 11 Bits that specify how a file can be
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   131
accessed. These Bits are sometimes called the \emph{permission
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   132
attributes} of a file. There are typically three modes for
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   133
access: \underline{\textbf{r}}ead, \underline{\textbf{w}}rite
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   134
and e\underline{\textbf{x}}ecute. Moreover there are three
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   135
user groups to which the modes apply: the owner of the file,
365
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   136
the group the file is associated with and everybody else. 
366
34a8f73b2c94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 365
diff changeset
   137
A typical permission of a file owned by \texttt{bob} 
34a8f73b2c94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 365
diff changeset
   138
being in the group \texttt{staff} might look as 
365
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   139
follows:
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   140
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   141
\begin{center}
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   142
${\underbrace{\LARGE\texttt{-}}_{\text{\makebox[0mm]{directory}}}}
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   143
 \;{\underbrace{\LARGE\texttt{r{}-{}-}}_{\text{user}}}\,
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   144
 {\underbrace{\LARGE\texttt{r{}w{}-}}_{\text{group}}}\,
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   145
 {\underbrace{\LARGE\texttt{r{}w{}x}}_{\text{other}}}\;\;\;
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   146
 \LARGE\texttt{bob}\;\;\;\texttt{staff}$
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   147
\end{center}
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   148
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   149
\noindent For the moment let us ignore the directory bit. The
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   150
Unix access rules imply that Bob will only have read access to
366
34a8f73b2c94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 365
diff changeset
   151
this file, even if he is in the group \texttt{staff} and this
34a8f73b2c94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 365
diff changeset
   152
group's access permissions allow read and write. Similarly every
365
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   153
member in the \texttt{staff} group who is not \texttt{bob},
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   154
will only have read-write access permissions, not
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   155
read-write-execute.
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   156
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   157
This relatively fine granularity of owner, group, everybody
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   158
else seems to cover many useful scenarios of access control. A
365
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   159
typical example of some files with permission attributes is as
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   160
follows:
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   161
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   162
{\small\lstinputlisting[language={}]{../slides/lst}}
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   163
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   164
\noindent The leading \pcode{d} in Lines 2 and 6 indicate that
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   165
the file is a directory, whereby in the Unix-tradition the
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   166
\pcode{.} points to the directory itself. The \pcode{..}
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   167
points at the directory ``above'', or parent directory. The
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   168
second to fourth letter specify how the owner of the file can
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   169
access the file. For example Line 3 states that \pcode{ping}
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   170
can read and write \pcode{manual.txt}, but cannot execute it.
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   171
The next three letters specify how the group members of the
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   172
file can access the file. In Line 4, for example, all students
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   173
can read and write the file \pcode{report.txt}. Finally the
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   174
last three letters specify how everybody else can access a
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   175
file. This should all be relatively familiar and
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   176
straightforward. No?
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   177
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   178
There are already some special rules for directories and
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   179
links. If the execute attribute of a directory is \emph{not}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   180
set, then one cannot change into the directory and one cannot
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   181
access any file inside it. If the write attribute is
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   182
\emph{not} set, then one can change existing files (provide
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   183
they are changeable), but one cannot create new files. If the
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   184
read attribute is \emph{not} set, one cannot search inside the
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   185
directory (\pcode{ls -la} does not work) but one can access an
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   186
existing file, provided one knows its name. Links to files
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   187
never depend on the permission of the link, but the file they
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   188
are pointing to. Otherwise one could easily change access
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   189
rights to files.
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   190
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   191
While the above might sound already moderately complicated,
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   192
the real complications with Unix-style file permissions
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   193
involve the setuid and setgid attributes. For example the file
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   194
\pcode{microedit} in Line 5 has the setuid attribute set
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   195
(indicated by the \pcode{s} in place of the usual \pcode{x}).
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   196
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   197
The purpose of setuid and setgid is to solve the following
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   198
puzzle: The program \pcode{passwd} allows users to change
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   199
their passwords. Therefore \pcode{passwd} needs to have write
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   200
access to the file \pcode{/etc/passwd}. But this file cannot
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   201
be writable for every user, otherwise anyone can set anyone
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   202
else's password. So changing securely passwords cannot be
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   203
achieved with the simple Unix access rights discussed so far.
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   204
While this situation might look like an anomaly, it is in fact
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   205
an often occurring problem. For example looking at current
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   206
active processes with \pcode{/bin/ps} requires access to
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   207
internal data structures of the operating system, which only
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   208
root should be allowed to. In fact any of the following
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   209
actions cannot be configured for single users, but need
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   210
privileged root access
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   211
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   212
\begin{itemize}
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   213
\item changing system databases (users, groups, routing tables
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   214
and so on)
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   215
\item opening a network port below 1024
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   216
\item interacting with peripheral hardware, such as printers, 
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   217
harddisk etc
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   218
\item overwriting operating system facilities, like
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   219
process scheduling and memory management
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   220
\end{itemize}
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   221
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   222
\noindent This will typically involve quite a lot of programs
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   223
on a Unix system. I counted 90 programs with the setuid
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   224
attribute set on my bog-standard Mac OSX system (including the
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   225
program \pcode{/usr/bin/login}). The problem is that if there
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   226
is a security problem with only one of them, be it a buffer
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   227
overflow for example, then malicious users can gain root
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   228
access (and for outside attackers it is much easier to take
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   229
over a system). Unfortunately it is rather easy to cause a
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   230
security problem since the handling of elevating and dropping
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   231
access rights in such programs rests entirely with the
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   232
programmer.
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   233
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   234
The fundamental idea behind the setuid attribute is that a
252
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   235
file will be able to run not with the callers access rights,
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   236
but with the rights of the owner of the file. So
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   237
\pcode{/usr/bin/login} will always be running with root access
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   238
rights, no matter who invokes this program. The problem is
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   239
that this entails a rather complicated semantics of what the
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   240
identity of a process (that runs the program) is. One would
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   241
hope there is only one such ID, but in fact Unix distinguishes
fa151c0a3cf4 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 251
diff changeset
   242
three(!):
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   243
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   244
\begin{itemize}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   245
\item \emph{real identity}\\ 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   246
This is the ID of the user who creates 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   247
the process; can only be changed to something else by root. 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   248
\item \emph{effective identity}\\ 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   249
This is the ID that is used to 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   250
grant or deny access to a resource; can be changed to either
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   251
the real identity or saved identity by users, can be changed 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   252
to anything by root.
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   253
\item \emph{saved identity}\\
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   254
If the setuid bit set in a file then the process is started
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   255
with the real identity of the user who started the program,
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   256
and the identity of the owner of the program as effective and
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   257
saved identity. If the setuid bit is not set, then the
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   258
saved identity will be the real identity. 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   259
\end{itemize}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   260
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   261
\noindent As an example consider again the \pcode{passwd}
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   262
program. When started by, say the user \pcode{foo}, it has at
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   263
the beginning the identities:
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   264
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   265
\begin{itemize}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   266
\item \emph{real identity}: \pcode{foo}\\
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   267
\emph{effective identity}: \pcode{foo}\\ 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   268
\emph{saved identity}: \pcode{root}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   269
\end{itemize}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   270
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   271
\noindent It is then allowed to change the effective
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   272
identity to the saved identity to have
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   273
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   274
\begin{itemize}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   275
\item \emph{real identity}: \pcode{foo}\\
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   276
\emph{effective identity}: \pcode{root}\\ 
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   277
\emph{saved identity}: \pcode{root}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   278
\end{itemize}
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   279
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   280
\noindent It can now read and write the file
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   281
\pcode{/etc/passwd}. After finishing the job it is supposed to
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   282
drop the effective identity back to \pcode{foo}. This is the
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   283
responsibility of the programmers who wrote \pcode{passwd}.
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   284
Notice that the effective identity is not automatically
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   285
elevated to \pcode{root}, but the program itself must make
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   286
this change. After it has done the work, the effective
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   287
identity should go back to the real identity.
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   288
365
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   289
If you want to play more with access rights in Unix, you can
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   290
use the program in Figure~\ref{test}. It explicitly checks for
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   291
readability and writability of files. The \pcode{main}
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   292
function is organised into two parts: the first checks
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   293
readability and writability with the permissions according to
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   294
a potential setuid bit, and the second (starting in Line 34)
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   295
when the permissions are lowered to the caller. Note that this
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   296
program has one problem as well: it only gives a reliable
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   297
answer in cases a file is {\bf not} readable or {\bf not}
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   298
writable when it returns an error code 13 (permission denied).
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   299
It sometimes claims a file is not writable, say, but with an
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   300
error code 26 (text file busy). This is unrelated to the
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   301
permissions of the file.
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   302
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   303
\begin{figure}[p]
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   304
\small
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   305
\lstinputlisting[language=C]{../progs/read.c}
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   306
\caption{A read/write test program in C. It returns errno = 13 
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   307
in cases when permission is denied.\label{test}}
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   308
\end{figure}
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   309
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   310
Despite this complicated semantics, Unix-style access control
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   311
is of no use in a number of situations. For example it cannot
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   312
be used to exclude some subset of people, but otherwise have
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   313
files readable by everybody else (say you want to restrict
365
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   314
access to a file such that your office mates cannot access a
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   315
file). You could try setting the group of the file to this
251
64e62d636737 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 249
diff changeset
   316
subset and then restrict access accordingly. But this does not
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   317
help, because users can drop membership in groups. If one
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   318
needs such fine-grained control over who can access a file,
365
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   319
one needs more powerful \emph{mandatory access controls} as
942205605c30 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 283
diff changeset
   320
described next.
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   321
248
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   322
247
95e14b2dbc94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 245
diff changeset
   323
\subsubsection*{Secrecy and Integrity}
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   324
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   325
Often you need to keep information secret within a system or
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   326
organisation, or secret from the ``outside world''. An example
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   327
would be to keep insiders from leaking information to
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   328
competitors. The secrecy levels used in the military are an
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   329
instance of such an access control system. There you
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   330
distinguish usually four secrecy levels:
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   331
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   332
\begin{itemize}
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   333
\item top secret
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   334
\item secret
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   335
\item confidential
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   336
\item unclassified
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   337
\end{itemize}
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   338
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   339
The idea is that the secrets classified as top-secret are most
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   340
closely guarded and only accessible to people who have a
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   341
special clearance. The unclassified category is the lowest
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   342
level not needing any clearance. While the idea behind these
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   343
security levels is quite straightforward, there are some
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   344
interesting phenomenons that you need to think about when
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   345
realising such a system. First this kind of access control
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   346
needs to be \emph{mandatory} as opposed to
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   347
\emph{discretionary}. With discretionary access control, the
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   348
users can decide how to restrict or grant access to resources.
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   349
With mandatory access control, the access to resources is
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   350
enforced ``system-wide'' and cannot be controlled by the user.
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   351
There would be no point to let users set the secrecy level,
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   352
because if they want to leak information they would set it to
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   353
the lowest. Even if there is no malicious intent, it could
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   354
happen that somebody by accident sets the secrecy level too
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   355
low for a document. Note also that the secrecy levels are in
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   356
tension with the Unix-style access controls. There root is
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   357
allowed to do everything, but in a system enforcing secrecy,
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   358
you might not like to give root such powers. 
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   359
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   360
There are also some interesting rules for reading and writing
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   361
a resource that need to be enforced: 
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   362
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   363
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   364
\begin{itemize}
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   365
\item {\bf Read Rule}: a principal $P$ can read a resource $O$
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   366
      provided $P$'s security level is at least as high as
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   367
      $O$'s
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   368
\item {\bf Write Rule}: a principal $P$ can write a resource
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   369
      $O$ provided $O$'s security level is at least as high as
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   370
      $P$'s 
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   371
\end{itemize} 
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   372
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   373
\noindent The first rule implies that a principal with secret
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   374
clearance can read secret documents or lower, but not
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   375
documents classified top-secret. The second rule for writing
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   376
needs to be the other way around: someone with secret
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   377
clearance can write secret or top-secret documents---no
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   378
information is leaked in these cases. In contrast the
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   379
principal cannot write confidential documents, because then
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   380
information can be leaked to lower levels. These rules about
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   381
enforcing secrecy with multi-level clearances are often called
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   382
\emph{Bell/LaPadula} model, named after two people who studied
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   383
such systems.
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   384
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   385
A problem with this kind of access control system is when two
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   386
people want to talk to each other but are assigned different
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   387
security clearances, say secret and confidential. In these
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   388
situations, the people with the higher clearance have to lower
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   389
their security level and are not allowed to take any document
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   390
from the higher level with them to the lower level (otherwise
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   391
information could be leaked). In actual systems, this
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   392
might mean that people need to log out and log into the system
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   393
again---this time with credentials for the lower level.
257
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   394
9bc912fcedb6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 252
diff changeset
   395
While secrecy is one property you often want to enforce,
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   396
integrity is another. This property ensures that nobody
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   397
without adequate clearance can change, or tamper with,
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   398
systems. An example for this property is a \emph{fire-wall},
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   399
which isolates a local system from threads from the 
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   400
Internet, for example. The rule for such a system is
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   401
that somebody from inside the fire-wall can write resources
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   402
outside the firewall, but you cannot write a resource inside 
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   403
the fire-wall from outside. Otherwise an outside can just
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   404
tamper with a system in order to break in. In contrast
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   405
we can read resources from inside the fire-wall, for example
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   406
web-pages. But we cannot read anything from outside the 
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   407
fire-wall. Lest we might introduce a virus into the system
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   408
(behind the fire-wall). In effect in order to ensure
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   409
integrity the read and write rules are reversed from the
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   410
case of secrecy:
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   411
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   412
\begin{itemize}
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   413
\item {\bf Read Rule}: a principal $P$ can read a resource $O$
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   414
      provided $P$'s security level is lower or equal than
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   415
      $O$'s
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   416
\item {\bf Write Rule}: a principal $P$ can write a resource
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   417
      $O$ provided $O$'s security level is lower or equal than
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   418
      $P$'s 
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   419
\end{itemize} 
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   420
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   421
\noindent This kind of access control system is called
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   422
\emph{Biba} model, named after Kenneth Biba. Its purpose is to
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   423
prevent data modification by unauthorised principals.
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   424
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   425
The somewhat paradoxical result of the different reading and
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   426
writing rules in the \emph{\mbox{Bell}/LaPadula} and
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   427
\emph{Biba} models is that we cannot have secrecy and
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   428
integrity at the same time in a system, or they need to be
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   429
enforced by different means.
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   430
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   431
\subsubsection*{Multi-Agent Access Control}
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   432
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   433
In military or banking, for example, very critical decisions
263
8a42736cce27 updated 5th handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   434
need to be made using a \emph{two-people rule}. This means such
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   435
decisions need to be taken by two people together, so that no
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   436
single person can defraud a bank or start a nuclear war (you
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   437
will know what I mean if you have seen the classic movie ``Dr
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   438
Strangelove or: How I Learned to Stop Worrying and Love the
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   439
Bomb''\footnote{\url{http://en.wikipedia.org/wiki/Dr._Strangelove}}).
263
8a42736cce27 updated 5th handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   440
Translating the two-people rule into a software system seems not
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   441
as straightforward as one might think.
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   442
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   443
Let us assume we want to implement a system where CEOs can
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   444
make decisions on their own, for example whether or not to
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   445
sell assets, but two managing directors (MDs) need to come
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   446
together to make the same decision. If ``lowly'' directors
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   447
(Ds) want to take this decision, three need to come together.
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   448
Remember cryptographic keys are just sequences of bits. A
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   449
naive solution to the problem above is to split the necessary
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   450
key into $n$ parts according to the ``level'' where the
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   451
decision is taken. For example one complete key for a CEO, 
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   452
halves of the key for the MDs and thirds for the Ds. The
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   453
problem with this kind of sharing a key is that there might be
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   454
many hundreds MDs and Ds in your organisations. Simple-minded
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   455
halving or devision by three of the key just does not work.
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   456
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   457
A much more clever solution was proposed by Blakley and Shamir
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   458
in 1979. This solution is inspired by some simple geometric
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   459
laws. Suppose a three-dimentional axis system. We can, clearly,
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   460
specify a point on the $z$-axis, say, by specifying its
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   461
coordinates. But we could equally specify this point by a line
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   462
that intersects the $z$-axis in this point. How can a line be
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   463
specified? Well, by giving two points in space. But as you
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   464
might remember from school days, we can specify the point also
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   465
by a plane intersecting the $z$-axis and a plane can be
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   466
specified by three points in space. This could be pictured as
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   467
follows:
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   468
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   469
\begin{center}
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   470
\includegraphics[scale=0.45]{../pics/pointsplane.jpg}
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   471
\end{center}
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   472
404
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   473
%\begin{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   474
%\begin{tikzpicture}
%
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   475
%  \draw[->,line width=0.5mm] (0,0,0) -- (2,0,0);
%  \draw[->,line width=0.5mm] (0,0,0) -- (0,2,0);
%  \draw[->,line width=0.5mm] (0,0,0) -- (0,0,2);
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   476
%  
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   477
%  \path[draw] (-1,-4) to[out=20,in=220] (3,3);
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   478
%  \path[draw] (6,-7) to[out=40,in=210] (9,1);
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   479
%  \path[draw] (-1,-4) to[out=0,in=80] (6,-7);
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   480
%  \path[draw] (3,3) to[out=10,in=140] (9,1);
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   481
%
%\end{tikzpicture}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   482
%\end{center}
4e3bc09748f7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   483
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   484
\noindent The idea is to use the points as keys for each level
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   485
of shared access. The CEO gets the point directly. The MDs get
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   486
keys lying on a line and the Ds get keys lying on the plane.
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   487
Clever, no? Scaling this idea to more dimensions allows for
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   488
even more levels of access control and more interesting access
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   489
rules, like one MD and 2 Ds can take a decision together.
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   490
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   491
Is such a shared access control used in practice? Well
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   492
military command-chains are obviously organised like this.
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   493
But in software systems often need to rely on data that might
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   494
not be entirely accurate. So the CEO-level would correspond
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   495
to the in-house data-source that you can trust completely.
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   496
The MD-level would correspond to simple errors where you need
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   497
three inputs and you decide on what to do next according to
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   498
what at least two data-sources agree (the third source 
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   499
is then disregarded, because it is assumed it contains an 
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   500
error). If your data contains not just simple errors, you
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   501
need levels corresponding to Ds.
260
42bf66f0a903 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 257
diff changeset
   502
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   503
248
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   504
\subsubsection*{Further Information}
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   505
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   506
If you want to know more about the intricacies of the
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   507
``simple'' Unix access control system you might find the
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   508
relatively readable paper about ``Setuid Demystified'' 
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   509
useful.
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   510
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   511
\begin{center}\small
249
31a749eba8c1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 248
diff changeset
   512
\url{http://www.cs.berkeley.edu/~daw/papers/setuid-usenix02.pdf}
248
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   513
\end{center}
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   514
261
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   515
\noindent About secrecy and integrity, and shared access
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   516
control I recommend to read the chapters on ``Nuclear Command
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   517
and Control'' and ``Multi-Level Security'' in Ross Anderson's
e7a31a247e5a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 260
diff changeset
   518
Security Engineering book (whose first edition is free).
248
51fa0549fc8f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 247
diff changeset
   519
245
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   520
\end{document}
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   521
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   522
%%% Local Variables: 
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   523
%%% mode: latex
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   524
%%% TeX-master: t
630a3dd1efda updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   525
%%% End: