Advanced 2 13
Advanced 2 13
Exchange Protocols
Timo Karvi
10.2013
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 1/1
Building a Key Establishement Protocol
We now explicate an attempt to design a good protocol. The
situation is as follows:
We assume that there is a set of users, any two of whom may wish to
establish a new key for use in securing their subsequent
communications through cryptography. Such a key is known as a
session key.
In order to achieve their aim the users interact with an entity called
the server which will also engage in the protocol. All users trust the
server to execute the protocol faithfully and not to engage in any
other activity that will deliberately compromise their security.
Furthermore, the server is trusted to generate the new key and to do
so in such a way that it is sufficiently random to prevent an attacker
gaining any useful information about it.
Thus there are two users, A and B, and the trusted server S. The aim
of the protocol is to establish a new secret key KAB between A and
B. The role of S is to generate the key and transport it to A and B.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 2/1
First Attempt
Our first attempt is the following naı̈ve protocol with three messages:
1 A−→S: A, B
2 S−→A: KAB
3 A−→B: KAB , A
Usually we make the following security assumption 1: The adversry is able
to eavesdrop on all messages sent in a cryptographic protocol.
If we assume this assumption, we see that the protocol is vulnerable,
because the adversary can take the secret key. We must thus assume that
A and S as well as B and S share a secret key.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 3/1
Second Attempt I
1 A−→S: A, B
2 S−→A: {KAB }KAS , {KAB }KBS
3 A−→B: {KAB }KBS , A
This protocol is as insecure in an open environment as our first attempt,
but for a completely different reason.
Security Assumption 2:
The adversary is able to alter all messages sent in a cryptographic protocol
using any information available. In addition the adversary can re-route any
message to any other principal. This includes the ability to generate and
insert completely new messages.
By applying the second security assumption it is possible to break the
protocol without breaking the cipher: The attack proceeds as follows:
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 4/1
Second Attempt II
1 A−→S: A, B
2 S−→A: {KAB }KAS , {KAB }KBS
3 A−→C : {KAB }KBS , A
4 C −→B: {KAB }KBS , D
The adversary C simply intercepts the message from A to B and
substitutes D’s identity for A’s. The consequence is that B believes he is
sharing the key with D whereas he is in fact sharing it with A. Maybe B
will give D’s confidential information to A.
Security Assumption 3
The adversary may be a legitimate protocol participant (an insider), or an
external party (an outsider), or a combination of both.
This assumption leads to an alternative attack against the second
protocol:
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 5/1
Second Attempt III
1 A−→C : A, B
2 C −→S: A, C
3 S−→C : {KAC }KAS , {KAC }KCS
4 C −→A: {KAC }KAS , {KAC }KCS
5 A−→C : {KAC }KCS , A
Now A thinks he is communicating with B, but in reality he communicates
with C who is able to read all the messages sent by A.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 6/1
Third Attempt I
The previous attacks show that we must add the identities of the
participants into the messages in a secure way. This leads to the following
attempt:
1 A−→S: A, B
2 S−→A: {KAB,B }KAS , {KAB , A}KBS
3 A−→B: {KAB , A}KBS
However, even this version is not completely satisfactory.
Security Assumption 4:
An adversary is able to obtain the value of the session key KAB used in
any sufficiently old previous run of the protocol.
The attack based on this assumption as follows:
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 7/1
Third Attempt II
1 A−→C : A, B
2 ′
C −→A: {KAB,B ′ , A}
}KAS , {KAB KBS
3 ′ , A}
A−→B: {KAB KBS
This time C intercepts the message from A to S. The key KAB ′ is an old
′
session key used by A and B in a previous session. Because KAB is old, C
has maybe succeeded to break it. Even if KAB′ has not been broken, C
could replay old messages in this new session, and it can cause a lot of
problems.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols10.2013 8/1
Fourth Attempt
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 10 / 1
Concepts Related to Key Establishment Protocols I
Definition
A key transport protocol is a key establishment protocol in which one of
the principals generates the key and this key is then transferred to all
protocol users.
Definition
A key agreement protocol is a key establishment protocol in which the
session key is a function of inputs by all protocol users.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 11 / 1
Concepts Related to Key Establishment Protocols II
Definition
A hybrid protocol is a key establishment protocol in which the session key
is a function of inputs by more than one principal, but not by all users.
This means that the protocol is a key agreement protocol from the
viewpoint of some users, and a key transport protocol from the viewpoint
of others.
Key establishment protocols pay usually attention on compromised keys.
Especially, the following properties are important.
Definition
A key establishment protocol provides forward secrecy if compromise of
the long-term keys of a set of principals does not compromise the session
keys established in previous protocols runs involving those principals.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 12 / 1
Concepts Related to Key Establishment Protocols III
Definition
A protocol provides partial forward secrecy if compromise of the long-term
keys of one or more specific principals does not compromise the session
keys established in previous protocols runs involving those principals.
Definition
A protocol provides resistance to key compromise impersonation if
compromise of a long-term key of a principal A does not allow the
adversary to masquerade to A as a different principal.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 13 / 1
Types of Attacks
The following list is not complete. The ways in which the adversary
may interact with one or more protocol runs are infinite.
Before condemning new protocols we must remember that different
protocols have different objectives. For example, some protocols may
have no material to convey confidentially, being concerned solely with
real-time authentication.
Similarly, some protocols may use only light measures against
adversaries, because efficiency requirements prevent heavy
cryptography or many messages.
Moreover, one should always clearly define the goals a security
protocol is aimed to satisfy. Without such definitions, security proof
and analyses are difficult.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 14 / 1
Eavesdropping
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 15 / 1
Modification
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 16 / 1
Replay
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 17 / 1
Preplay
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 18 / 1
Reflection I
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 19 / 1
Reflection II
1. A−→B: {NA }K
2. B−→A: {NB }K , NA
3. A−→B: NB
1. A−→CB : {NA }K
1’. CB −→A: {NA }K
2’. A−→CB : {NA′ }K , NA
2. CB −→A: {NA′ }K , NA
3. A−→CB : NA′
3’. CB −→A: NA′
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 20 / 1
Typing Attacks I
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 21 / 1
Typing Attacks II
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 22 / 1
Typing Attacks III
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 23 / 1
Typing Attacks IV
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 24 / 1
Typing Attacks V
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 25 / 1
Cryptanalysis
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 26 / 1
Certificate Manipulation I
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 27 / 1
Certificate Manipulation II
1. A−→B: g x , Cert(A)
2. B−→A: g y , Cert(B)
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 28 / 1
Certificate Manipulation III
1. A−→CB : g x , Cert(A)
1’. C −→B: g x , Cert(C)
2’. B−→C : g y , Cert(B)
2. CB −→A: g yc , Cert(B)
A more convenient method may be to have the private key owner sign
a specific message or challenge.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 30 / 1
Protocol Interaction
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 31 / 1
Design Principles for Cryptographic Protocols I
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 32 / 1
Design Principles for Cryptographic Protocols II
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 33 / 1
Design Principles for Cryptographic Protocols III
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 34 / 1
Bellare-Rogaway MAP1 Protocol I
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 35 / 1
Bellare-Rogaway MAP1 Protocol II
1. A−→B: NA
2. B−→A: NB , [B, A, NA , NB ]KAB
3. A−→B: [A, NB ]KAB
1. A−→B: NA
2. B−→A: NB , [A, B, NA , NB ]KAB
3. A−→B: [A, NB ]KAB
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 36 / 1
Bellare-Rogaway MAP1 Protocol III
.
A chosen protocol attack on the MAP1 protocol is now possible. Suppose
I is an adversary who wishes to attack the protocol. In the following
attack A is used as an oracle against himself. In the attack,
I masquerades as B in a run of the MAP1 protocol started by A.
In parallel, I starts a run of the EVE1 protocol with A while masquerading
as B.
1. A−→IB : NA
1’. IB −→A: NA
2’. A−→IB : NA′ , [B, A, NA , NA′ ]KAB
2. IB −→A: NA′ , [B, A, NA , NA′ ]KAB
3. A−→IB : [A, NA′ ]KAB
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 38 / 1
ISO/IEC 9798 -standards I
1. B−→A: NB
2. A−→B: {NA , NB , B}KAB
3. B−→A: {NB , NA }KAB
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 39 / 1
Server-Less Key Establishment
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 40 / 1
Andrew Secure RPC Protocol I
Burrows et al. have pointed out a major problem with the protocol: A
′
has no assurance that KAB is fresh.
An intruder could substitute a previously recorded message 4 and
force A to accept an old, possibly compromised, session key.
Clark and Jacob pointed out another problem, using the following
attack:
1. A−→B: {NA }KAB
2. B−→A: {NA + 1, NB }KAB
3. A−→B: {NB + 1}KAB
4. IB −→A: {NA + 1, NB }KAB
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 41 / 1
Andrew Secure RPC Protocol II
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 42 / 1
Burrows et al Modification I
1. A−→B: A, NA
2. B−→A: ′ }
{NA , KAB KAB
3. A−→B: {NA }KAB
′
4. B−→A: NB′
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 43 / 1
Burrows et al Modification II
1. A−→IB : A, NA
1’. IB −→A: B, NA
2’. A−→IB : ′ }
{NA , KAB KAB
2. IB −→A: ′ }
{NA , KAB KAB
3. A−→IB : {NA }KAB
′
4. IB −→A: NI
4’. A−→IB : NA′
The result of the attack is that A has completed two successful runs,
apparently with B, although B has not engaged in the protocol.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 44 / 1
Boyd’s protocol
1. A−→B: NA
2. B−→A: NB
′
The new key is KAB = f (NA , NB , KAB ).
Function f must be such that it infeasible to find the value of f
without knowing KAB .
Typically, f could be a MAC function.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 45 / 1
Server-Based Key Establishment
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 46 / 1
Denning-Sacco Protocol I
1. A−→S: A, B
2. S−→A: {B, KAB , TS , {A, KAB , TS }KBS }KAS
3. A−→B: {A, KAB , TS }KBS
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 47 / 1
Robust Principles for Public Key Protocols I
Anderson and Needham have proposed a set of what they call robustness
principles for public-key-based protocols. These can be considered as more
specific instances of the general principles for protocol design proposed
earlier by Adabi and Needham.
1. Sign before encrypting. If a signature is affixed to encrypted
data then one cannot assume that the signer has any
knowledge of the data.
2. Be careful how entities are distinguished. If possible avoid
using the same key for two different purposes (such as
signing and decryption) and be sure to to distinguish
different runs of the same protocol from each other.
3. Be careful when signing or decrypting data that you never let
yourself be used as an oracle by your opponent.
4. Account all the bits: how many provide equivocation,
redundancy, computational complexity, and so on.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 48 / 1
Robust Principles for Public Key Protocols II
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 49 / 1
ISO/IEC 11770-3 -protocols I
The standard specifies six key transport protocols in a generic fashion and
with some optional items. We study three of these.
The first is very simple and shows the power of public key cryptography:
1. A −→ B: EB (A, KAB , TA )
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 50 / 1
ISO/IEC 11770-3 -protocols II
However, the standard does not mention this property.
The protocol works well with respect to A.
On the other hand, A achieves no assurance with regard to key
confirmation, or even that B is operative.
Moreover, B cannot be sure with whom he is communicating.
The timestamp TA guarantees the freshness of the message, but not
the freshness of the key. That is why the timestamp is optional in the
standard.
In mechanism 2, authentication is added:
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 51 / 1
ISO/IEC 11770-3 -protocols III
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 52 / 1
Needham-Schroeder Public Key Protocol I
The Needham-Schroeder public key protocol was one the earliest published
key establishment protocols along with its well-known companion using
symmetric encryption.
1. A−→B: EB (NA , A)
2. B−→A: EA (NA , NB )
3. A−→B: EB (NB )
In 1996, an attack was found with the help of the automatic analysing tool
FDR:
1. A−→C : EC (NA , A)
1’. CA −→B: EB (NA , A)
2’. B−→CA : EA (NA , NB )
2. C −→A: EA (NA , NB )
3. A−→C : EC (NB )
3’. CA −→B: EB (NB )
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 53 / 1
Needham-Schroeder Public Key Protocol II
1. A−→B: EB (NA , A)
2. B−→A: EA (NA , NB , B)
3. A−→B: EB (NB )
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 54 / 1
Key Generation with Diffie-Hellman
So far we have studied protocols which transport keys from one entity
to another.
The other possibility is to generate keys together, without
transporting them at all.
These methods are based on the Diffie-Hellman key generating
method. The basic method suffers from man-in-the-middle attack, so
something must be added to the basic scheme.
There are many suggestions: MTI protocols, MQV, STS, Oakley,
SKEME, IKE etc.
We present Station-to-Station (STS) protocol, because it is simple
and its modified version seems correct.
We study also IKE which is the key agreement phase of the IPsec
protocol.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 55 / 1
Station-to-Station Protocol I
In the protocol, A and B use Zq with q prime and with a generator
(primitive root) g . A and B calculate tA = g rA , tB = g rB , respectively,
where rA and rB are random numbers. Then:
1. A−→B: A, B, tA
2. B−→A: B, A, tB , {SigB (tB , tA )}KAB
3. A−→B: A, B, {SigA (tA , tB )}KAB
1. A−→CB : A, B, tA
1’. C −→B: C , B, tA
2’. B−→C : B, C , tB , {SigB (tB , tA )}KAB
2. CB −→A: B, A, tB , {SigB (tB , tA )}KAB
3. A−→CB : A, B, {SigA (tA , tB )}KAB
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 56 / 1
Station-to-Station Protocol II
Result: B has no indication that A has engaged in the protocol and yet A
has completed a succesful run and accepted that her partner is B.
These kind of unknown key-share attacks can be prevented by including
the name of the partner entity in the signatures exchanged. Moreover, this
change provides an explicit indication of the peer entity so that the
stronger form of entity authentication is achieved.
In addition, there no longer seems to be a need for the symmetric
encryption:
1. A−→B: tA
2. B−→A: tB , SigB (tB , tA , A)
3. A−→B: SigA (tA , tB , B)}
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 57 / 1
Internet Key Exchange, IKE I
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 58 / 1
Internet Key Exchange, IKE II
However, the first versions of IKE were complicated and they
generated a lot of critisism. For example, one early version had eight
different modes of operation.
The newest version, IKEv2, developed 2004-05, has only one
operation mode with some options. We describe here the option
which uses public key cryptography with certificates.
Our presentation concentrates on the security aspects of IKE, so we
drop the headers from the messages. Typically, headers contain
version numbers and flags of various sort plus security parameter
index SPI which identifies the security association uniquely.
Similarly, we drop SA-payloads which are used to negotiate
cryptographic algorithms for encryption, digital signatures and hash
functions.
The algorithm:
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 59 / 1
Internet Key Exchange, IKE III
1. A−→B: tA , NA
2. B−→A: tB , NB , CB
3. A−→B: {A, CA , Auth}KAB
4. B−→A: {B, CB , Auth}KBA
Here:
1 tA and tB are the Diffie-Hellman values calculated by A and B,
respectively.
2 NA and NB are nonces.
3 CB and CA are the public key certificates of B and A, respectively.
4 Auth is a block of data signed by the sender’s secret key.
5 The keys KAB and KBA are different, but they have been derived from
the common DH value. So both A and B know these keys.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 60 / 1
Internet Key Exchange, IKE IV
1. A−→B: tA , NA
2. B−→A: Cookie
3. A−→B: Cookie, tA , NA
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 61 / 1
Internet Key Exchange, IKE V
After this, the protocol continues as before.
B should send a cookie back when it detects a large number of
half-finished IKE-negotiations.
There are many other details which must be taken into account in this
type of a practical protocol. For example:
Retransmission timers.
Use of sequence numbers (against reply).
Window size for overlapping requests.
State synchronization and connection timeouts.
Rekeying.
Reuse of DH-exponentials.
Generating keying material.
Extensible authentication methods (EAP).
Error handling.
NAT traversal.
Timo Karvi () Cryprography and Network Security, PART II: Key Exchange Protocols
10.2013 62 / 1