rules for data transmission in a network.
i.e. HTTP
Cryptographic protocol
communication protocol for encrypted messages.
used in: e-banking, e-commerce, file sharing, online messengers
Cryptography is not enough: the attacker can circumvent cryptography and break the protocol.
Possible flaws can be in the:
Protocol design / implementation
Encryption design
Automated Protocol Analysis
Protocols are complicated and attacks are difficult to find. We need Automatation, formal proofs.
Requirements:
Specification language for the protocol (= process calculus:
λ
-Calculus,
π
-Calculus)
Formal definition of Security
Automated security analysis (ProVerif)
Attacks
Interleaving Attack
Message from one protocol-session is used in other ones.
Reflection Attack
(Subtype of Interleaving attack)
Message sent back to the person that generated it (in a different session).
Problem: (If we are using symmetric encryption) the sender can not verify who sent the message.
Solution: Identifier (sender / receivers name)
A−{A,Give E 1000€}k→B
Replay Attack
(Subtype of Interleaving attack)
Duplicate of message re-sent at a different time.
Problem: we cant verify the freshness of the received message.
Solution 1: timestampt(issues with time zones, synchronization)
A−{A,Give E 1000€,t}k→B
Solution 2: noncen
A⟵nB−B
Challenge / Request
A−{A,Give E 1000€,nB}k→B
Response
Man-in-the-middle Attack
Needham-Shroeder Protocol
Uses nonces
n
, Asymmetric encryption to exchange symmetric keys.
Because public keys / nonces are for specific sessions, we don't need identifiers
(except for the first message or else someone could respond faster thanBusingpkAfrom that session).
A←{B,nB}pkA−B
A−{nB,nA}pk
B
→B
A←{nA}pkA−B
Man-in-the-middle Attack
The victim
B
then thinks he is communicating with
◯
but he is actually communicating with
A
.
The attacker has access to
nA,nB
and can decrypt all messages from
B
.
A←{B,nB}pkA−◯←{B,nB}pk◯−BAttacker reads Bobs messages, has hisnB.
A−{nB,nA}pk
B
→B
A←{nA}pkA−◯←{nA}pk◯−BAttacker getsnAfrom Bob.
Solution: Needham-Schroeder-Lowe Protocol
A←{B,nB}pkA−B
A−{A,nB,nA}pk
B
→B(new identifier!)
A←{nA}pkA−B
Then the attack is not possible because bob does not think he is talking to
◯
anymore.
Applied Pi-Calculus
Highly abstracted mathematical descriptions for concurrent computation.
Very simple, only based on functions, no side-effects, only focused on communication.
Considers cryptography as flawless.
Example: Digital Signature
We want to model
A
using a digital signature that can be verified with a
pk
.
A⟵nB —–B
A — {B,nB,nA}skA→B
whereskA:=sk(kA)
We can express the entire digital signature encryption as
ver(sign(x,sk(k)),vk(k))→x
Below we usedkAfork.
And model the process the following way
System≜new kA.(Init∣Resp)
Init≜new nB.out(c,nB).in(c,x).let(=B,=nB,z)=ver(x,vk(kA)) in P
Answer: Yes -
s
is kept a secret and the attacker can not forge
h(pair(s,N))
Basic Security Goals
There are many more properties, but we only focus on these.
Secrecy
Only authorized end-points should be able to read messages.
Secrecy is undecidable - infinite number of opponents
O
.
(automatized proofs with tools possible).
Protocol
P
preserves secercy of
M⇔
∀O,c∈fn(O):P∣O
does not output
M
on channel
c
.
Where channelcis a free name (public) known to processO.
If the attacker can not outputM, it has no access to it.
Integrity
The recipient of a message should be able to determine changes during transmission.
Sender and receiver should agree on their roles.
Authenticity
For authentication we have to introduce a new process:
eventp(M)Event process: This processpglobally logsM.
We use these events to
log authentication / acceptance of requests
:
eventbegin(A,B,M)start of authentication request fromAtoBfor messageM
eventend(A,B,M)acceptance of request byB
Example
A⟵nB —–B
A — {B,nB,nA}s
k
A→B
whereskA:=sk(kA)
System≜
new kA.
(Init∣Resp)
Resp≜
in(c,x).
new n
B
.
eventbegin(A,B,M)
out(c,sign((B,x,nA),sk(kA)))
Init≜
new n
B
.
out(c,n
B
).
in(c,x).
let((=B,=n
B
,z)=ver(x,vk(kA))) in P
eventend(A,B,M)
Non-Injective Agreement
Identity: The recipient should be able to verify the requesters identity.
Order: In all execution traces, if we reach the
end
we must have also reached a
begin
.
Formally
P
guarantees noninjective agreement iff:
∀O:P∣O→∗ new a.(event end(A,B,M)∣Q)⟹
Q≡ event begin(A,B,M)∣Q′
In depth explaination
Pis the process we want to analyse that runs parallel to any opponentO.
Qis the process left afterPandQ′is the process left afterQ.
→∗stands for n-step reductions.
astands for a sequence of variables that are bounded in the following process.
This is a recursive definition:
It means that in our closed process
P
for any opponent
O
that we run in parallel, after n-reductions and binding arbitrary many variables to our process (which we simply refer to as
a
- we must always reach two processes running in parallel from which both fulfill the non-injective agreement.
Because these processes can run concurrently we can have any arbitrary ordering as long as an end event always follows after a
begin event.
Therefore these orderings would both be valid although the required end event does not follow immediately after the begin event:
Begin1
→
Begin2
→
End1
→
End2
Begin1
→
Begin2
→
End2
→
End1
Injective Agreement
Freshness: same as above but recipient should be able to verify the freshness of the authentication request.
Reminder: we place loggers before and after each authentication / acceptance of requests.
When a direction is mentioned in which an injective agreement is given that means that the freshness of the received nonce can be verified
by the receiver.
PC Handshake
Symmetric version
A←nB−B
A−{A,m,nB}kA
B
→B(kAB= symmetrical key)(Injective)
Asymmetric version
Identifier was changed - else the message could be sent to anyone.
A←nB−B
A−{B,m,nB}skA→B(skA= digital signature fromA)(Injective)
CP Handshake
The second message is an acknowledgement.
There are 2 authentications happening.
Symmetric version
A←{A,m,nB}kA
B
−B(Non-Injective)
A−nB→B(Injective)
Asymmetric version
Here the request is encrypted with
pkA
- Then the identifier must be changed to
B
.
The request might come from an attacker.
A←{B,m,nB}pkA−B
A−nB→B(Injective)
CC Handshake
Symmetric version
The first agreement property (
A←B
) only holds if the endpoints can not swap roles (we must add tags for the messages).
We can not change the identifiers in the messages since it would make the protocol vulnerable to a reflection attack.
A←{B,m1,nB}kA
B
−B(Non-Injective)
A−{B,m2,nB}kA
B
→B(Injective)
Asymmetric version
A←{B,m1,nB}pkA−B
A−{B,m2,nB}pk
B
→B(Injective)
Combination of Handshakes
All the other protocols are only made out of the ones mentioned above.
Example: Mutual Authentication
Combination of PC and CC handshake.
A←nB−B
A−{B,m1,nB,nA}kA
B
→B(Injective)
A←{m2,nB,nA}kA
B
−B(Injective)
We can not remove the identifier
B
or else a reflection attack would be possible.
Example: SAML-based single sign-on
Protocol to allow client
C
to authenticate with a service provider
SP
via an identity provider
IdP
.
The client wants to request some resource from the service provider.
(Instagram in example.)
The Service provider then allows the client to log in with a third party.
(Google in example.)
Using automated techniques, people found an attack:
The
IdP
then (if this protocol would ever be used) have access to the clients
C
google account data (Gmail, google calendar, ...).
ProVerif
Cryptographic protocol verifier based on Horn clause resolution.
Input notation: applied pi-calculus.
Outcomes
Possible outcomes after modelling a protocol:
a) proven security
b) found attacks - (could be a false positve because of abstraction)
Why is that so? Because if the attacker knows the ciphertextx1and the encryption keyx2then he can construct the result of the destructor which would be the plaintext in this case.
For each Input and output
message(x,y)∧attacker(x)⇒attacker(M)Ifyis on channelxand the attacker knows that channel, then he has access to it.
attacker(x)∧attacker(y)⇒message(x,y)If the attacker knows the channelx, then he can put out content on it.
Protocol Rules
ProtocolRules(P)=
Each output
out(c,N)
generates a Horn-Clause with the form:
message(c1,M1)∧…∧message(cn,Mn)⇒message(c,N)
whereMiare the previously received messages andNis a combination of all previous messages.