MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security...

18
MAC: Message Authentication Code Last Updated: Oct16, 2017

Transcript of MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security...

Page 1: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

MAC: Message Authentication Code

Last Updated: Oct16, 2017

Page 2: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Assume CTR or CBC mode

• Authentication?

• Confidentiality?

• Integrity?

• Non-repudiation?

What Assurrances are Provided by Symmetric Encryption?

Page 3: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Bit Flipping Attacks (Block Cipher)

Page 4: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

• Plaintext: ACCT_NO:123-45-6789 ADD:100• Ciphertext:

Bit Flipping Attacks (Stream Cipher)

15b1206b7efa68b9 89 c87357507e3a27a138ca dc b2a1bb f8 eebee5

Page 5: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

• Assure that the message has not been altered

• Assure the source of the message is authentic

Goals of Message Authentication

Page 6: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

• Authentication of encrypted messageso Include an error-detection code in plaintext messageo Attach a key-based error-detection code to an encrypted messageo Attach a TAG – remember the newer AEAD modes

• Authentication of plaintext messageso Authentication without confidentialityo Attach a key-based error-detection code to plaintext message

Message Authentication:Ciphertext vs. Plaintext

Page 7: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Message Authentication Code (MAC)

Page 8: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Message Authentication Code (MAC)

Source: Network Security Essentials (Stallings)

Page 9: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

MAC Creation with Block Cipher

Page 10: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

1.CBC-MACo Use CBC mode and a block ciphero Expensive

2.Hash the message and encrypt the digest

Three Ways to Implement a MAC

Source: Network Security Essentials (Stallings)

Page 11: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

1.CBC-MAC2.Hash the message and encrypt the digest3.Hash the message along with a shared key

o MAC generated using hashing is known as an HMAC

Three Ways to Implement a MAC

Source: Network Security Essentials (Stallings)

Page 12: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

• Cryptographers recommend against this kind of HMAC using modern hash functions

• Vulnerable to a message extension attack• An example of an implementation weaknesses in the

algorithm

Design Flaw!

Page 13: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Iterative Hash Function• Popular hash functions (MD5, SHA1, SHA2) use an

iterative implementation technique known as the Merkle-Damgård construction

• SHA-3 uses a sponge construction

Page 14: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Length field is 64 bits

MAC attack regions of interest

Page 15: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Alice and Bob• Alice and Bob share a key K

• Alice sends message M1 to Bob such that Bob knows it came from Aliceo Alice computes H(K || M1) = mac1o Alice sends M1 and mac1 to Bob

• Bob verifies the messageo Bob computes H(K || M1) = mac2 and compares it to mac1.

If they match, the message came from Alice.o Or did it????

Page 16: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

Message Extension Attack• Mallory can intercept a plaintext message and a mac.• Mallory “extends” the message – adds new material to the

end of the message• She modifies the mac without knowing the key. She needs to

know some properties of the key.• She replaces the message and mac with the extended

message and new mac and forwards it along • Bob receives the modified message and mac, and it passes

his verification step. He believes is came from Alice!• See Project 3 writeup, resources on that page along with the

lectures page.

Page 17: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

HMAC• Because of the message extension attack vulnerability,

the government standard HMAC algorithm guards against this threato FIPS 198o RFC 2104

Page 18: MAC: Message Authentication CodeMessage Authentication Code (MAC) Source: Network Security Essentials (Stallings) MAC Creation with Block Cipher. 1.CBC-MAC o Use CBC mode and a block

HMAC• H(K || H(K || M))