Key Exchange

advertisement
Bishop: Chapter 9
Key Management
Computer Security
1
Topics
•
Key exchange
–
–
–
•
Cryptographic key infrastructure
–
•
Certificates
Key storage
–
–
•
Session vs interchange keys
Classical vs public key methods
Key generation
Key escrow
Key revocation
Digital signatures
Computer Security
2
Notation
• X  Y : { Z || W } kX,Y
– X sends Y the message produced by concatenating Z
and W enciphered by key kX,Y, which is shared by users
X and Y
• A  T : { Z } kA || { W } kA,T
– A sends T a message consisting of the concatenation of
Z enciphered using kA, A’s key, and W enciphered using
kA,T, the key shared by A and T
• r1, r2: nonces (nonrepeating random numbers)
Computer Security
3
Session, Interchange Keys
• Alice wants to send a message m to Bob
– Assume public key encryption
– Alice generates a random cryptographic key ks and uses
it to encipher m
• To be used for this message only
• Called a session key
– She enciphers ks with Bob’s public key kB
• kB enciphers all session keys Alice uses to communicate with
Bob
• Called an interchange key
– Alice sends { m } ks { ks } kB
Computer Security
4
Benefits
• Limits amount of traffic enciphered with single
key
– Standard practice, to decrease the amount of traffic an
attacker can obtain
• Possible attacks
– Example: Alice will send Bob a message that is either
“BUY” or “SELL”. Eve computes possible ciphertexts
{ “BUY” } kB and { “SELL” } kB. Eve intercepts
enciphered message, compares, and gets plaintext at
once.
Computer Security
5
Key Exchange Algorithms
• Goal: Alice, Bob get shared key
– Key cannot be sent in clear
• Attacker can listen in
• Key can be sent enciphered, or derived from
exchanged data plus data not known to an
eavesdropper
– Alice, Bob may trust third party
– All cryptosystems, protocols publicly known
• Only secret data is the keys, ancillary information
known only to Alice and Bob needed to derive keys
• Anything transmitted is assumed known to attacker
Computer Security
6
Classical Key Exchange
• Bootstrap problem: how do Alice, Bob
begin?
– Alice can’t send it to Bob in the clear!
• Assume trusted third party, Cathy
– Alice and Cathy share secret key kA
– Bob and Cathy share secret key kB
• Use this to exchange shared key ks
Computer Security
7
Simple Protocol
1. Alice
2. Alice
3. Alice
{ request for session key to Bob } kA
{ ks } kA || { ks } kB
{ ks } kB
Cathy
Cathy
Bob
• Then ks can be used as the secret key between Alice and Bob.
e.g., 4. Alice  Bob {M} ks
Computer Security
8
Problems ?
• How does Bob know he is talking to Alice?
– Replay attack: Eve records message from Alice to Bob
(esp. messages 3 and 4), later replays it; Bob may think
he’s talking to Alice, but he isn’t.
e.g., Session key reuse: Eve replays message from Alice to Bob,
so Bob re-uses session key.
e.g., Eve replays the message {“Deposit $500 to Jack’s account”
}, originally sent from Alice to Bob.
• Protocols must provide authentication and defense
against replay.
Computer Security
9
Needham-Schroeder
1. Alice
2. Alice
3. Alice
4. Alice
5. Alice
Alice || Bob || r1
{ Alice || Bob || r1 || ks || { Alice || ks } kB } kA
{ Alice || ks } kB
{ r2 } ks
{ r2 – 1 } ks
Computer Security
Cathy
Cathy
Bob
Bob
Bob
10
Argument: Alice talking to Bob
• Second message
– Enciphered using key only she and Cathy know
• So Cathy must have enciphered it
– Response to first message
• As r1 in it matches r1 in first message
• Third message
– Alice knows only Bob can read it
• As only Bob can derive session key from that message
– Any messages enciphered with that key are from Bob
Computer Security
11
Argument: Bob talking to Alice
• Third message
– Enciphered using key only he and Cathy know
• So Cathy must have enciphered it
– Names Alice, session key
• Cathy provided session key, says Alice is the other party
//identity associated with the session key
• Fourth message
– Uses session key to determine if it is replay from Eve
• If not, Alice will respond correctly in fifth message
• If so, Eve can’t decipher r2 and so can’t respond, or responds
incorrectly
Computer Security
12
Denning-Sacco Modification
• Assumption of Needham-Schroeder: All keys are
secret.
• Question: Suppose Eve can obtain the session key.
How does that affect the protocol?
– In what follows, Eve knows ks .
a. Eve
{ Alice || ks } kB
b. Alice (intercepted by Eve)
c. Eve
{ r 2 – 1 } ks
Computer Security
Bob
{ r2 } ks
Bob
Bob
13
Problem & Solution
• In the protocol above, Eve impersonates Alice.
• Problem: replay in the third step of NeedhamSchroeder
– i.e., Step a in the previous slide
• Solution: use time stamp T to detect replay
Computer Security
14
Needham-Schroeder with
Denning-Sacco Modification
1. Alice
Alice || Bob || r1
Cathy
{ Alice || Bob || r1 || ks || { Alice || T || ks } kB } kA
2. Alice
Cathy
3. Alice
{ Alice || T || ks } kB
Bob
• Bob will reject the message if T is too old.
4. Alice
5. Alice
{ r2 } ks
{ r2 – 1 } ks
Computer Security
Bob
Bob
15
Needham-Schroeder with
Denning-Sacco Modification
• Weakness: If clocks are not synchronized, Bob may
either reject valid messages or accept replays.
– [Denning-Sacco] Parties with slow clocks are vulnerable
to replay.
– [Gong] Parties with fast clocks are also vulnerable.
+ Resetting clock does not eliminate vulnerability.
Computer Security
16
Otway-Rees Protocol
• Corrects the problem in the Needham-Schroeder
– That is, Eve replaying the third message in the protocol
• Does not use timestamps
– Not vulnerable to the problems that Denning-Sacco
modification has
• Uses an integer n to associate all messages with
particular exchange
Computer Security
17
The Protocol
1. Alice
n || Alice || Bob || { r1 || n || Alice || Bob } kA
Bob
n || Alice || Bob || { r1 || n || Alice || Bob } kA ||
2. Cathy
Bob
{ r2 || n || Alice || Bob } kB
3. Cathy
4. Alice
n || { r1 || ks } kA || { r2 || ks } kB
n || { r1 || ks } kA
Computer Security
Bob
Bob
18
Argument: Alice talking to Bob
• Fourth message
– If n matches the first message, Alice knows it is
part of this exchange protocol.
– Cathy generated ks because only she and Alice
know kA .
– Alice determines that the enciphered part
belongs to the exchange as r1 matches r1 in
encrypted part of the first message.
Computer Security
19
Argument: Bob talking to Alice
• Third message
– If n matches the second message, Bob knows it
is part of this exchange protocol.
– Cathy generated ks because only she and Bob
know kB .
– Bob knows that the enciphered part belongs to
the exchange as r2 matches r2 in encrypted part
of the second message.
Computer Security
20
Replay Attack against the OtwayRees Protocol ?
• Eve acquires a ks and the message in the third step
– n || { r1 || ks } kA || { r2 || ks } kB
• Eve forwards appropriate part to Alice
– Alice has no ongoing key exchange with Bob: n
matches nothing, so is rejected.
– Alice has ongoing key exchange with Bob: n does not
match, so is again rejected.
• If replay is for the current key exchange, and Eve sent the
relevant part before Bob did, Eve could simply listen to traffic;
no replay is needed for Eve to get the information.
Computer Security
21
Kerberos
• Authentication system
– Based on Needham-Schroeder with Denning-Sacco
modification
– Central server plays role of trusted third party
(“Cathy”)
• Ticket
– Issuer vouches for identity of requester of service
• Authenticator
– Identifies sender
Computer Security
22
Idea
• User u authenticates to the Kerberos server:
– Obtains ticket Tu,TGS for ticket granting service (TGS)
• User u wants to use service s:
– User u sends authenticator Au, ticket Tu,TGS to the TGS
asking for ticket for service s.
– TGS sends ticket Tu,s to user u.
– User sends Au, Tu,s to the server as a request to use s.
• Details follow
Computer Security
23
Ticket
• Credential saying the ticket issuer (i.e., the
authentication server) has identified the ticket
requester (i.e., user u)
• Example ticket issued to user u for service s
Tu,s = s || { u || u’s address || valid time || ku,s } ks
where:
– ku,s is session key for user u and the ticket granting service s.
– ks is the key shared between s and the authentication server
– Valid time is interval for which the ticket is valid.
– u’s address may be IP address or something else
• Note: more fields, but not relevant here
Computer Security
24
Authenticator
• Credential containing identity of the sender of a
ticket
– Used to confirm the sender is the entity to which the
ticket was issued.
• Example: an authenticator that user u generates for
authenticating himself to service s
Au,s = { u || generation time || kt } ku,s
where:
– kt is an alternate session key
– Generation time is when authenticator generated
• Note: more fields, not relevant here
Computer Security
25
Computer Security
26
Protocol
1. user
2. user
3. user
4. user
5. user
6. user
user || TGS
{ ku,TGS } ku || Tu,TGS
service || Au,TGS || Tu,TGS
user || { ku,s } ku,TGS || Tu,s
Au,s || Tu,s
{ t + 1 } ku,s
Computer Security
Cathy
Cathy
TGS
TGS
service
service
27
Exercises
1. In constructing Au,s (see steps 3 and 5), the user u needs to
know his session key with s, i.e., ku,s. How does u get the
session key?
Hint: Show details of Au,s and Tu,s .
2. How is the session key between u and the TGS, i.e., ku,TGS ,
used in the protocol?
3. How is the session key between u and the service provider s,
i.e., ku,s , used in the protocol?
c.f., An alternative illustration of the Kerberos protocol:
http://sce.cl.uh.edu/yang/teaching/csci5233fall02/Kerberos_Authenticati
on_Steps.html
Computer Security
28
Analysis
• First two steps get user ticket to use TGS
– User u can obtain session key, ku,TGS , only if u
knows key shared with Cathy, Ku .
• Next four steps show how u gets and uses
ticket for service s
– Service s validates request by checking sender
(using Au,s) is the same as entity ticket issued to
– Step 6 optional; used when u requests confirmation
Computer Security
29
Problems
• Relies on synchronized clocks
– If not synchronized and old tickets, authenticators not
cached, replay is possible.
• Tickets have some fixed fields
– Dictionary attacks possible
– Kerberos 4 session keys weak (had much less than 56
bits of randomness); researchers at Purdue found them
from tickets in minutes
• Solutions? A potential research or survey project
Computer Security
30
Key Exchange using Public Key
• Here interchange keys known
– eA, eB : Alice and Bob’s public keys known to all
– dA, dB : Alice and Bob’s private keys known only to the
owner
• Simple protocol
– ks is the desired session key
Alice
{ ks } eB
Computer Security
Bob
31
Problem and Solution
• Vulnerable to forgery or replay
– Because eB known to anyone, Bob has no assurance that
it was really Alice that sent the message
• Simple fix uses Alice’s private key
– ks is the desired session key
Alice
{ { ks } dA } eB
Computer Security
Bob
32
Notes
• Can include message enciphered with ks
• Assumes Bob has Alice’s public key, and vice
versa
– If not, each must get it from a public server
– If keys not bound to identity of the owner, attacker Eve
can launch a man-in-the-middle attack (next slide;
Cathy is public server providing public keys)
• Solution to this (binding identity to keys) discussed
later as public key infrastructure (PKI)
Computer Security
33
Man-in-the-Middle Attack
(in key exchange using public keys)
Alice
send Bob’s public key
Eve
Alice
Alice
eE
Eve intercepts request
send Bob’s public key
eB
Eve
Cathy
Cathy
Cathy
Eve
{ k s } eE
Eve intercepts message
Eve
Computer Security
{ ks } eB
Bob
Bob
34
Key Generation
• Goal: generate difficult-to-guess keys
• Problem statement: given a set of K potential keys,
choose one randomly
– Equivalent to selecting a random number between 0
and K–1 inclusive
• Why is this hard: generating random numbers
– Actually, numbers are usually pseudo-random, that is,
generated by an algorithm
Computer Security
35
What is “Random”?
• Sequence of cryptographically ransom numbers: a
sequence of numbers n1, n2, … such that for any
integer k > 0, an observer cannot predict nk even if
all of n1, …, nk–1 are known
– Best: physical source of randomness
•
•
•
•
Random pulses
Electromagnetic phenomena
Characteristics of computing environment such as disk latency
Ambient background noise
Computer Security
36
What is “Pseudorandom”?
• Sequence of cryptographically pseudorandom
numbers: sequence of numbers intended to
simulate a sequence of cryptographically random
numbers but generated by an algorithm
– Very difficult to do this well
• Linear congruential generators [nk = (ank–1 + b) mod n]: broken
• Polynomial congruential generators [nk = (ajnk–1j + … + a1nk–1
a0) mod n]: broken too
• Here, “broken” means next number in sequence can be
determined
Computer Security
37
Best Pseudorandom Numbers
• Strong mixing function: function of 2 or
more inputs with each bit of output
depending on some nonlinear function of all
input bits
– Examples: DES, MD5, SHA-1
– Use on UNIX-based systems:
(date; ps gaux) | md5
where “ps gaux” lists all information about all
processes on system
Computer Security
38
Exercise #1
• The term “session” in “session keys” may be one of the following three
cases:
a)
b)
c)
A session is a fixed period of time, say 60 sec or 20 min, and so on.
A session is the time between two events. For example, a user session is
established from the time the user logs in, until the user logs off.
A session is a message.
In all three cases, a session key is created and used throughout that session.
This exercise has two components:
1.
Give an example of session keys for each of the three cases. Provide
sufficient details for people to understand your examples.
2.
What are the relative pros and cons of the three types of session keys?
Justify your answer.
Computer Security
39
Exercise #2
• Classical Key Exchange includes a set of protocols that use only
classical cryptography to generate session keys. The NeedhamSchroeder protocol was proposed as a remedy against replay attacks that
may be launched against the simple protocol.
This exercise has two components:
1.
Would the Needham-Schroeder protocol successfully mitigate the replay
attacks that can be effectively launched against the simple protocol?
Justify your answer.
2.
Perform a vulnerability analysis on the Needham-Schroeder protocol.
Can any of the five steps in that protocol be effectively replayed? Justify
your answer.
Computer Security
40
Exercise #3
• Public Key Cryptographic Key Exchange is briefly discussed in 9.2.3. A
simple protocol was proposed. In that protocol, when entity A wants to
share a session key with entity B, A first encrypts the session key with
her own private key and then enciphers the resulting ciphertext with the
B’s public key.
A  B: { { ks } dA } eB
This exercise has two components:
1.
Do you agree with the author that such a simple protocol based on public
key cryptography would effectively enable key exchange between A and
B. Justify your answer. Hint: What security services are provided in this
protocol? Is it subject to common attacks like fabrication attacks, man-inthe-middle attacks, or replay attacks?
2.
Present a complete solution relaying on public key cryptography. Explain
why your protocol would be an effective solution.
Computer Security
41
Download