handouts/ho05.tex
changeset 275 06a04b3b2dda
parent 274 1e1008403f17
child 279 5616e664c020
equal deleted inserted replaced
274:1e1008403f17 275:06a04b3b2dda
     6 \begin{document}
     6 \begin{document}
     7 
     7 
     8 \section*{Handout 5 (Protocols)}
     8 \section*{Handout 5 (Protocols)}
     9 
     9 
    10 Protocols are the computer science equivalent to fractals and
    10 Protocols are the computer science equivalent to fractals and
    11 the Mandelbrot set in mathematics. With the latter you have a
    11 the Mandelbrot set in mathematics. With the latter two you
    12 simple formula which you just iterate and then you test
    12 have a simple formula, which you just iterate and then you
    13 whether a point is inside or outside a region, and voila
    13 test whether a point is inside or outside a region\ldots{}it
    14 something magically
    14 does not look exciting, but voila something magically
    15 happened.\footnote{\url{http://en.wikipedia.org/wiki/Fractal},
    15 happened.\footnote{\url{http://en.wikipedia.org/wiki/Fractal},
    16 \url{http://en.wikipedia.org/wiki/Mandelbrot_set}} Protocols
    16 \url{http://en.wikipedia.org/wiki/Mandelbrot_set}} Protocols
    17 are similar: they are simple exchanges of messages, but in the
    17 are similar: they are simple exchanges of messages, but in the
    18 end something ``magical'' can happen---for example a secret
    18 end something ``magical'' can happen---for example a secret
    19 channel has been established or two entities have
    19 channel has been established or two entities have
    20 authenticated themselves to each other. The problem with magic
    20 authenticated themselves to each other. Even in face of strong
    21 is of course it is poorly understood and even experts often
    21 adversaries where we have no control over the network over
    22 got, and get, it wrong with protocols. 
    22 which our messages are exchanged. The problem with magic is of
    23 
    23 course it is poorly understood and even experts often got, and
    24 To have an idea what kind of protocols we are interested, let
    24 get, it wrong with protocols.
       
    25 
       
    26 To have an idea what kind of protocols we are interested in, let
    25 us look at a few examples. One example are (wireless) key 
    27 us look at a few examples. One example are (wireless) key 
    26 fobs which operate the central locking system and the
    28 fobs, which operate the central locking system and the
    27 ignition in a car.
    29 ignition in a car.
    28 
    30 
    29 \begin{center}
    31 \begin{center}
    30 \includegraphics[scale=0.075]{../pics/keyfob.jpg}
    32 \includegraphics[scale=0.075]{../pics/keyfob.jpg}
    31 \quad
    33 \quad
    32 \includegraphics[scale=0.2025]{../pics/startstop.jpg}
    34 \includegraphics[scale=0.2025]{../pics/startstop.jpg}
    33 \end{center}
    35 \end{center}
    34 
    36 
    35 \noindent The point of these key fobs is that everything is
    37 \noindent The point of these key fobs is that everything is
    36 done over the ``air''---there is no physical connection
    38 done over the ``air''---there is no physical connection
    37 between the key, doors and engine. So we must achieve security
    39 between the key, doors and engine, as was the case with the
    38 by exchanging certain messages between the key fob on one side
    40 old solid metal keys. With the key fobs we must achieve
    39 and doors and engine on the other. Clearly what we like to
    41 security by exchanging certain messages between the key fob on
    40 achieve is that I can get into my car and start it, but that
    42 one side and the doors and engine on the other. Clearly what
    41 thieves are kept out. The problem is that everybody can
    43 we like to accomplish is that I can get into my car and start
    42 ``overhear'' or skim the exchange of messages between the key
    44 it, but that thieves are kept out. The problem is that
    43 fob and car. In this scenario the simplest attack you need to
    45 everybody can ``overhear'' or skim the exchange of messages
    44 defend against is a person-in-the-middle attack. Imagine you
    46 between the key fob and car. In this scenario the simplest
    45 park your car in front of a supermarket. One thief follows you
    47 attack you need to defend against is a person-in-the-middle
    46 with a strong transmitter. A second thief ``listens'' to the
    48 attack. For this imagine you park your car in front of a
    47 signal from the car and wirelessly transmits it to the
    49 supermarket. One thief follows you with a strong transmitter.
    48 ``colleague'' who followed you and who silently enquires about
    50 A second thief ``listens'' to the signals from the car and
    49 the answer from the key fob. The answer is then send back to
    51 wirelessly transmits them to the ``colleague'' who followed
    50 the thief at the car, which then dutifully opens and possibly
    52 you. This thief silently enquires what the key fob answers.
    51 starts. No need to steal your key anymore.
    53 This answer is then send back to the thief at the car. If done
    52 
    54 properly the car will dutifully open and possibly start. No
    53 But there are many more such protocols we like to consider.
    55 need to steal your keys anymore.
    54 Other examples are wifi---you might sit at a Starbucks and
    56 
       
    57 But there are many more such protocols we like to treat.
       
    58 Another example is Wifi---you might sit at a Starbucks and
    55 talk wirelessly to the free access point there and from there
    59 talk wirelessly to the free access point there and from there
    56 talk with your bank, for example. Also even if your have to
    60 talk to your bank. Moreover, even if your have to touch your
    57 touch your Oyster card at the reader each time you enter and
    61 Oyster card at the reader each time you enter or exit the
    58 exit the Tube, it actually operates wirelessly and with
    62 Tube, it actually operates wirelessly and with appropriate
    59 appropriate equipment over some quite large distance. But
    63 equipment over some quite large distance (several meters). But
    60 there are many many more examples (Bitcoins, mobile
    64 there are many, many more examples (Bitcoins, mobile
    61 phones,\ldots). The common characteristics of the protocols we
    65 phones,\ldots). The common characteristics of the protocols we
    62 are interested in here is that an adversary or attacker is
    66 are interested in is that an adversary or attacker is assumed
    63 assumed to be in complete control over the network or channel
    67 to be in complete control over the network or channel over
    64 over which you exchanging messages. An attacker can install a
    68 which we exchanging messages. An attacker can install a packet
    65 packet sniffer on a network, inject packets, modify packets,
    69 sniffer on a network, inject packets, modify packets, replay
    66 replay old messages, or fake pretty much everything. In this
    70 old messages, or fake pretty much everything else. In this
    67 hostile environment, the purpose of protocols (that is
    71 hostile environment, the purpose of a protocol (that is
    68 exchange of messages) is to achieve some security goal, for
    72 exchange of messages) is to achieve some security goal. For
    69 example only allow the owner of the car in but everybody else
    73 example only allow the owner of the car in, but everybody else
    70 should be kept out.
    74 should stay out.
    71 
    75 
    72 The protocols we are interested here are generic descriptions
    76 The protocols we are interested here are generic descriptions
    73 of how to exchange messages in order to achieve a goal, be it
    77 of how to exchange messages in order to achieve a goal. Unlike
    74 establishing a mutual secure connection or being able to
    78 the distant past where, for example, we had to meet a person in
    75 authenticate to a system. Unlike the distant past where for
    79 order to authenticate him or her (via a passport for example),
    76 example we had to meet a person in order to authenticate him
    80 the problem we are facing on the Internet is that we cannot
    77 or her (via a passport for example), the problem we are facing
    81 easily be sure who we are ``talking'' to. The obvious reason
    78 on the Internet is that we cannot easily be sure who we are
    82 is that only some electrons arrive at our computer; we do not
    79 ``talking'' to. The obvious reason is that only some electrons
    83 see the person, or computer, behind the incoming electrons
    80 arrive at our computer; we do not see the person, or computer,
    84 (messages). 
    81 behind the incoming electrons (messages). 
       
    82 
    85 
    83 To start, let us look at one of the simplest protocols that
    86 To start, let us look at one of the simplest protocols that
    84 are part of the TCP protocol (which underlies the Internet).
    87 are part of the TCP protocol (which underlies the Internet).
    85 This protocol does not do anything security relevant, it just
    88 This protocol does not do anything security relevant, it just
    86 establishes a ``hello'' from a client to a server which the
    89 establishes a ``hello'' from a client to a server which the
   410 
   413 
   411 \begin{center}
   414 \begin{center}
   412 \begin{tabular}{lllll}
   415 \begin{tabular}{lllll}
   413 & \multicolumn{2}{l}{challenge mode:} & 
   416 & \multicolumn{2}{l}{challenge mode:} & 
   414 \multicolumn{2}{l}{response mode:}\smallskip\\
   417 \multicolumn{2}{l}{response mode:}\smallskip\\
   415 1) & $A \rightarrow E$: & $N_A$\\ 
   418 1. & $A \rightarrow E$: & $N_A$\\ 
   416 2) & & & $E \rightarrow A$: & $N_A$\\ 
   419 2. & & & $E \rightarrow A$: & $N_A$\\ 
   417 3) & & & $A \rightarrow E$: & $\{N_A, N_A'\}_{K_{AB}}$\\
   420 3. & & & $A \rightarrow E$: & $\{N_A, N_A'\}_{K_{AB}}$\\
   418 4) & $E \rightarrow A$: & $\{N_A, N_A'\}_{K_{AB}}$\\
   421 4. & $E \rightarrow A$: & $\{N_A, N_A'\}_{K_{AB}}$\\
   419 5) & $A \rightarrow E$: & $N_A'$\\
   422 5. & $A \rightarrow E$: & $N_A'$\\
   420 \end{tabular}
   423 \end{tabular}
   421 \end{center}
   424 \end{center}
   422 
   425 
   423 \noindent In the first step we challenge $E$ with a nonce we
   426 \noindent In the first step we challenge $E$ with a nonce we
   424 created. Since we also run the protocol in ``response mode'',
   427 created. Since we also run the protocol in ``response mode'',
   567 messages and substitutes her own public key. The protocol
   570 messages and substitutes her own public key. The protocol
   568 run would therefore be
   571 run would therefore be
   569 
   572 
   570 \begin{center}
   573 \begin{center}
   571 \begin{tabular}{ll@{\hspace{2mm}}l}
   574 \begin{tabular}{ll@{\hspace{2mm}}l}
   572 1) & $A \to E :$ & $K^{pub}_A$\smallskip\\
   575 1. & $A \to E :$ & $K^{pub}_A$\smallskip\\
   573 2) & $E \to B :$ & $K^{pub}_E$\smallskip\\
   576 2. & $E \to B :$ & $K^{pub}_E$\smallskip\\
   574 3) & $B \to E :$ & $K^{pub}_B$\smallskip\\
   577 3. & $B \to E :$ & $K^{pub}_B$\smallskip\\
   575 4) & $E \to A :$ & $K^{pub}_E$\smallskip\\
   578 4. & $E \to A :$ & $K^{pub}_E$\smallskip\\
   576 5) & $A \to E :$ & $\{A,m\}_{K^{pub}_E}$\smallskip\\
   579 5. & $A \to E :$ & $\{A,m\}_{K^{pub}_E}$\smallskip\\
   577 6) & $E \to B :$ & $\{E,m\}_{K^{pub}_B}$\smallskip\\
   580 6. & $E \to B :$ & $\{E,m\}_{K^{pub}_B}$\smallskip\\
   578 7) & $B \to E :$ & $\{B,m'\}_{K^{pub}_E}$\smallskip\\
   581 7. & $B \to E :$ & $\{B,m'\}_{K^{pub}_E}$\smallskip\\
   579 8) & $E \to A :$ & $\{E,m'\}_{K^{pub}_A}$
   582 8. & $E \to A :$ & $\{E,m'\}_{K^{pub}_A}$
   580 \end{tabular}
   583 \end{tabular}
   581 \end{center}
   584 \end{center}
   582 
   585 
   583 \noindent where in steps 6 and 8, $E$ can modify the messages
   586 \noindent where in steps 6 and 8, $E$ can modify the messages
   584 by including the $E$ in the message. Both messages are
   587 by including the $E$ in the message. Both messages are
   592 Modify the protocol above so that $A$ and $B$ send their 
   595 Modify the protocol above so that $A$ and $B$ send their 
   593 messages in two halves, like
   596 messages in two halves, like
   594 
   597 
   595 \begin{center}
   598 \begin{center}
   596 \begin{tabular}{ll@{\hspace{2mm}}l}
   599 \begin{tabular}{ll@{\hspace{2mm}}l}
   597 1) & $A \to B :$ & $K^{pub}_A$\smallskip\\
   600 1. & $A \to B :$ & $K^{pub}_A$\smallskip\\
   598 2) & $B \to A :$ & $K^{pub}_B$\smallskip\\
   601 2. & $B \to A :$ & $K^{pub}_B$\smallskip\\
   599 3) & & $\{A,m\}_{K^{pub}_B} \;\mapsto\; H_1,H_2$\\
   602 3. & & $\{A,m\}_{K^{pub}_B} \;\mapsto\; H_1,H_2$\\
   600    & & $\{B,m'\}_{K^{pub}_A} \;\mapsto\; M_1,M_2$\\
   603    & & $\{B,m'\}_{K^{pub}_A} \;\mapsto\; M_1,M_2$\\
   601 4) & $A \to B :$ & $H_1$\smallskip\\
   604 4. & $A \to B :$ & $H_1$\smallskip\\
   602 5) & $B \to A :$ & $\{H_1, M_1\}_{K^{pub}_A}$\smallskip\\
   605 5. & $B \to A :$ & $\{H_1, M_1\}_{K^{pub}_A}$\smallskip\\
   603 6) & $A \to B :$ & $\{H_2, M_1\}_{K^{pub}_B}$\smallskip\\
   606 6. & $A \to B :$ & $\{H_2, M_1\}_{K^{pub}_B}$\smallskip\\
   604 7) & $B \to A :$ & $M_2$
   607 7. & $B \to A :$ & $M_2$
   605 \end{tabular}
   608 \end{tabular}
   606 \end{center}
   609 \end{center}
   607 
   610 
   608 \noindent The idea is that in step 3, $A$ encrypts the
   611 \noindent The idea is that in step 3, $A$ encrypts the
   609 message (with $B$'s public key) and then splits the encrypted
   612 message (with $B$'s public key) and then splits the encrypted
   642 the messages where public keys are exchanged and inject
   645 the messages where public keys are exchanged and inject
   643 our own.
   646 our own.
   644 
   647 
   645 \begin{center}
   648 \begin{center}
   646 \begin{tabular}{ll@{\hspace{2mm}}l}
   649 \begin{tabular}{ll@{\hspace{2mm}}l}
   647 1) & $A \to E :$ & $K^{pub}_A$\smallskip\\
   650 1. & $A \to E :$ & $K^{pub}_A$\smallskip\\
   648 2) & $E \to B :$ & $K^{pub}_E$\smallskip\\
   651 2. & $E \to B :$ & $K^{pub}_E$\smallskip\\
   649 3) & $B \to E :$ & $K^{pub}_B$\smallskip\\
   652 3. & $B \to E :$ & $K^{pub}_B$\smallskip\\
   650 4) & $E \to A :$ & $K^{pub}_E$
   653 4. & $E \to A :$ & $K^{pub}_E$
   651 \end{tabular}
   654 \end{tabular}
   652 \end{center}
   655 \end{center}
   653 
   656 
   654 \noindent 
   657 \noindent 
   655 Now $A$ and $B$ build the message halves:
   658 Now $A$ and $B$ build the message halves:
   661 
   664 
   662 \noindent and $A$ sends $E$ its first half of the message.
   665 \noindent and $A$ sends $E$ its first half of the message.
   663 
   666 
   664 \begin{center}
   667 \begin{center}
   665 \begin{tabular}{ll@{\hspace{2mm}}l}
   668 \begin{tabular}{ll@{\hspace{2mm}}l}
   666 5) & $A \to E :$ & $H_1$
   669 5. & $A \to E :$ & $H_1$
   667 \end{tabular}
   670 \end{tabular}
   668 \end{center}
   671 \end{center}
   669 
   672 
   670 \noindent Neither $E$ nor $B$ can do much with this message.
   673 \noindent Neither $E$ nor $B$ can do much with this message.
   671 Remember it is only half of some ``garbled'' text that cannot
   674 Remember it is only half of some ``garbled'' text that cannot
   672 be decrypted. $E$ could try to forward the message to $B$ and
   675 be decrypted. $E$ could try to forward the message to $B$ and
   673 see what its reply is.
   676 see what its reply is.
   674 
   677 
   675 \begin{center}
   678 \begin{center}
   676 \begin{tabular}{ll@{\hspace{2mm}}l}
   679 \begin{tabular}{ll@{\hspace{2mm}}l}
   677 6) & $E \to B :$ & $H_1$\\
   680 6. & $E \to B :$ & $H_1$\\
   678 7) & $B \to E :$ & $\{H_1, M_1\}_{K^{pub}_E}$
   681 7. & $B \to E :$ & $\{H_1, M_1\}_{K^{pub}_E}$
   679 \end{tabular}
   682 \end{tabular}
   680 \end{center}
   683 \end{center}
   681 
   684 
   682 \noindent Although $E$ can decrypt the message with its
   685 \noindent Although $E$ can decrypt the message with its
   683 private key, but it only gets the halves $H_1$ and $M_1$ which
   686 private key, but it only gets the halves $H_1$ and $M_1$ which
   684 are of no use yet. In order to get more information it
   687 are of no use yet. In order to get more information it
   685 can send the message to $A$ with $A$'s public key.
   688 can send the message to $A$ with $A$'s public key.
   686 
   689 
   687 \begin{center}
   690 \begin{center}
   688 \begin{tabular}{ll@{\hspace{2mm}}l}
   691 \begin{tabular}{ll@{\hspace{2mm}}l}
   689 8) & $E \to A :$ & $\{H_1, M_1\}_{K^{pub}_A}$
   692 8. & $E \to A :$ & $\{H_1, M_1\}_{K^{pub}_A}$
   690 \end{tabular}
   693 \end{tabular}
   691 \end{center}
   694 \end{center}
   692 
   695 
   693 \noindent $A$ would receive this message, decrypt it and
   696 \noindent $A$ would receive this message, decrypt it and
   694 find out it matches with its expectation. It therefore
   697 find out it matches with its expectation. It therefore
   695 sends out the message 
   698 sends out the message 
   696 
   699 
   697 \begin{center}
   700 \begin{center}
   698 \begin{tabular}{ll@{\hspace{2mm}}l}
   701 \begin{tabular}{ll@{\hspace{2mm}}l}
   699 9) & $A \to E :$ & $\{H_2, M_1\}_{K^{pub}_E}$
   702 9. & $A \to E :$ & $\{H_2, M_1\}_{K^{pub}_E}$
   700 \end{tabular}
   703 \end{tabular}
   701 \end{center}
   704 \end{center}
   702 
   705 
   703 \noindent Now $E$ is in the possession of $H_1$ and $H_2$,
   706 \noindent Now $E$ is in the possession of $H_1$ and $H_2$,
   704 which it can join together in order to obtain
   707 which it can join together in order to obtain
   721 do not fit. So it can only send out the original $H_2$
   724 do not fit. So it can only send out the original $H_2$
   722 as follows:
   725 as follows:
   723 
   726 
   724 \begin{center}
   727 \begin{center}
   725 \begin{tabular}{ll@{\hspace{2mm}}l}
   728 \begin{tabular}{ll@{\hspace{2mm}}l}
   726 10) & $E \to B :$ & $\{H_2, M_1\}_{K^{pub}_B}$
   729 10. & $E \to B :$ & $\{H_2, M_1\}_{K^{pub}_B}$
   727 \end{tabular}
   730 \end{tabular}
   728 \end{center}
   731 \end{center}
   729 
   732 
   730 \noindent 
   733 \noindent 
   731 In this case $B$ can make sense out of the message and
   734 In this case $B$ can make sense out of the message and
   732 as a result sends $E$ back its second half $M_2$.
   735 as a result sends $E$ back its second half $M_2$.
   733 
   736 
   734 \begin{center}
   737 \begin{center}
   735 \begin{tabular}{ll@{\hspace{2mm}}l}
   738 \begin{tabular}{ll@{\hspace{2mm}}l}
   736 11) & $B \to E :$ & $M_2$
   739 11. & $B \to E :$ & $M_2$
   737 \end{tabular}
   740 \end{tabular}
   738 \end{center}
   741 \end{center}
   739 
   742 
   740 \noindent $E$ might be ecstatic by now, because it has now
   743 \noindent $E$ might be ecstatic by now, because it has now
   741 also received $M_1$ and $M_2$ which it can join to
   744 also received $M_1$ and $M_2$ which it can join to
   784 
   787 
   785 \begin{center}
   788 \begin{center}
   786 \url{http://www.cs.ru.nl/~rverdult/Gone_in_360_Seconds_Hijacking_with_Hitag2-USENIX_2012.pdf}
   789 \url{http://www.cs.ru.nl/~rverdult/Gone_in_360_Seconds_Hijacking_with_Hitag2-USENIX_2012.pdf}
   787 \end{center}
   790 \end{center}
   788 
   791 
   789 \noindent is quite amusing to read. Obviously an even more
   792 \noindent is quite amusing to read. Obviously an even more amusing
   790 amusing paper would be ``Dismantling Megamos Crypto: 
   793 paper would be ``Dismantling Megamos Crypto: Wirelessly Lockpicking a
   791 Wirelessly Lockpicking a Vehicle Immobilizer'' but because
   794 Vehicle Immobilizer'' by the same authors, but because of the court
   792 of the court injuction by VW we are denied this entertainment.
   795 injuction by VW in this case, we are denied this entertainment.
   793 
   796 
   794 Person-in-the-middle-attacks in the ``wild'' are described 
   797 Person-in-the-middle-attacks from the ``wild'' are described 
   795 with real data in the blog post
   798 with real data in the blog post
   796 
   799 
   797 \begin{center}
   800 \begin{center}
   798 \url{http://www.renesys.com/2013/11/mitm-internet-hijacking}
   801 \url{http://www.renesys.com/2013/11/mitm-internet-hijacking}
   799 \end{center}
   802 \end{center}
   800 
   803 
   801 \noindent The conclusion in this post is that person-in-the-middle-attacks
   804 \noindent The conclusion in this post is that person-in-the-middle-attacks
   802 can be launched from any place on Earth---it is not required 
   805 can be launched from any place on Earth---it is not required 
   803 to sit in the ``middle'' of the communication of two people.
   806 that you sit in the ``middle'' of the communication of two people.
   804 You just have to route their traffic through a node you own.
   807 You just have to route their traffic through a node you own.
   805 
   808 
   806 \end{document}
   809 \end{document}
   807 
   810 
   808 %%% Local Variables: 
   811 %%% Local Variables: