handouts/ho05.tex
changeset 285 2492b771122e
parent 283 40511897fcc4
child 286 47e06cb75837
equal deleted inserted replaced
284:71136e7964cc 285:2492b771122e
    14 happened.\footnote{\url{http://en.wikipedia.org/wiki/Fractal},
    14 happened.\footnote{\url{http://en.wikipedia.org/wiki/Fractal},
    15 \url{http://en.wikipedia.org/wiki/Mandelbrot_set}} Protocols
    15 \url{http://en.wikipedia.org/wiki/Mandelbrot_set}} Protocols
    16 are similar: they are simple exchanges of messages, but in the
    16 are similar: they are simple exchanges of messages, but in the
    17 end something ``magical'' can happen---for example a secret
    17 end something ``magical'' can happen---for example a secret
    18 channel has been established or two entities have
    18 channel has been established or two entities have
    19 authenticated themselves to each other. Even in face of strong
    19 authenticated themselves to each other. This can happen even
    20 adversaries where we have no control over the network over
    20 in face of strong adversaries who have complete control over
    21 which our messages are exchanged. The problem with magic is of
    21 the network involved in the message exchange. The problem with
    22 course it is poorly understood and even experts often got, and
    22 magic is of course it is poorly understood and even experts
    23 get, it wrong with protocols.
    23 often got, and get, it wrong with protocols.
    24 
    24 
    25 To have an idea what kind of protocols we are interested in, let
    25 To have an idea what kind of protocols we are interested in, let
    26 us look at a few examples. One example are (wireless) key 
    26 us look at a few examples. One example are (wireless) key 
    27 fobs, which operate the central locking system and the
    27 fobs, which operate the central locking system and the
    28 ignition in a car.
    28 ignition in a car.
    49 A second thief ``listens'' to the signals from the car and
    49 A second thief ``listens'' to the signals from the car and
    50 wirelessly transmits them to the ``colleague'' who followed
    50 wirelessly transmits them to the ``colleague'' who followed
    51 you. This thief silently enquires what the key fob answers.
    51 you. This thief silently enquires what the key fob answers.
    52 This answer is then send back to the thief at the car. If done
    52 This answer is then send back to the thief at the car. If done
    53 properly the car will dutifully open and possibly start. No
    53 properly the car will dutifully open and possibly start. No
    54 need to steal your keys anymore.
    54 need to steal your keys anymore. 
       
    55 That this is an attack one needs to reckon with is
       
    56 demonstrated by the fact that certain dodgy
       
    57 websites\footnote{\url{http://autokeydevices.com/product/wave/}
       
    58 \ldots{} funnily this webpage says ``not intended for illegal
       
    59 use'', but I have a hard time finding any legal purpose for
       
    60 such a device.} sell the necessary equipment for top Ruble.
       
    61 This webpage is notable for the very helpful picture
       
    62 of a person-in-the-middle attack (see Figure~\ref{rsa}).
       
    63 
       
    64 \begin{figure}[t]
       
    65 \begin{center}
       
    66 \includegraphics[scale=0.15]{../pics/rsa_attack_eng.jpg}
       
    67 \end{center}
       
    68 \caption{From a dodgy webpage about modern car theft. Note the
       
    69 stylish attackers Malice and Mallet.\label{rsa}}
       
    70 \end{figure}
       
    71 
    55 
    72 
    56 But there are many more such protocols we like to treat.
    73 But there are many more such protocols we like to treat.
    57 Another example is Wifi---you might sit at a Starbucks and
    74 Another example is Wifi---you might sit at a Starbucks and
    58 talk wirelessly to the free access point there and from there
    75 talk wirelessly to the free access point there and from there
    59 talk to your bank. Moreover, even if your have to touch your
    76 talk to your bank (see The Guardian article cited at the very
    60 Oyster card at the reader each time you enter or exit the
    77 end of this handout). Moreover, even if your have to touch
       
    78 your Oyster card at the reader each time you enter or exit the
    61 Tube, it actually operates wirelessly and with appropriate
    79 Tube, it actually operates wirelessly and with appropriate
    62 equipment over some quite large distance (several meters). But
    80 equipment over some quite large distance (several meters). But
    63 there are many, many more examples (Bitcoins, mobile
    81 there are many, many more examples (Bitcoins, mobile
    64 phones,\ldots). The common characteristics of the protocols we
    82 phones,\ldots). 
    65 are interested in is that an adversary or attacker is assumed
    83 
    66 to be in complete control over the network or channel over
    84 The common characteristics of the protocols we are interested
    67 which we exchanging messages. An attacker can install a packet
    85 in is that an adversary or attacker is assumed to be in
    68 sniffer on a network, inject packets, modify packets, replay
    86 complete control over the network or channel over which we
    69 old messages, or fake pretty much everything else. In this
    87 exchanging messages. An attacker can install a packet sniffer
    70 hostile environment, the purpose of a protocol (that is
    88 on a network, inject packets, intercept packets modify
    71 exchange of messages) is to achieve some security goal. For
    89 packets, replay old messages, or fake pretty much everything
    72 example only allow the owner of the car in, but everybody else
    90 else. In this hostile environment, the purpose of a protocol
    73 should stay out.
    91 (that is exchange of messages) is to achieve some security
       
    92 goal. For example only allow the owner of the car in, but
       
    93 everybody else should be kept out.
    74 
    94 
    75 The protocols we are interested here are generic descriptions
    95 The protocols we are interested here are generic descriptions
    76 of how to exchange messages in order to achieve a goal. Unlike
    96 of how to exchange messages in order to achieve a goal. Unlike
    77 the distant past where, for example, we had to meet a person in
    97 the distant past where, for example, we had to meet a person in
    78 order to authenticate him or her (via a passport for example),
    98 order to authenticate him or her (via a passport for example),
    90 in turn with something like ``thanks''. This protocol
   110 in turn with something like ``thanks''. This protocol
    91 is often called a \emph{three-way handshake}. Graphically it
   111 is often called a \emph{three-way handshake}. Graphically it
    92 can be illustrated as follows
   112 can be illustrated as follows
    93 
   113 
    94 \begin{center}
   114 \begin{center}
    95 \includegraphics[scale=0.5]{../pics/handshake.png}
   115 \includegraphics[scale=0.45]{../pics/handshake.png}
    96 \end{center}
   116 \end{center}
    97 
   117 
    98 \noindent On the left-hand side is a client, say Alice, on the
   118 \noindent On the left-hand side is a client, say Alice, on the
    99 right-hand side is a server, say. Time is running from top to
   119 right-hand side is a server, say. Time is running from top to
   100 bottom. Alice initial SYN message needs some time to travel to
   120 bottom. Alice initial SYN message needs some time to travel to
   101 the server. The server answers with SYN-ACK, which will
   121 the server. The server answers with SYN-ACK, which will
   102 require some time to arrive at Alice. Her answer ACK will
   122 require some time to arrive at Alice. Her answer ACK will
   103 again take some time to arrive at the server. After the 
   123 again take some time to arrive at the server. After the
   104 messages are exchanged Alice and the server simply have 
   124 messages are exchanged, Alice and the server simply have
   105 established a channel to communicate over. Alice does
   125 established a channel to communicate over. Alice does not know
   106 not know whether she is really talking to the server (somebody 
   126 whether she is really talking to the server (somebody else on
   107 else on the network might have intercepted her message
   127 the network might have intercepted her message and replied in
   108 and replied in place of the server). Similarly, the
   128 place of the server). Similarly, the server has no idea who it
   109 server has no idea who it is talking to. That this can be 
   129 is talking to. Whether they can authenticate themselves
   110 established depends on what is exchanged next and is the
   130 depends on what is exchanged next and is the point of the
   111 point of the protocols we want to study in more detail.
   131 protocols we want to study in more detail.
   112 
   132 
   113 Before we start in earnest, we need to fix a more
   133 Before we start in earnest, we need to fix a more convenient
   114 convenient notation for protocols. Drawing pictures like
   134 notation for protocols. Drawing pictures like the one above
   115 the one above would be awkward in the long-run. The
   135 would be awkward in the long-run. The notation we will adopt
   116 notation already abstracts away from a few details we are
   136 abstracts away from a few details we are not interested in:
   117 not interested in: for example the time the messages
   137 for example the time the messages need to travel between
   118 need to travel between endpoints. What we are interested
   138 endpoints. What we are interested in is in which order the
   119 in is in which order the messages are sent. For the SYN-ACK
   139 messages are sent. For the SYN-ACK protocol we will therefore
   120 protocol we will therefore use the notation 
   140 use the notation 
   121 
   141 
   122 
   142 
   123 \begin{equation}
   143 \begin{equation}
   124 \begin{array}{l@{\hspace{2mm}}l}
   144 \begin{array}{l@{\hspace{2mm}}l}
   125 A \to S: & SYN\\
   145 A \to S: & SYN\\
   131 
   151 
   132 \noindent The left-hand side specifies who is the sender and
   152 \noindent The left-hand side specifies who is the sender and
   133 who is the receiver of the message. On the right of the colon
   153 who is the receiver of the message. On the right of the colon
   134 is the message that is send. The order from top to down
   154 is the message that is send. The order from top to down
   135 specifies in which order the messages are sent. We also
   155 specifies in which order the messages are sent. We also
   136 have the convention that messages like above $SYN$ are send
   156 have the convention that messages, like $SYN$ above, are send
   137 in clear-text over the network. If we want that a message is 
   157 in clear-text over the network. If we want that a message is 
   138 encrypted, then we use the notation
   158 encrypted, then we use the notation
   139 
   159 
   140 \[
   160 \[
   141 \{msg\}_{K_{AB}}
   161 \{msg\}_{K_{AB}}
   143   
   163   
   144   
   164   
   145 \noindent for messages. The curly braces indicate a kind of
   165 \noindent for messages. The curly braces indicate a kind of
   146 envelope which can only be opened if you know the key $K_{AB}$
   166 envelope which can only be opened if you know the key $K_{AB}$
   147 with which the message has been encrypted. We always assume
   167 with which the message has been encrypted. We always assume
   148 that an attacker, say Eve, cannot get the content of the
   168 that an attacker, say Eve, cannot get to the content of the
   149 message, unless she is also in the possession of the key. We
   169 message, unless she is also in the possession of the key. We
   150 explicitly exclude in our study that the encryption can be
   170 explicitly exclude in our study that the encryption can be
   151 broken.\footnote{\ldots{}which of course is what a good
   171 broken.\footnote{\ldots{}which of course is what a good
   152 protocol designer needs to ensure and more often than not
   172 protocol designer needs to ensure and more often than not
   153 protocols are broken. For example Oyster cards contain a very
   173 protocols are broken because of a weak encryption method. For
   154 weak encryption mechanism which has been attacked.} It is also
   174 example Oyster cards contain a very weak encryption mechanism
       
   175 which has been attacked and broken.} It is also
   155 possible that an encrypted message contains several parts. In
   176 possible that an encrypted message contains several parts. In
   156 this case we would write something like
   177 this case we would write something like
   157 
   178 
   158 \[
   179 \[
   159 \{msg_1, msg_2\}_{K_{AB}}
   180 \{msg_1, msg_2\}_{K_{AB}}
   168 \{\{msg\}_{K_{AB}}\}_{K_{BC}}
   189 \{\{msg\}_{K_{AB}}\}_{K_{BC}}
   169 \] 
   190 \] 
   170 
   191 
   171 \noindent The idea is that even if attacker Eve has the
   192 \noindent The idea is that even if attacker Eve has the
   172 key $K_{BC}$ she could decrypt the outer envelop, but
   193 key $K_{BC}$ she could decrypt the outer envelop, but
   173 still do not get to the message, because it is still
   194 still does not get to the message, because it is still
   174 encrypted with the key $K_{AB}$. Note, however,
   195 encrypted with the key $K_{AB}$. Note, however,
   175 while an attacker cannot obtain the content of the message
   196 while an attacker cannot obtain the content of the message
   176 without the key, encrypted messages can be observed
   197 without the key, encrypted messages can be observed
   177 and be recorded and then replayed at another time, or
   198 and be recorded and then replayed at another time, or
   178 send to another person!
   199 send to another person!
   179 
   200 
   180 Another very important point is that the notation for
   201 Another very important point is that our notation for
   181 protocols such as shown in \eqref{SYNACK} is a
   202 protocols such as shown in \eqref{SYNACK} is a
   182 \underline{schema} how the protocol should proceed.
   203 \underline{schema} how the protocol should proceed.
   183 It could be instantiated by an actual protocol run
   204 It could be instantiated by an actual protocol run
   184 between Alice, say, and the server Calcium at King's. In this 
   205 between Alice, say, and the server Calcium at King's. In this 
   185 case the specific instance would look like
   206 case the specific instance would look like
   207 \noindent And these two instances of the protocol could be
   228 \noindent And these two instances of the protocol could be
   208 running in parallel or be at different stages. So the protocol
   229 running in parallel or be at different stages. So the protocol
   209 schema shown in \eqref{SYNACK} can be thought of how two 
   230 schema shown in \eqref{SYNACK} can be thought of how two 
   210 programs need to run on the side of $A$ and $S$ in order to 
   231 programs need to run on the side of $A$ and $S$ in order to 
   211 successfully complete the protocol. But it is really just a 
   232 successfully complete the protocol. But it is really just a 
   212 blue print how the communication is supposed to proceed. 
   233 blueprint for how the communication is supposed to proceed. 
   213 
   234 
   214 This is actually already a way how such protocols can fail. 
   235 This is actually already a way how such protocols can fail.
   215 Although very simple the $SYN\_ACK$ protocol can cause 
   236 Although very simple, the $SYN\_ACK$ protocol can cause
   216 headaches for system administrators where an attacker
   237 headaches for system administrators where an attacker starts
   217 starts the protocol, but does not complete it. This looks 
   238 the protocol, but then does not complete it. This looks
   218 graphically like
   239 graphically like
   219 
   240 
   220 \begin{center}
   241 \begin{center}
   221 \includegraphics[scale=0.4]{../pics/synflood.png}
   242 \includegraphics[scale=0.4]{../pics/synflood.png}
   222 \end{center}
   243 \end{center}
   223 
   244 
   224 \noindent The attacker sends lots of $SYN$ requests which the
   245 \noindent The attacker sends lots of $SYN$ requests which the
   225 server dutifully answers, but needs to keep track of such
   246 server dutifully answers. But in doing so the server needs to
   226 protocol exchanges. So every time a little bit of memory
   247 keep track of such protocol exchanges. As a result every time
   227 resource will be eaten away on the server side until all
   248 the protocol is initiated a little bit of memory will be eaten
   228 resources are exhausted and when Alice tries to contact the
   249 away on the server side until all memory is exhausted. When
   229 server then the server is overwhelmed and does not respond
   250 poor Alice then tries to contact the server, it is overwhelmed
   230 anymore. This kind of attack are called \emph{SYN
   251 and does not respond anymore. This kind of attack is called
       
   252 \emph{SYN
   231 floods}.\footnote{\url{http://en.wikipedia.org/wiki/SYN_flood}}
   253 floods}.\footnote{\url{http://en.wikipedia.org/wiki/SYN_flood}}
   232 
   254 
   233 After reading four pages, you might be wondering where the
   255 After reading four pages, you might be wondering where the
   234 magic is. For this let us take a closer look at authentication 
   256 magic is with protocols. For this let us take a closer look at
   235 protocols.
   257 authentication protocols.
   236 
   258 
   237 \subsubsection*{Authentication Protocols}
   259 \subsubsection*{Authentication Protocols}
   238 
   260 
   239 The simplest authentication protocol between principals
   261 The simplest authentication protocol between principals
   240 $A$ and $B$, say is
   262 $A$ and $B$, say is
   241 
   263 
   242 \begin{center}
   264 \begin{center}
   243 $A \to B: K_{AB}$ 
   265 $A \to B: K_{AB}$ 
   244 \end{center}
   266 \end{center}
   245 
   267 
   246 \noindent It can be sought of as $A$ sends a common secret to
   268 \noindent It can be thought of as $A$ sends a common secret to
   247 $B$ like a password. The idea is that if only $A$ and $B$ know
   269 $B$, for example a password. The idea is that if only $A$ and
   248 the key $K_{AB}$ then this should be sufficient for $B$ to
   270 $B$ know the key $K_{AB}$ then this should be sufficient for
   249 infer it is talking to $A$. But this is of course too naive,
   271 $B$ to infer it is talking to $A$. But this is of course too
   250 if the message can be observed by everybody else on the
   272 naive in the context where the message can be observed by
   251 network. Eve could just record this message $A$ just send, and
   273 everybody else on the network. Eve, for example, could just
   252 next time send the same message to $B$ and $B$ would believe
   274 record this message $A$ just sent, and next time send the same
   253 it talked to $A$. But actually it talked to Eve which now
   275 message to $B$. $B$ has no other choice than believing it
   254 clears out $A$s back account if $B$ had been a bank.
   276 talks to $A$. But actually it talks to Eve, who now clears
       
   277 out $A$'s back account assuming $B$ had been a bank.
   255 
   278 
   256 A more sophisticated protocol which tries to avoid the
   279 A more sophisticated protocol which tries to avoid the
   257 replay attack is as follows
   280 replay attack is as follows
   258 
   281 
   259 \begin{center}
   282 \begin{center}
   262 $B \to A:$ & $N$\\
   285 $B \to A:$ & $N$\\
   263 $A \to B:$ & $\{N\}_{K_{AB}}$\\
   286 $A \to B:$ & $\{N\}_{K_{AB}}$\\
   264 \end{tabular}
   287 \end{tabular}
   265 \end{center} 
   288 \end{center} 
   266 
   289 
   267 \noindent With this protocol the idea is that $A$ first sends 
   290 \noindent With this protocol the idea is that $A$ first sends
   268 a message to $B$ saying ``I want to talk to you''. $B$ sends 
   291 a message to $B$ saying ``I want to talk to you''. $B$ sends
   269 then a challenge in form of a random number $N$. In protocols 
   292 then a challenge in form of a random number $N$. In protocols
   270 such random numbers are often called \emph{nonce}. What is the
   293 such random numbers are often called \emph{nonce}. What is the
   271 purpose of this nonce? Well, if an attacker records $A$ 
   294 purpose of this nonce? Well, if an attacker records $A$'s
   272 answer, it will not make sense to replay this message, because
   295 answer, it will not make sense to replay this message, because
   273 next time this protocol is run the nonce $B$ sends will be
   296 next time this protocol is run, the nonce $B$ sends out will
   274 different. So if we run this protocol, what can $B$ infer:
   297 be different. So if we run this protocol, what can $B$ infer?
   275 it has send out an (unpredictable) nonce to $A$ and
   298 It has send out an (unpredictable) nonce to $A$ and received
   276 received this challenge back, but encoded under the key 
   299 this challenge back, but encoded under the key $K_{AB}$. If
   277 $K_{AB}$. If $B$ assumes only $A$ and $B$ know the key $K_{AB}$
   300 $B$ assumes only $A$ and $B$ know the key $K_{AB}$ and the
   278 and the nonce is unpredictable, then $B$ is able to
   301 nonce is unpredictable, then $B$ is able to infer it must be
   279 infer it must be talking to $A$. Of course the implicit 
   302 talking to $A$. Of course the implicit assumption on this
   280 assumption on this inference are that nobody else knows
   303 inference is that nobody else knows about the key $K_{AB}$
   281 about the key $K_{AB}$ and nobody else can decrypt the
   304 and nobody else can decrypt the message. $B$ of course can
   282 message. $B$ of course can decrypt the answer from $A$
   305 decrypt the answer from $A$ and check whether the answer
   283 and check whether the answer corresponds to the challenge
   306 corresponds to the challenge (nonce) $B$ has sent earlier.
   284 (nonce) $B$ has send earlier.
   307 
   285 
   308 But what about $A$? Can $A$ make any inferences about whom it
   286 But what about $A$? Can $A$ make any assumptions about who it
       
   287 talks to? It dutifully answered the challenge and hopes its
   309 talks to? It dutifully answered the challenge and hopes its
   288 bank, say, will be the only one to understand her answer. But
   310 bank, say, will be the only one to understand her answer. But
   289 is this the case? No! Lets consider an attacker Eve who has
   311 is this the case? No! Let us consider again an attacker Eve
   290 control over the network. She could have intercepted the
   312 who has control over the network. She could have intercepted
   291 message $HELLO$ and just replied herself to $A$ using a random
   313 the message $HELLO$ and just replied herself to $A$ using a
   292 number\ldots{} for example one which she observed in a
   314 random number\ldots{}for example one which she observed in a
   293 previous run of this protocol. Remember that if a message is
   315 previous run of this protocol. Remember that if a message is
   294 send without curly braces it is sent in clear text. Then
   316 sent without curly braces it is sent in clear text. $A$ would
   295 $A$ would encrypt the nonce with the key $K_{AB}$ and send
   317 encrypt the nonce with the key $K_{AB}$ and send it back to
   296 it back to Eve. She just throws the answer away. $A$ would
   318 Eve. She just throws away the answer. $A$ would hope that she
   297 hope that she talked to $B$ because she followed the protocol,
   319 talked to $B$ because she followed the protocol, but
   298 but unfortunately she cannot be sure who she is talking to. 
   320 unfortunately she cannot be sure who she is talking to---it 
       
   321 might be Eve. 
   299 
   322 
   300 The solution is to follow a \emph{mutual challenge-response}
   323 The solution is to follow a \emph{mutual challenge-response}
   301 protocol. There $A$ already starts off with a challenge (nonce)
   324 protocol. There $A$ already starts off with a challenge (nonce)
   302 on her own.
   325 on her own.
   303 
   326 
   310 \end{center}
   333 \end{center}
   311 
   334 
   312 \noindent As seen, $B$ receives this nonce, $N_A$, adds his
   335 \noindent As seen, $B$ receives this nonce, $N_A$, adds his
   313 own nonce, $N_B$ and encrypts it with the key $K_{AB}$. $A$
   336 own nonce, $N_B$ and encrypts it with the key $K_{AB}$. $A$
   314 receives this message, is able to decrypt it since we assume
   337 receives this message, is able to decrypt it since we assume
   315 she has the key $K_{AB}$, and sends back the nonce of $B$.
   338 she has the key $K_{AB}$ too, and sends back the nonce of $B$.
   316 Let us analyse which assumptions $A$ and $B$ can make after 
   339 Let us analyse which inferences $A$ and $B$ can make after the
   317 the protocol has run. $B$ received a challenge and answered 
   340 protocol has run. $B$ received a challenge and answered
   318 correctly to $A$ (in the encrypted message). An attacker
   341 correctly to $A$ (inside the encrypted message). An attacker
   319 would just not be able to answer this challenge correctly 
   342 would not be able to answer this challenge correctly because
   320 because the attacker is assumed to not be in the possession of
   343 the attacker is assumed to not be in the possession of the key
   321 the key $K_{AB}$; so could not have formed this message.
   344 $K_{AB}$; so is not able to generate this message. It could
   322 It could also not have just replayed an old message, because
   345 also not have been that it is an old message replayed, because
   323 $A$ would send out each time a fresh nonce. So with this
   346 $A$ would send out each time a fresh nonce. So with this
   324 protocol you can ensure also for $A$ that it talks to $B$.
   347 protocol you can ensure also for $A$ that it talks to $B$. I
   325 I leave you to argue that $B$ can be sure to talk to $A$.
   348 leave you to argue that $B$ can be sure to talk to $A$. Of
   326 Of course these arguments will depend on the assumptions that
   349 course these arguments will depend on the assumptions that
   327 only $A$ and $B$ know the key $K_{AB}$ and that nobody can
   350 only $A$ and $B$ know the key $K_{AB}$ and that nobody can
   328 break the encryption unless they have this key and that the
   351 break the encryption unless they have this key and that the
   329 nonces are fresh each time the protocol is run.
   352 nonces are fresh each time the protocol is run.
   330 
   353 
   331 There might be something mysterious about the nonces, the
   354 The purpose of the nonces, the random numbers that are sent
   332 random numbers, that are sent around. They need to be
   355 around, might be a bit opaque. Because they are unpredictable
   333 unpredictable and in this way fulfil an important role in
   356 they fulfil an important role in protocols. Suppose
   334 protocols. Suppose
       
   335 
   357 
   336 \begin{enumerate}
   358 \begin{enumerate}
   337 \item I generate a nonce and send it to you encrypted with a
   359 \item I generate a nonce and send it to you encrypted with a
   338       key we share
   360       key we share
   339 \item you increase it by one, encrypt it under a key I know
   361 \item you increase it by one, encrypt it under a key I know
   357       deflected by somebody on the network, because the
   379       deflected by somebody on the network, because the
   358       response required some calculation; doing the
   380       response required some calculation; doing the
   359       calculation and sending the answer requires the key
   381       calculation and sending the answer requires the key
   360       $K_{IY}$)
   382       $K_{IY}$)
   361 
   383 
   362 \item you could only have generated your answer after I send
   384 \item you could only have generated your answer after I have
   363       you my initial message (since my $N$ is always new, it
   385       sent you my initial message (since my $N$ is always new,
   364       could not have been a message that was generated before
   386       it could not have been a message that was generated
   365       I myself knew what $N$ is)
   387       before I myself knew what $N$ is)
   366 
   388 
   367 \item if only you and me know the key $K_{IY}$, the message
   389 \item if only you and me know the key $K_{IY}$, the message
   368       must have come from you
   390       must have come from you
   369 \end{itemize}
   391 \end{itemize}
   370 
   392 
   371 \noindent Even if this does not seem much information I can
   393 \noindent Even if this does not seem much information I can
   372 glean from such an exchange, it is in fact the basic building 
   394 glean from such an exchange, it is in fact the basic building
   373 blocks for establishing some secret or achieving some 
   395 block in protocols for establishing some secret or for
   374 security goal (like authentication).
   396 achieving some security goal (like authentication).
   375 
   397 
   376 While the mutual challenge-response protocol solves already
   398 While the mutual challenge-response protocol solves the
   377 the authentication problem, there are some problems. One is of
   399 authentication problem, there are some limitations. One is of
   378 course that it requires a pre-shared secret key. That is
   400 course that it requires a pre-shared secret key. That is
   379 something that needs to be established beforehand. Not all
   401 something that needs to be established beforehand. Not all
   380 situations allow such an assumption. For example if I am a
   402 situations allow such an assumption. For example if I am a
   381 whistle blower (say Snowden) and want to talk to a journalist
   403 whistleblower (say Snowden) and want to talk to a journalist
   382 (say Greenwald) then I might not have a secret pre-shared key.
   404 (say Greenwald) then I might not have a secret pre-shared key.
   383 
   405 
   384 
   406 Another limitation is that such mutual challenge-response
   385 Another problem is that such mutual challenge-response systems
   407 systems often work in the same system in the ``challenge
   386 often work in the same system in the ``challenge mode'' but
   408 mode'' but also in the ``response mode''. For example if two
   387 also in the ``response mode''. For example if two servers want
   409 servers want to talk to each other---they would need the
   388 to talk to each other---they would need the protocol in
   410 protocol in response mode, but also if they want to talk to
   389 response mode, but also if they want to talk to other servers
   411 other servers in challenge mode. Similarly if you are in an
   390 in challenge mode. Similarly if you in an military aircraft
   412 military aircraft you have to challenge everybody you see, in
   391 you have to challenge everybody you see, in case there is a
   413 case there is a friend amongst the targets you like to shoot,
   392 friend amongst the targets you like to shoot, but you also
   414 but you also have to respond to any of your own anti-aircraft
   393 have to respond to any of your own anti-aircraft guns on the
   415 guns on the ground, lest they shoot you. In these situations
   394 ground lest they shoot you. In these situations you have to be
   416 you have to be careful to not decode, or answer, your own
   395 careful to not decode, or answer, your own challenge. Recall 
   417 challenge. Recall the protocol is
   396 the protocol is
       
   397 
   418 
   398 \begin{center}
   419 \begin{center}
   399 \begin{tabular}{l@{\hspace{2mm}}l}
   420 \begin{tabular}{l@{\hspace{2mm}}l}
   400 $A \rightarrow B$: & $N_A$\\  
   421 $A \rightarrow B$: & $N_A$\\  
   401 $B \rightarrow A$: & $\{N_A, N_B\}_{K_{AB}}$\\
   422 $B \rightarrow A$: & $\{N_A, N_B\}_{K_{AB}}$\\
   402 $A \rightarrow B$: & $N_B$\\
   423 $A \rightarrow B$: & $N_B$\\
   403 \end{tabular}
   424 \end{tabular}
   404 \end{center}
   425 \end{center}
   405 
   426 
   406 \noindent but it does not specify who is $A$ and who is $B$.
   427 \noindent but it does not specify who is $A$ and who is $B$.
   407 If, as supposed, the protocol works in response and in 
   428 If the protocol works in response and in challenge mode, then
   408 challenge mode, then $A$ will be $A$ in one instance, but $B$
   429 $A$ will be $A$ in one instance, but $B$ in the other. I hope
   409 in the other. I hope this makes sense. Let us look at the 
   430 this makes sense. Let us look at the details and let us assume
   410 details and lets assume our adversary is $E$ who just deflects
   431 our adversary is $E$ who just deflects our messages back to
   411 our messages back to us. 
   432 us. 
   412 
   433 
   413 \begin{center}
   434 \begin{center}
   414 \begin{tabular}{lllll}
   435 \begin{tabular}{lllll}
   415 & \multicolumn{2}{l}{challenge mode:} & 
   436 & \multicolumn{2}{l}{challenge mode:} & 
   416 \multicolumn{2}{l}{response mode:}\smallskip\\
   437 \multicolumn{2}{l}{response mode:}\smallskip\\
   424 
   445 
   425 \noindent In the first step we challenge $E$ with a nonce we
   446 \noindent In the first step we challenge $E$ with a nonce we
   426 created. Since we also run the protocol in ``response mode'',
   447 created. Since we also run the protocol in ``response mode'',
   427 $E$ can now feed us the same challenge in step 2. We do not
   448 $E$ can now feed us the same challenge in step 2. We do not
   428 know where it came from (it's over the air), but if we are in
   449 know where it came from (it's over the air), but if we are in
   429 an aircraft we should better quickly answer it, otherwise we
   450 a fighter aircraft we better quickly answer it, otherwise we
   430 risk to be shot. So we add our own challenge $N'_A$ and
   451 risk to be shot. So we add our own challenge $N'_A$ and
   431 encrypt it under the secret key $K_{AB}$ (step 3). Now $E$
   452 encrypt it under the secret key $K_{AB}$ (step 3). Now $E$
   432 does not need to know this key in order to form the correct
   453 does not need to know this key in order to form the correct
   433 answer for the first protocol. It will just replays this
   454 answer for the first protocol. It will just replays this
   434 message back to us in the challenge mode (step 4). I happily
   455 message back to us in the challenge mode (step 4). I happily
   443 managed to disguise as a friend. As a pilot, I would be a bit
   464 managed to disguise as a friend. As a pilot, I would be a bit
   444 peeved at that moment and would have preferred the designer of
   465 peeved at that moment and would have preferred the designer of
   445 this challenge-response protocol had been a tad smarter. For
   466 this challenge-response protocol had been a tad smarter. For
   446 one thing they violated the best practice in protocol design
   467 one thing they violated the best practice in protocol design
   447 of using the same key, $K_{AB}$, for two different
   468 of using the same key, $K_{AB}$, for two different
   448 purposes---challenging and responding. They better had used
   469 purposes---namely challenging and responding. They better had
   449 two different keys. This would have averted this attack and
   470 used two different keys. This would have averted this attack
   450 would have saved me a lot of trouble.
   471 and would have saved me a lot of inconvenience.
   451 
   472 
   452 \subsubsection*{Trusted Third Parties}
   473 \subsubsection*{Trusted Third Parties}
   453 
   474 
   454 One limitation the protocols we discussed so far is
   475 One limitation the protocols we discussed so far have is that
   455 that they pre-suppose a secret shared key. As already 
   476 they pre-suppose a secret shared key. As already mentioned,
   456 mentioned, this is a convenience we cannot always assume.
   477 this is a convenience we cannot always assume. How to
   457 How to establish a secret key then? Well, if both parties,
   478 establish a secret key then? Well, if both parties, say $A$
   458 say $A$ and $B$, mutually trust a third party, say $S$, 
   479 and $B$, mutually trust a third party, say $S$, then they can
   459 then they can use the following protocol:
   480 use the following protocol:
   460 
   481 
   461 \begin{center}
   482 \begin{center}
   462 \begin{tabular}{l@{\hspace{2mm}}l}
   483 \begin{tabular}{l@{\hspace{2mm}}l}
   463 $A \to S :$ & $A, B$\\
   484 $A \to S :$ & $A, B$\\
   464 $S \to A :$ & $\{K_{AB}\}_{K_{AS}}$ and $\{\{K_{AB}\}_{K_{BS}} \}_{K_{AS}}$\\
   485 $S \to A :$ & $\{K_{AB}\}_{K_{AS}}$ and $\{\{K_{AB}\}_{K_{BS}} \}_{K_{AS}}$\\
   475 protocol work? In the first step $A$ contacts $S$ and says
   496 protocol work? In the first step $A$ contacts $S$ and says
   476 that it wants to talk to $B$. In turn $S$ invents a new key
   497 that it wants to talk to $B$. In turn $S$ invents a new key
   477 $K_{AB}$ and sends two messages back to $A$: one message is
   498 $K_{AB}$ and sends two messages back to $A$: one message is
   478 $\{K_{AB}\}_{K_{AS}}$ which is encrypted with the key $A$ and
   499 $\{K_{AB}\}_{K_{AS}}$ which is encrypted with the key $A$ and
   479 $S$ share, and also the message
   500 $S$ share, and also the message
   480 $\{\{K_{AB}\}_{K_{BS}}\}_{K_{AS}}$. which is encrypted with
   501 $\{\{K_{AB}\}_{K_{BS}}\}_{K_{AS}}$ which is encrypted with
   481 $K_{AB}$ but also a second time with $K_{BS}$. The point of
   502 $K_{AS}$ but also a second time with $K_{BS}$. The point of
   482 the second message is that it is a message intended for $B$.
   503 the second message is that it is a message intended for $B$.
   483 So a receives both messages and can decrypt them---in the
   504 So $A$ receives both messages and can decrypt them---in the
   484 first case it obtains the key $K_{AB}$ which $S$ suggested to
   505 first case it obtains the key $K_{AB}$ which $S$ suggested to
   485 use. In the second case it obtains a message it can forward to
   506 use. In the second case it obtains a message it can forward to
   486 $B$. $B$ receives this message and since it knows the key it
   507 $B$. $B$ receives this message and since it knows the key it
   487 shares with $S$ obtains the key $K_{AB}$. Now $A$ and $B$ can
   508 shares with $S$ obtains the key $K_{AB}$. Now $A$ and $B$ can
   488 start to exchange messages with the shared secret key
   509 start to exchange messages with the shared secret key
   489 $K_{AB}$. What is the advantage of $S$ sending $A$ two 
   510 $K_{AB}$. What is the advantage of $S$ sending $A$ two
   490 messages instead of contacting $B$ instead? Well, for one
   511 messages instead of contacting $B$ instead? Well, there can be
   491 there can now be a time-delay between the second and
   512 a time-delay between the second and third step in the
   492 third step in the protocol. At some point in the past
   513 protocol. At some point in the past $A$ and $S$ need to have
   493 $A$ and $S$ need to have come together to share
   514 come together to share a key, similarly $B$ and $S$. After
   494 a key, similarly $B$ and $S$. After that $B$ does not need to
   515 that $B$ does not need to be ``online'' anymore until $A$
   495 be ``online'' anymore until $A$ actually starts sending messages
   516 actually starts sending messages to $B$. $A$ and $S$ can
   496 to $B$. $A$ and $S$ can completely on their own negotiate a
   517 completely on their own negotiate a new key. 
   497 new key. 
       
   498 
   518 
   499 The major limitation of this protocol however is that I need
   519 The major limitation of this protocol however is that I need
   500 to trust a third party. And in this case completely, because
   520 to trust a third party. And in this case completely, because
   501 $S$ can of course also read easily all messages $A$ sends to
   521 $S$ can of course also read easily all messages $A$ sends to
   502 $B$. The problem is that I cannot really think of any
   522 $B$. The problem is that I cannot really think of any