08 Ban-Logic
08 Ban-Logic
cryptographic protocols
Main topics
! The BAN logic
! Design principles
! Case studies
• Needham-Schroeder Kerberos
• Otway-Rees
• SSL (an old version)
• GSM
P X P sees X:
P |∼ X P once said X:
P ⇒ X P controls X.
# (X ) X is fresh
K
P ↔ Q K is a shared key between P e Q
Formalism
K
P Q X is a shared secret between P e Q
K
P K is P’s public key
X Y
X is a combined with Y
K
A|≡ A↔ B A believes K to be a shared key with B
⎛ K ⎞
A|≡ T ⇒ # ⎜ A↔ B⎟ A believes that T is competent in generating fresh
⎝ ⎠
session keys
Preliminaries
! BAN logic considers two epochs: the present
and the past
• The present begins with the start of the protocol
K
If K is Q’s public key, and P sees a message
P |≡ Q, P { X } K −1 signed by con K-1 containing X, then P believes
P |≡ Q |∼ X
that X was sent by Q
Altri postulati
P |≡ X , P |≡ Y P |≡ ( X ,Y ) P |≡ Q |≡ ( X ,Y ) P |≡ Q |∼ ( X ,Y )
P |≡ ( X ,Y ) P |≡ X , P |≡ Y P |≡ Q |≡ X P |≡ Q |∼ X
P |≡ #( X )
P |≡ #( X ,Y )
P ( X ,Y ) P X Y
P X P X
K K K
P |≡ Q ↔ P, P { X } K P |≡ P, P { X } K P |≡ Q, P { X } K −1
P X P X P X
K K K K
P |≡ R ↔ R′ P |≡ Q |≡ R ↔ R′ P |≡ R R′ P |≡ Q |≡ R R′
K K K K
P |≡ R′ ↔ R P |≡ Q |≡ R′ ↔ R P |≡ R′ R P |≡ Q |≡ R′ R
For example:
A → B : { A, K ab } K
bs
Protocol analysis
! Protocol analysis consists in the following steps
1. Derive the idealized protocol from the real
one
2. Determine assumptions
3. Apply postulates to each protocol step and
determine beliefs achieved by principals at
the step
4. Draw conclusions
Assertion i-1 A |≡ A ↔ B
A → B : { X }K
By applying the message
Step i meaning postulate
K
Assertion i A |≡ A ↔ B, B |≡ A |∼ X
Objectives of a protocol
Objectives depend on the context
! Typical objectives
K K
A |≡ A ↔ B B |≡ A ↔ B (key authentication)
K K
often A |≡ B |≡ A ↔ B B |≡ A |≡ A ↔ B (key confirmation)
A |≡ # ⎛⎜ A ↔ B ⎞⎟ B |≡ # ⎛⎜ A ↔ B ⎞⎟
K K
also (key freshness)
⎝ ⎠ ⎝ ⎠
Real protocol
M1 A→T A, B, N a
M 2 T → A EKa ( N a , B, K ab , EKb ( K ab , A ) )
M3 A → B EKb ( K ab , A )
M 4 B → A EKab ( N b )
M5 A → B EKab ( N b − 1)
Needham-Schroeder (1978)
Implicit statement, not explicitly
derived from the real protocol
Idealized protocol • The idealized protocol may contain implicit
statements
⎧ Kab ⎫
M3 A → B ⎨ A ↔ B⎬
⎩ ⎭ Kb
⎧ K ab
⎫
M 4 B → A ⎨ N b , A ↔ B ⎬ from B
⎩ ⎭ Kab
⎧ K ab
⎫
M5 A → B ⎨ N b , A ↔ B ⎬ from A
⎩ ⎭ Kab
⎧ K ab
⎫ After receiving Kab, B has said Kab is
M 4 B → A ⎨ Nb , A ↔ B ⎬ from B good to talk to A
⎩ ⎭Kab
⎧ K ab
⎫ After receiving Nb, A has said Kab is
M 5 A → B ⎨ Nb , A ↔ B ⎬ from A good to talk to Bob
⎩ ⎭Kab
Needham-Schroeder
Assumptions Objectives
Ka Kb K ab
A |≡ A ↔ T B |≡ B ↔ T A |≡ A ↔ B
Ka Kb K ab
T |≡ A ↔ T T |≡ B ↔ T B |≡ A ↔ B
K ab K ab
T |≡ A ↔ B A |≡ B |≡ A ↔ B
⎛ K ab
⎞ ⎛ K ab
⎞ K ab
A |≡ ⎜ T ⇒ A ↔ B ⎟ B |≡ ⎜ T ⇒ A ↔ B ⎟ B |≡ A |≡ A ↔ B
⎝ ⎠ ⎝ ⎠
⎛ ⎛ Kab ⎞ ⎞ Principle 2. Designer must know
A |≡ ⎜ T ⇒ # ⎜ A ↔ B ⎟ ⎟
⎝ ⎝ ⎠⎠ the trust relationships upon which
A |≡ # ( N a ) B |≡ # ( N b ) the protocol is based. He/she must
know why they are necessary. Such
⎛ K ab ⎞ ⎛ K ab ⎞ reasons must be made explicit.
T |≡ # ⎜ A ↔ B ⎟ B |≡ # ⎜ A ↔ B ⎟
⎝ ⎠ ⎝ ⎠
Otway-Rees protocol
Real protocol
M1. A → B : M , A, B, EK A ( N A , M , A, B )
M2. B → T : M , A, B, EK A ( N A , M , A, B ) , EK B ( N B , M , A, B ) T
M3. T → B : M , EK A ( N A , K ab ) , EK B ( N B , K ab ) M2 M3
M1
M4. B → A : M , EK A ( N A , K ab )
Idealized protocol A B
M1. A → B : { N A , M , A, B}K M4
a
⎧ K ab
⎫ ⎧ K ab
⎫
M3. T → B : ⎨ N a , A ↔ B, B |~ M ⎬ , ⎨ N b , A ↔ B, A |~ M ⎬
⎩ ⎭Ka ⎩ ⎭ Kb
⎧ K ab
⎫
M4. B → A : ⎨ N b , A ↔ B, A |~ M ⎬
⎩ ⎭Ka
Otway-Rees
M1. A→ B:{N A , M , A, B}K a
⎧ K ab
⎫ ⎧ K ab
⎫
M3. T → B : ⎨ N a , A ↔ B, B |~ M ⎬ , ⎨ N b , A ↔ B, A |~ M ⎬
⎩ ⎭Ka ⎩ ⎭ Kb
⎧ K ab
⎫
M4. B → A : ⎨ N a , A ↔ B, B |~ M ⎬
⎩ ⎭Ka
M1: Alice says that M is a transaction with Bob and Na is
another name of Alice in M
M3: After receiving Nb, T says that Kab is good and that Alice
believed to be in M
M4: After receiving Na, T says that Kab is good and that Bob believed to
be in M
Ipotesi Risultati
Ka Kb K ab
A |≡ A ↔ T B |≡ A ↔ T A |≡ A ↔ B
Ka Kb K ab
T |≡ A ↔ T T |≡ A ↔ T B |≡ A ↔ B
K ab A |≡ B |≡ M
T |≡ A ↔ B B |≡ A |~ M
A |≡ ⎜ T ⇒ A ↔ B ⎟ B |≡ ⎜ T ⇒ A ↔ B ⎞⎟
⎛ ⎞ ⎛
K K
⎝ ⎠ ⎝ ⎠
A |≡ (T ⇒ B |~ M ) B |≡ (T ⇒ A |~ M )
A |≡ # ( N a ) B |≡ # ( N b )
A |≡ # ( M )
Protocollo di Otway-Rees
After M2
T |≡ A |~ ( N a , M , A, B ) T |≡ B |~ ( Nb , M , A, B )
After M3
⎛ K ab
⎞
B |≡ T |~ ⎜ N b , A ↔ B, A |~ M ⎟ Given Bob’s belief in Nb freshness, then
⎝ ⎠
⎛ K ab
⎞
B |≡ T |≡ ⎜ N b , A ↔ B, A |~ M ⎟ Given Bob’s trust in T about keys and its capability to
⎝ ⎠ relay, then
K ab
B |≡ A ↔ B, B |≡ A |~ M
After M4
⎛ K ab
⎞
A |≡ T |~ ⎜ N a , A ↔ B, B |~ M ⎟ Given Alice’s belief in Na, then
⎝ ⎠
⎛ K ab
⎞
A |≡ T |≡ ⎜ N a , A ↔ B, B |~ M ⎟ Given Alice’s trust in T about keys and its capability to
⎝ ⎠ relay and given Alice’s belief in M freshness
K ab
A |≡ A ↔ B, A |≡ B |≡ M
SNCS Ban logic 26
Otway-Rees
! Nonces Na and Nb are for freshness but also to link messages M1 and
M2 to messages M3 and M4, respectively
! Nonce Na (Nb) is a reference to Alice (Bob) within M, or equivalently,
! nonce Na (Nb) is another name for Alice (Bob) in M
! In M1 (M2), encryption is not for secrecy but to indissolubly link Alice
(Bob), Na (Nb) and M together
Otway-Rees modified
! If nonces have to guarantee freshness only, then messages
M1 and M2 could be modified as follows
M1. A → B : M , A, B, N A , EK A ( M , A, B )
M2. B → T : M , A, B, N A , EK A ( M , A, B ) , N B , EK B ( M , A, B )
Otway-Rees modified
The Attack
M1. A → B[C ]: M , A, B, N a , EK A ( M , A, B )
M2. C → T : M ′, A, C , N a , EK A ( M ′, A, C ) , N c , EKc ( M ′, A, C )
M3. T → C : M ′, EKa ( N a , K ab ) , EKc ( N c , K ab )
M4. [C ]B → A : EKa ( N a , K ab )
M1. A → B : A, B, N a
M2. B → T : A, B, N a , N b
M3. T → B : EK A ( N a , A, B, K ab ) , EK B ( N b , A, B, K ab )
M4. B → A : EK A ( N a , A, B, K ab )
M1. {K ab }K
A→ B:
b
M1: Bob sees key Kab
M3. A → B : {C ,{N } }
A b K a−1
K ab
M3: After receiving it, Alice says she saw Nb
M1′ : {K am }K m
M1: {K mb }K b
M2′ : { N b }K M2 : { N b }K
A M B
am
{C ,{N } }
mb
M3′ : A b K a−1
K am
M3 : { C A , {N b }K −1
a
} K mb
M3 A → B : {C ,{A, B, K
A ab , N b }K −1
a
}
K ab
• Important
• It’s necessary to introduce identifiers A and B in message M3
because, otherwise, the attack would be still possible by
setting Kam = Kbm
Esempio: X.509
{
A → B : A, Ta , N a , B, X a , {Ya }K
b
}
K a−1
On hash functions
For efficiency, we sign the hash of a message rather than the message
itself
A→ B: { X }K ,{h ( X )}K
b
−1
a
• The message does not contain any proof that the signer Alice actually
knows X
• However, the signer Alice expects that the receiver Bob behaves as if
the sender Bob knew the message
• Therefore, unless the signer Alice is unwary*, signing the hash is
equivalent to sign the message
P |≡ Q |∼ h ( X 1 ,, X n ) , P X 1 ,, P X n
P |≡ Q |∼ ( X 1 ,, X n )
Ipotesi Risultati
K as
A|≡ S ↔ A A|≡ S |∼ Ts
A|≡ S ⇒ Ts A|≡ S |≡ Ts
A|≡ # ( N a ) A|≡ Ts
Predictable nonces
An attack
M predicts the next value of N a
M1 M →S A, N a
M2 S → M {T , N }
s a K as
(S receives M2 at time Ts )
M2 S → A {T ,{N } }
s a K as K as
Example
• Kerberos. If the server clock can be set back, then authenticators can
be reused
• Kerberos. If the server clock can be set ahead, then it is possible to
generate post-dated authenticators
On coding messages
Principle 10. The contents of a messafe must allow us to determine: (i)
the protocol the message belongs to, (ii) the execution instance of the
protocol, (iii) the number of the message within the protocol
Example Needham-Schroeder