Lecture 6- Authentication-Notes
Lecture 6- Authentication-Notes
1
Reminder of previous lecture
• Integrity (data origin authentication/non-repudiation)
– Hash (known algorithm, no key)
• Only detect accidental modification
• Finding collisions should not be easy (birthday paradox >> n/2)
– MAC (needs key)
• Data origin authentication (only generated of key known)
• HMAC or CBC-MAC
• No non-repudiation (two parties can generate MAC)
– Digital signature (asymmetric crypto system)
• Sign with private key (only one person)
• Verify with public key (anyone)
• Look at RSA version (there are other signature schemes)
• Only mechanism to provide non-repudiation (also origin auth.)
• Only one person can generate signature
2
Today’s Lecture
• Authentication
– We have spent several lecture discussing ‘tools’
– Encryption, hash, MAC, digital signature
– In the lecture we start using these…build protocols
for entity authentication
• CILO3 and CILO4
(assessment on the security analyze security measures)
Symmetric?
Encryption
MAC
Asymmetric
Encryption
Signature
3
Entity Authentication
4
Authentication
• Alice proves her identity to Bob
– Alice and Bob can be humans or computers
• May also require Bob to prove that he is Bob
(mutual authentication)
• E.g. Octopus cards, ATM machines
Slides 5 to 8 is just some basic introduction. You only need to know that
authentication if you are dealing directly within a physically secure environment is
easy while authentication over an open network (like we usually do online needs little
more thought).
5
Authentication
• Authentication on a stand-alone computer with
physically secure connection is relatively simple
• Authentication over a network is much more
complex
– Attacker can passively observe messages
– Attacker can replay messages
– Usually need an encrypted channel to do so securely
Why are closed systems easier? There is a trusted entity overseeing the process. For
example, ATM/secure entry
6
Authentication Example: Entry to Building
See you enter PIN off a piece of paper? Hanging out near gate waiting to see
someone’s PIN?
7
Authentication Example: ATM Machine Protocol
It is difficult to see that actual communication between card and machine (inside
trusted box)
8
One-way authentication over an open network
There may be eavesdroppers on an open network.
An eavesdropper can steal Alice’s login information and then logon to the Email
Server as Alice by using Alice’s login information (masquerade attack).
Look at slides 9 and 10 and understand replay attack. If we were to use a value (even
if encrypted and the attacker does not know the value) in the same way twice this
means someone can record it and can pretend to be use later…
Study this is combination with slide 11 and understand why we need some freshness
(make each authentication sequence different – easiest way to do so is to make the
response depend on a challenge that is different each time).
This is the simplest of relay attacks, since username and password can just be reused.
9
One-way authentication over an open network
How about
10
What can go wrong here? However, can still record the message and pretend to be
Alice later. Here we do not know the password value, but the hashed or encrypted
version can just as effectively be replayed.
10
Challenge-Response One-Way Authentication
11
You must realise that entity authentication relies on responding ‘now’, with a
message that has just been generated. Later we will call this ‘freshness’
11
Challenge-Response One-Way Authentication
If Alice is a “device”, passwd can be changed to a symmetric key
“I’m Alice”
Nonce
h(K, Nonce)
Alice, K Bob, K
Usually, we ignore the first message flow from Alice to Bob when
describing a protocol:
Nonce
h(K, Nonce)
Alice, K Bob, K
12
Challenge response protocols can look a number of different ways (slide 12-15)
Look at each one and think what is important? How is this achieved?
Must be sure Alice generated the response (so only Alice must be able to generate
the response) (formally this is data origin authentication)
Must be sure Alice generated the response in reaction to the challenge we sent *just
now*. (formally this is freshness).
12
Other Challenge-Response Techniques (symmetric
key based)
Nonce
MAC(K, Nonce)
Alice, K Bob, K
E(K, Nonce)
Nonce
Alice, K Bob, K
Nonce
E(K, Nonce)
Alice, K Bob, K
13
In all three cases yes as it involves her using the shared key.
13
Public Key Notations and Assumption
14
14
Public Key Based One-Way Authentication
{R}Alice
R
Alice Bob
[R]Alice
Alice Bob
15
15
Entity authentication
• Some more formal definition:
– Claimant: An entity claiming an identity.
– Principal: The identity claimed by a claimant.
– Verifier: The entity verifying a claim.
• An entity authentication protocol is a sequence of
messages passed between a claimant and a verifier
(along with the actions taken after receiving those
messages) designed to confirm that identity of the
claimant.
You need to know the terminology claimant/principal and verifier. The claimant is the
person the verifier is talking to, the principal is the logical identity the claimant says
he is.
Our inspiration for the material in this section is the ISO/IEC 9798 standard. This is a
six-part standard which gives general abstract entity authentication protocols based
on a number of different technologies (e.g. symmetric cryptography, asymmetric
cryptography, and manual data transfer).
These protocols are not “ready to use”; they have to be adapted for use in a
particular context and so we study them as the basis for a large number of other,
sector-specific entity authentication standards.
Entity authentication
Unilateral authentication:
– entity authentication which provides one entity
with assurance of the other’s identity but not vice
versa.
• Mutual authentication:
– entity authentication which provides both entities
with assurance of each other’s identity.
For mutual authentication, which entity is the verifier and which entity is the
claimant?
They swop around – both entities are effectively both during the protocol
execution.
Entity authentication
• A verifier only sends/receives messages, i.e.
digital data.
• To check that the principal is online the verifier
need to establish:
– that the messages came from the principal (origin
authentication),
– and that the messages have been recently generated
(freshness).
• If both conditions are satisfied then we have
authenticated the claimant.
This slide again points out the requirements for entity authentication (we are sure
message come from principal, we are sure message fresh)
This is very important – you need to always know these two requirements.
Typically, in a computer system, the verifier never meets the claimant. The only way
that the verifier can gain any information about the claimant is through the messages
(digital data) that they exchange.
Therefore, the digital data has to convince the verifier that it was generated by the
principal in response to the verifier’s request.
There are two things we need to establish – the first is whether this message did
come from the principal. This is standard origin authentication.
So what do we need?
We also need to establish that this message was generated now…this is referred to as
freshness.
18
Origin authentication
• We have already studied two mechanisms
that give origin authentication:
– Message Authentication Codes (MACs)
– Digital Signature Schemes
• Entity authentication protocols sometimes
find it useful to use symmetric encryption
as an origin authentication tool…
• … but encryption doesn’t provide origin
authentication without additional features!
MAC and Digital signatures provide assurance the a specific person generated a
message.
You must also know that when we are dealing with authentication – that encryption
can give us data origin authentication (even they in general encryption does not
provide any integrity). The reason is that in these protocols the verifier knows the
expected content and format of the message (not the case for data receiver) – and if
the plaintext does not make sense (as someone tried to modify ciphertext) in reject
authentication.
Also look at slide 20 (it could be made better by introducing a dedicated MDC) – this
is any measure that would indicate that something wrong with plaintext. Ideally a
hash would work the best.
We have already studied two mechanisms that can be used to provide origin
authentication:
• MACs. A MAC can provide origin authentication because only people who hold the
correct secret key can compute the MAC. Hence, on receiving a correct MAC, you
know that the message must have come from an entity that knows the secret key. If
you know that you didn’t compute the MAC and only one other person has the key,
then you must conclude that the message comes from that other key holder.
• Digital Signature Schemes. Only the holder of the private key can compute a digital
signature, hence if you receive a correct digital signature, then you must conclude
that it was sent by the holder of the private key.
Why does it not give us data integrity? You can fiddle with the ciphertext – I decrypt it
and you essentially fiddled with the plaintext. I do not know what was sent. No origin
authentication? Because origin authentication goes hand and hand with integrity – no
integrity no origin authentication.
19
Origin authentication
• Encryption checks the integrity of a message by
checking that it “makes sense”.
• It is hard for a computer to check whether a message
makes sense or not.
• Append a manipulation detection code (MDC) to the
message before encryption.
• A message “makes sense” if the MDC is correct for the
decrypted message.
• What is MDC? Have we dealt with one before?
– Could also be known or expected data in special case
– A protocol could be design the receiver knows value
Upon receiving a message, an entity first decrypts it, and then checks that it “makes
sense” by checking that the MDC code appended to the end of the message is correct
for that message.
It is hoped that any entity who wishes to change the encrypted message will not
know how to change the MDC, and so any changes will be detectable.
Note that if we’re using an unkeyed MDC, like a hash function or MDC that anyone
does know how to change, then it is best practice opinion that this assumption can
only hold if we use CBC mode encryption.
20
Freshness
• We have two methods to check that a
message was recently generated (fresh).
– Time stamps (both clock-based and “logical”)
– Nonces or challenges (as in challenge-response
protocols)
• Both involve computing some form of
integrity protection for a unique string (the
nonce or the time stamp).
There are two major methods for checking that a message is fresh (i.e. that it was
recently generated). These are by the use of nonces and the use of time-stamps.
Otherwise we just send a nonce, and the nonce comes back…who sent the nonce
back? Anyone…
We get a message with a time stamp…who can create a time stamp? Anyone…
This does not give us any indication as to freshness of a response from a specific
entity.
Know the advantages and disadvantages of time stamps and also study slide 23 on
the need for a ‘window of acceptance’.
Clearly, the inclusion of a time stamp (a bit string representing the time and date of
the creation of the message) enables the recipient to check when the message was
created, i.e. that it is fresh.
However, it does have a significant disadvantage in that both the sender and the
receiver must have securely synchronised clocks.
Providing such clocks is not necessarily easy, especially when you consider that a
typical workstation might lose or gain up to one second per day. Hence, we must find
a way to update user’s clocks securely.
However, this is not easy. To securely update a user’s clock (or initially synchronise
user’s clock) would requires some form of entity authentication to make sure that the
update comes from the appropriate source, and this update cannot make use of time
stamps. There are two solutions to this problem:
• The update protocol should make use of nonces for freshness.
• The update protocol should make use of some reliable third party source of
accurate time (such as national radio broadcast time).
Freshness
• Clock synchronisation problems and network
delays cause problems for time-stamp-based
protocols.
• Necessary to accept time stamps within a
“window of acceptance”.
• Necessary to store a log of received messages
within the current window to avoid replays.
Given that it is difficult to create two completely synchronised clocks, and that it
takes a certain amount of time for a message to cross a network, it is very unlike that
a message will arrive at precisely the time stated by the time stamp.
Lets say my windows is 10 seconds, and I receive a message 1s after the stated
timestamp? Is this valid? Lets say the attacker records this message and replays is 4
second later – is this still a valid message?
So this could allow an attacker to replay a message to a receiver any number of times
providing that its time stamp lies within the window of acceptance. This problem can
be solved by keeping a record of all the messages that are received by the receiver
and which are still fresh (i.e. that there time stamps are within the window of
acceptance), and refusing to accept any message more than once.
Freshness
• Logical time stamps (or sequence numbers)
can be used in some protocols in place of
“full” time stamps.
• Each entity maintains counters stating how
many messages have been sent to and
received from a particular entity.
• Let NAB be the number of messages A has
sent to B (both A and B should know this).
You should study the concept of logical time stamps (slide 24-25). These are simply
sequence numbers, rather than time. The same concept applies – except an old
message is not old in time, but contains a number that is smaller than the current
counter value.
So in this case both parties maintain two counters. A maintains a counter for
messages sent to B, and A maintains a counter for messages received from B.
Freshness
• Whenever A sends a message to B, NAB is
increased by one and included in the message.
• When B receives a message that contains a
counter value n:
– If n > NAB then accept the message as fresh and
reset NAB = n.
– If n < NAB then reject the message as not fresh.
Every time A sends a message it sends the current value of the counter and then
increments the counter. B check the value with his locally stored counter value for
messages received from A. If the message value is greater than the counter then
fresh, and we set counter to this value.
Why? We might lose a message, the message value is greater than counter – but it is
not right just to increment counter by one.
On the other hand if the message value is smaller or equal to counter it is old.
Logical time stamps have to be used with care, because they are very vulnerable to
“preplay” attacks. However, if used carefully, then they can be very effective. Logical
time stamps are used in practice, for example in 3GPP mobile phone authentication
protocols.
What are preplay attacks? I can predict the next value – it is a counter, so I send a
message with that value. Remember - data integrity/origin authentication on sources
of freshness is important.
Freshness
Nonce-based protocols work in quite a different way. They show that a message is
fresh by including something in that message that could not have been known a long
time ago.
In this case, the nonce is a random data value (that has never been used as a nonce
before) that has been provided by Alice.
Suppose Alice generates a nonce and sends it to Bob; Bob returns the nonce to Alice;
and Alice send a last message back to Bob. Can Bob conclude that Alice’s last
message is fresh?
What if Alice’s message contains the nonce? No. Alice (or someone claiming to be her
controls the nonce).
What if along with Alice’s nonce Bob sends a nonce, and that nonce is included in the
message? Yes.
If both Alice and Bob require freshness guarantees (say, for mutual authentication),
then both Alice and Bob will need to use nonces.
26
Freshness
If a nonce is ever reused, then it may be possible to replay old messages and have
them accepted as fresh. Since nonces only provide freshness guarantees to the
person who generated them, it is up to that person to make sure that the nonce they
generate has not been used before. This can be done either by using a random bit
generator with a long output (and accepting that there is a very small chance that a
nonce will be repeated) or by using some more technical means.
Strictly speaking a counter is a good way to produce a nonce, if the counter is long
enough it will never repeat. This is the main requirement. However, some protocols
require the a nonce is unpredictable. So this the more general requirements is that a
nonce does not repeat, and it is not predictable.
27
Authentication attacks
• Many security properties of secure entity
authentication protocols are defined by their
resistance to certain kinds of attack.
• A masquerade attack is one in which the
attacker directly generates messages that
demonstrate that they are someone else.
– Prevented by origin authentication mechanisms.
You must be able to recognise the basic three attacks in a given protocol
Masquerade
Replay
Reflection
Authentication attacks
• A replay attack is one in which old messages
are replayed to a verifier.
– Prevented by freshness mechanisms.
• A reflection attack is one in which data the
verifier has produced is sent back to him.
– Prevented by including identifiers that show to
whom a message is being sent.
A replay attack – read the slide. So an attacker records a message and sends it at a
later stage.
We can attack this systems as follows. Suppose there is a session in which the
attacker is claiming to be the principal.
• The attacker receives a random nonce from the verifier.
• The attacker starts a new session with the verifier and immediately challenges the
verifier to prove his identity.
• The attacker sends the verifier the nonce he receive in the first step.
• The verifier, eager to prove his identity, responds with the MAC of the nonce
computed using the shared secret key.
• The attacker closes down this session.
• The attacker sends the MAC he has just received back to the verifier as his
authentication information for the first session.
29
How do we design/analyse protocols
• Recognise components of a cryptographic protocol
– The protocol assumptions
• What needs to have happened before the protocol is run?
– The protocol flow
• Who sends a message to whom (in what order)?
– The protocol messages
• What information is exchanged at each step?
– The protocol actions
• What needs to be done between each step?
You do not have to memorise this slide like ‘Name four components of a protocol’,
but if I give you a protocol and ask what are the assumptions? You must be able to
tell me the things that are assumed to happen, or the actions that take place that are
not explicitly shown.
Stages of protocol design/analysis
• What are the security objectives
– What do you want to do?
• What are the protocol goals
– Translating the security objectives into a set of
cryptographic requirements to be met by the end
of the protocol
• Define/analyse the protocol
– Assumptions, flow, messages, actions
31
Very simple example
• Defining the security objectives
– Bob wants to make sure that Alice was the source
of a electronic purchase contract
– Bob wants to the contract to be enforceable at
later date (Alice should not deny it)
• Determining the protocol goals
– Bob requires data origin authentication of the
message received from Alice
– Bob requires non-repudiation of the message
received from Alice
32
Specifying the protocol
M1 = MACKAB(message)
A B
M1 = SigA(message)
Goals satisfied (see slide 32)? No, we have data origin authentication but not
non-repudiation
Signature
All examples are real world protocols from the ISO/IEC 9798 authentication standard.
Please work through the example protocols and in each case decide:
Mutual or unilateral
Freshness? Why?
Data origin authentication? Why?
You should not be memorising protocols – you should understand how they work.
Practice checking for freshness and data origin authentication. You might see a
different protocol in the exam or mid-term than here. If given a protocol to analyse
you must be able to answer the questions above: who is authenticated to who? Why
– show that freshness and data origin authentication properties has been met.
Do not complicate things – if I give you a protocol and ask you what is wrong with it,
it will be masquerade/replay or reflection.
These are all real protocols! I give you references to the standard they are specified in
(no need to remember this details)
Notation
• EncKAB(X) denotes the encryption of data X
using a key KAB that is shared between A and
B. We assume this is “integrity protected”
encryption.
• MACKAB(X) denotes a cryptographic check
value (MAC) of data X using a key KAB that is
shared between A and B.
• SigA(X) denotes the signature (with appendix)
computed by A on the data X.
Example 1 (timestamp & encryption)
M1 = EncKAB(TA||B||MDC)
A B
Assumptions?
Sync clock
KAB shared
Goals?
Mutual or unilateral?
Note at this point – we are not doing all the protocols in the standard – there
are a lot and some of them are essentially the same (we only select a few and
hope you can identify what to look out for).
It is based on the use of time-stamps (for freshness) and encryption (for origin and
integrity checking). It provides unilateral authentication (B can check A’s identity, but
not vice versa).
When B receives the message from A, B deciphers the enciphered string. B checks
three things:
• that the deciphered message ‘makes sense’ (has the appropriate redundancy) –
comes from possible MDC, is sent to B and good guess for TA,
• that the time-stamp is within its current window (and, using its ‘log’, that a similar
message has not recently been received),
• that B’s name is correctly included.
36
Example 2 (nonce & MAC)
M1 = RB
A B
M2 = MACKAB(RB||B)
Assumptions?
KAB shared
Goals?
Mutual or unilateral?
The only time we have to perform an explicit nonce check is when we use symmetric
encryption as our origin authentication protocol method. Why? Because then our
integrity is tied to our formatting, redundancy – if we decrypt and the resultant
plaintext is the nonce we were looking for then we trust that nobody messed with
the message.
---
37
Example 2 (nonce & MAC v2)
M1 = RB
A B
M2 = MACKAB(RB)
Could we replace the MAC with a signature? Yes, in fact then is would be the
protocol described in clause 5.1.2 in 9798-3 (instead of the protocol here
which is the same clause in part 2).
M1 = I am B lets auth, RB
M2 = MACKAB(RB)
M1 = RB
A B
M2 = SigA (RB)
This is only a made up example to show how reflection is mostly an issue with
symmetric origin authentication method. However, it would be better to have
message 2 as SigA (RB,B) even though the signature mitigates reflection. The
reason is that even though B might never use same RB value again someone
else might. So if C uses this number in future to try and authenticate A, an
attacker could just use this message 2 from this previous exchange with B.
Freshness: Nonce
No, change the messages on slide 39 and you will see that M ends up with a
message signed by B, when he needs to respond with message signed by A.
Attack fails…
40
Example 3 (timestamp & signatures)
M1 = TA||SigA(TA||B)
A B
M2 = TB||SigB(TB||A)
This example can be found in clause 5.2.1 of ISO/IEC 9798-3. 5.2.1 in 9798-2 is the same except with
MACs.
Does both A and B know messages are fresh an why? Timestamps from both parties.
It is based on the use of time-stamps (for freshness) and digital signature (for origin and integrity
checking). It provides mutual authentication (B can check A’s identity and vice versa).
When B receives M1, B first assembles the string TA||B. B then checks two things (using a copy of A’s
public verification key):
• that the time-stamp TA is within its current window (and, using its ‘log’, that a similar message has not
recently been received),
• that the signature in M1 is a valid signature on the string TA||B.
If the checks are correct, then B accepts A as valid and sends message M2.
When A receives M2, A assembles the string TB||A and checks 2 things:
• that the time-stamp TB is within its current window (and, using its ‘log’, that a similar message has not
recently been received),
• that the signature in M2 is a valid signature on the string TB||A.
If the checks are correct, then A accepts B as valid.
What could possibly happen if we leave B and A out of the message? Do we worry about reflection?
Probably not as the Signature already gives indication of direction of message. What could happen if we
only have M1 = TA||SigA(TA)? Well, we could take that message and send it to anyone not B (within
window of acceptance) and pretend to be A.
Example 4 (nonce & signature)
M1 = RB
M2 = RA||SigA(RA||RB||B)
A B
M3 = SigB(RB||RA||A)
It is based on the use of nonces (for freshness) and digital signature (for origin
and integrity checking). It provides mutual authentication (B can check A’s
identity and vice versa).
When B sends M1, B stores the nonce RB. When A sends M2, A stores the
nonces RA and RB. When B receives M2, B first assembles the string
RA||RB||B. B then checks one thing (using a copy of A’s public verification
key):
• that the signature in M2 is a valid signature on the string RA||RB||B.
If the check is correct, then B accepts A as valid and sends message M3.
When A receives M3, A assembles the string RB||RA||A and checks one thing:
• that the signature in M3 is a valid signature on the string RB||RA||A.
If the check is correct, then A accepts B as valid.
42
Example 5 (nonce & signature)
M1 = RB
M2 = RA||SigA(RA||RB||B)
A B
M3 = SigB(RA||RB||A)
Anyone care to guess why nonces are swopped? Senders nonce first, indicate
direction
RB and RA swop around protects the nonce and makes it harder to replay
(remember the it could be a counter or a logical timestamp…)
Lets say I record this transaction knowing that A’s counter or logical
timestamp is less than that of B?
Example 5 (nonce & signature)
Assume RB,RA are counters RB > RA
M1 = RB= RA
Replay M2 = RA||SigB(RBA||RAB||A)
A B
M3 = SigA(RA||RB||B)
You have to consider slide 43 and 44 together. If is makes more sense if you
think about ‘B’ here as M the attacker (you rename B->M (B is not actually
involved, someone is pretending to be B).
The problem is that in future A might want to authenticate B and end up using
RA equal to previous RB of the recorded execution. This is what is happening
on this slide.
44
Example 5 (nonce & signature)
with swopped nonces
Assume RB=10,RA = 5 are counters RB > RA
M1 = RB= 10
M2 = RA(5) ||SigA(5||10||B)
A B
M3 = SigB(10||5||A)
To start with – RA and RB are required to be nonces, but the design allows
either for:
Random numbers, which we consider infeasible to repeat across parties – or
at least not at a predictable time – it is possible that if I watch A for years that
she so happens to use same number but unlikely.
Counters, which should not repeat for any one party but it does mean that we
will cases where different parties do use the same value as the counter
increments.
For counters, we assume that RB will never again be 10, RA will never again
be 5, but RA could in future be 10.
Example 5 (nonce & signature)
without swopped nonces
Assume RB=10,RA = 5 are counters RB > RA
M1 = RB= 10
M2 = RA(5) ||SigA(5||10||B)
A B
M3 = SigB(5||10||A)
Later A so happens to use M1 that is equal to message M1 that
B used before. This allows M to pretend to be B.
M1 = RA= 10
Replay M2 = 5||SigB(5||10||A)
A M
M3 = SigA(5||10||B)
Now A reuses 10 for some reason as the original nonce in M_1. This means
M_3 from the protocol execution with unswopped nonces could be reused in
M2 here (with attacker M free to choose whatever here nonce is so can set to
5).
You would not be able to use the swopped nonce M_3. That said if we used
random numbers and A decides to use 5 again for some reason then the
nonces would not help.
Just for fun…
Is A authenticated to S? No
Is S authenticated to B? No
Is B authenticated to A? Not really, Message 4 (Nb encrypted with KAB), only B could
retrieve and use KAB from message 3 but we do not know what Nb is supposed to be.
It would have been better for message 3 to be Na,{Kab,A}Kbs and 4 to be {Na,Nb}Kab.
Then A and B would be mutually authenticated.
48
The end!
?
Any questions…
49
49