Message Authentication Network Systems Security Mort Anvari 9212004

  • Slides: 38
Download presentation
Message Authentication Network Systems Security Mort Anvari 9/21/2004

Message Authentication Network Systems Security Mort Anvari 9/21/2004

Message Authentication n Message authentication is concerned with n n protecting the integrity of

Message Authentication n Message authentication is concerned with n n protecting the integrity of a message validating identity of originator non-repudiation of origin (dispute resolution) Three alternative functions to provide message authentication n message encryption message authentication code (MAC) hash function 9/21/2004 2

Providing Authentication by Symmetric Encryption n n Receiver knows sender must have created it

Providing Authentication by Symmetric Encryption n n Receiver knows sender must have created it because only sender and receiver know secret key Can verify integrity of content if message has suitable structure, redundancy or a checksum to detect any modification 9/21/2004 3

Providing Authentication by Asymmetric Encryption n n Encryption provides no confidence of sender because

Providing Authentication by Asymmetric Encryption n n Encryption provides no confidence of sender because anyone potentially knows public key However if sender signs message using its private key and then encrypts with receiver’s public key, we have both confidentiality and authentication Again need to recognize corrupted messages But at cost of two public-key uses on message 9/21/2004 4

Providing Authentication by Asymmetric Encryption 9/21/2004 5

Providing Authentication by Asymmetric Encryption 9/21/2004 5

Message Authentication Code (MAC) n Generated by an algorithm that creates a small fixed-sized

Message Authentication Code (MAC) n Generated by an algorithm that creates a small fixed-sized block n n n depending on both message and some key like encryption though need not to be reversible Appended to message as a signature Receiver performs same computation on message and checks it matches the MAC Provide assurance that message is unaltered and comes from sender 9/21/2004 6

Uses of MAC 9/21/2004 7

Uses of MAC 9/21/2004 7

MAC Properties n Cryptographic checksum MAC = CK(M) n n condenses a variable-length message

MAC Properties n Cryptographic checksum MAC = CK(M) n n condenses a variable-length message M using a secret key K to a fixed-sized authenticator Many-to-one function n n potentially many messages have same MAC make sure finding collisions is very difficult 9/21/2004 8

Requirements for MACs n n Should take into account the types of attacks Need

Requirements for MACs n n Should take into account the types of attacks Need the MAC to satisfy the following: 1. 2. 3. knowing a message and MAC, it is infeasible to find another message with same MACs should be uniformly distributed MAC should depend equally on all bits of the message 9/21/2004 9

Using Symmetric Ciphers for MAC n n Can use any block cipher chaining mode

Using Symmetric Ciphers for MAC n n Can use any block cipher chaining mode and use final block as a MAC Data Authentication Algorithm (DAA) is a widely used MAC based on DES-CBC n n n using IV=0 and zero-pad of final block encrypt message using DES in CBC mode and send just the final block as the MAC n n or the leftmost M bits (16≤M≤ 64) of final block But final MAC is now too small for security 9/21/2004 10

Hash Functions n n n Condense arbitrary message to fixed size Usually assume that

Hash Functions n n n Condense arbitrary message to fixed size Usually assume that the hash function is public and not keyed Hash value used to detect changes to message Can use in various ways with message Most often to create a digital signature 9/21/2004 11

Uses of Hash Functions 9/21/2004 12

Uses of Hash Functions 9/21/2004 12

Uses of Hash Functions 9/21/2004 13

Uses of Hash Functions 9/21/2004 13

Hash Function Properties n Hash function produces a fingerprint of some file/message/data h =

Hash Function Properties n Hash function produces a fingerprint of some file/message/data h = H(M) n n n condenses a variable-length message M to a fixed-sized fingerprint Assumed to be public 9/21/2004 14

Requirements for Hash Functions 1. 2. 3. 4. 5. 6. can be applied to

Requirements for Hash Functions 1. 2. 3. 4. 5. 6. can be applied to any sized message M produce fixed-length output h easy to compute h=H(M) for any message M one-way property: given h is infeasible to find x s. t. H(x)=h weak collision resistance: given x is infeasible to find y s. t. H(y)=H(x) strong collision resistance: infeasible to find any x, y s. t. H(y)=H(x) 9/21/2004 15

Simple Hash Functions n n Several proposals for simple functions Based on XOR of

Simple Hash Functions n n Several proposals for simple functions Based on XOR of message blocks Not secure since can manipulate any message and either not change hash or change hash also Need a stronger cryptographic function 9/21/2004 16

Block Ciphers as Hash Functions n Can use block ciphers as hash functions n

Block Ciphers as Hash Functions n Can use block ciphers as hash functions n n n Resulting hash is too small (64 -bit) n n n use H 0=0 and zero-pad of final block compute Hi = EMi [Hi-1] use final block as the hash value similar to CBC but without a key both due to direct birthday attack and to “meet-in-the-middle” attack Other variants also susceptible to attack 9/21/2004 17

Birthday Attacks n n n Might think a 64 -bit hash is secure However

Birthday Attacks n n n Might think a 64 -bit hash is secure However by Birthday Paradox is not Birthday attack works as follows n n m adversary generates 2 /2 variations of a valid message all with essentially the same meaning m adversary also generates 2 /2 variations of a desired fraudulent message two sets of messages are compared to find pair with same hash (probability > 0. 5 by birthday paradox) have user sign the valid message, then substitute the forgery which will have a valid signature 9/21/2004 18

MD 5 n n Designed by Ronald Rivest (the R in RSA) Latest in

MD 5 n n Designed by Ronald Rivest (the R in RSA) Latest in a series of MD 2, MD 4 Produce a hash value of 128 bits (16 bytes) Until recently was the most widely used hash algorithm n n in recent times have both brute-force and cryptanalytic concerns Specified as Internet standard RFC 1321 9/21/2004 19

MD 5 Overview pad message so its length is 448 mod 512 append a

MD 5 Overview pad message so its length is 448 mod 512 append a 64 -bit length value to message initialize 4 -word (128 -bit) MD buffer (A, B, C, D) process message in 16 -word (512 -bit) blocks: 1. 2. 3. 4. use 4 rounds of 16 bit operations on message block & buffer add output to buffer input to form new buffer value n n 5. output hash value is the final buffer value 9/21/2004 20

MD 5 Processing 9/21/2004 21

MD 5 Processing 9/21/2004 21

MD 5 Processing of 512 -bit Block 9/21/2004 22

MD 5 Processing of 512 -bit Block 9/21/2004 22

MD 5 Compression Function n Each round has 16 steps of the form: a

MD 5 Compression Function n Each round has 16 steps of the form: a <- b+((a+g(b, c, d)+X[k]+T[i])<<<s) n a, b, c, d refer to the 4 words of the buffer, but used in varying permutations n n note each step updates only 1 word of the buffer after 16 steps each word is updated 4 times g(b, c, d) is a different nonlinear function in each round (F, G, H, I) T[i] is a constant value derived from sine 9/21/2004 23

MD 5 Compression Function 9/21/2004 24

MD 5 Compression Function 9/21/2004 24

Security of MD 5 n n n MD 5 hash is dependent on all

Security of MD 5 n n n MD 5 hash is dependent on all message bits Rivest claims security is good as can be However known attacks include n n n Berson in 1992 attacked any 1 round using differential cryptanalysis (but can’t extend) Boer & Bosselaers in 1993 found a pseudo collision (again unable to extend) Dobbertin in 1996 created collisions on MD compression function (but initial constants prevent exploit) Wang et al announced cracking MD 5 on Aug 17, 2004 (paper available on Useful Links) Thus MD 5 looks vulnerable soon 9/21/2004 25

Secure Hash Algorithm (SHA-1) n n Designed by NIST & NSA in 1993, revised

Secure Hash Algorithm (SHA-1) n n Designed by NIST & NSA in 1993, revised 1995 as SHA-1 US standard for use with DSA signature scheme n n standard is FIPS 180 -1 1995, also Internet RFC 3174 Produce hash values of 160 bits (20 bytes) Now the generally preferred hash algorithm Based on design of MD 4 with key differences 9/21/2004 26

SHA-1 Overview pad message so its length is 448 mod 512 append a 64

SHA-1 Overview pad message so its length is 448 mod 512 append a 64 -bit length value to message initialize 5 -word (160 -bit) buffer (A, B, C, D, E) to 1. 2. 3. (67452301, efcdab 89, 98 badcfe, 10325476, c 3 d 2 e 1 f 0) process message in 16 -word (512 -bit) chunks: 4. expand 16 words into 80 words by mixing & shifting use 4 rounds of 20 bit operations on message block & buffer add output to input to form new buffer value n n n 5. output hash value is the final buffer value 9/21/2004 27

SHA-1 Compression Function n Each round has 20 steps which replaces the 5 buffer

SHA-1 Compression Function n Each round has 20 steps which replaces the 5 buffer words thus: (A, B, C, D, E) <(E+f(t, B, C, D)+(A<<5)+Wt+Kt), A, (B<<30), C, D) n n n a, b, c, d refer to the 4 words of the buffer t is the step number f(t, B, C, D) is nonlinear function for round Wt is derived from the message block Kt is a constant value derived from sine 9/21/2004 28

SHA-1 Compression Function 9/21/2004 29

SHA-1 Compression Function 9/21/2004 29

SHA-1 vs MD 5 n n n Brute force attack is harder (160 vs

SHA-1 vs MD 5 n n n Brute force attack is harder (160 vs 128 bits for MD 5) Not vulnerable to any known attacks (compared to MD 4 and MD 5) A little slower than MD 5 (80 vs 64 steps) Both designed as simple and compact Optimised for big-endian CPU’s (vs MD 5 which is optimised for little-endian CPU’s) 9/21/2004 30

Revised Secure Hash Standard n n n NIST issued a revision FIPS 180 -2

Revised Secure Hash Standard n n n NIST issued a revision FIPS 180 -2 in 2002 Add 3 additional hash algorithms (SHA-256, SHA-384, SHA-512) Designed for compatibility with increased security provided by the AES cipher Structure and detail is similar to SHA-1 Hence analysis should be similar 9/21/2004 31

Security of Hash Functions and MAC n Brute-force attacks n strong collision resistance hash

Security of Hash Functions and MAC n Brute-force attacks n strong collision resistance hash have cost m/ 2 2 n n n have proposal for hardware MD 5 cracker 128 -bit hash looks vulnerable, 160 -bit better MACs with known message-MAC pairs n n 9/21/2004 can either attack keyspace or MAC at least 128 -bit MAC is needed for security 32

Security of Hash Functions and MAC n Cryptanalytic attacks exploit structure n n like

Security of Hash Functions and MAC n Cryptanalytic attacks exploit structure n n like block ciphers want brute-force attacks to be the best alternative Have a number of analytic attacks on iterated hash functions n n CVi = f[CVi-1, Mi]; H(M)=CVN typically focus on collisions in function f like block ciphers is often composed of rounds attacks exploit properties of round functions 9/21/2004 33

Keyed Hash Functions as MACs n Desirable to create a MAC using a hash

Keyed Hash Functions as MACs n Desirable to create a MAC using a hash function rather than a block cipher n n hash functions are generally faster not limited by export controls unlike block ciphers Hash includes a key along with the message Original proposal: Keyed. Hash = Hash(Key|Message) n some weaknesses were found with this proposal n Eventually led to development of HMAC 9/21/2004 34

HMAC n n Specified as Internet standard RFC 2104 Use hash function on the

HMAC n n Specified as Internet standard RFC 2104 Use hash function on the message: HMACK = Hash[(K+ XOR opad) || Hash[(K+ XOR ipad)||M)]] + n K is the key padded out to size n opad, ipad are specified padding constants n n Overhead is just 3 more hash calculations than the message alone needs Any of MD 5, SHA-1, RIPEMD-160 can be used 9/21/2004 35

HMAC Structure 9/21/2004 36

HMAC Structure 9/21/2004 36

Security of HMAC n n Security of HMAC relates to that of the underlying

Security of HMAC n n Security of HMAC relates to that of the underlying hash algorithm Attacking HMAC requires either: n n n brute force attack on key used birthday attack (but since keyed would need to observe a very large number of messages) Choose hash function used based on speed verses security constraints 9/21/2004 37

Next Class n n n Replay attacks Timestamps and nonces Anti-replay protocols 9/21/2004 38

Next Class n n n Replay attacks Timestamps and nonces Anti-replay protocols 9/21/2004 38