Foundations of Network and Computer Security

Similar documents
Foundations of Network and Computer Security

Foundations of Network and Computer Security

MESSAGE AUTHENTICATION CODES and PRF DOMAIN EXTENSION. Mihir Bellare UCSD 1

Introduction to Information Security

Week 12: Hash Functions and MAC

ENEE 457: Computer Systems Security 09/19/16. Lecture 6 Message Authentication Codes and Hash Functions

Introduction to Cryptography Lecture 4

Leftovers from Lecture 3

Online Cryptography Course. Collision resistance. Introduc3on. Dan Boneh

ENEE 459-C Computer Security. Message authentication (continue from previous lecture)

Introduction to Cryptography k. Lecture 5. Benny Pinkas k. Requirements. Data Integrity, Message Authentication

CPSC 467: Cryptography and Computer Security

ECS 189A Final Cryptography Spring 2011

Foundations of Network and Computer Security

Notes for Lecture 9. 1 Combining Encryption and Authentication

Hash Functions. Ali El Kaafarani. Mathematical Institute Oxford University. 1 of 34

CPSC 467: Cryptography and Computer Security

Further progress in hashing cryptanalysis

COS433/Math 473: Cryptography. Mark Zhandry Princeton University Spring 2017

Message Authentication Codes (MACs)

CPSC 467: Cryptography and Computer Security

Message Authentication. Adam O Neill Based on

Beyond the MD5 Collisions

MESSAGE AUTHENTICATION 1/ 103

Introduction to Cryptography

Lecture 10 - MAC s continued, hash & MAC

Distinguishing Attacks on MAC/HMAC Based on A New Dedicated Compression Function Framework

Cryptanalysis on HMAC/NMAC-MD5 and MD5-MAC

Lecture 14: Cryptographic Hash Functions

Understanding Cryptography A Textbook for Students and Practitioners by Christof Paar and Jan Pelzl. Chapter 11 Hash Functions ver.

Online Cryptography Course. Message integrity. Message Auth. Codes. Dan Boneh

Full Key-Recovery Attacks on HMAC/NMAC-MD4 and NMAC-MD5

Some Attacks on Merkle-Damgård Hashes

Cryptographic Hash Functions

Hashes and Message Digests Alex X. Liu & Haipeng Dai

Avoiding collisions Cryptographic hash functions. Table of contents

Lecture 1. Crypto Background

Lecture 10: NMAC, HMAC and Number Theory

Attacks on hash functions: Cat 5 storm or a drizzle?

Hash Functions. A hash function h takes as input a message of arbitrary length and produces as output a message digest of fixed length.

Intro to Public Key Cryptography Diffie & Hellman Key Exchange

Full Key-Recovery Attacks on HMAC/NMAC-MD4 and NMAC-MD5

General Distinguishing Attacks on NMAC and HMAC with Birthday Attack Complexity

Crypto Engineering (GBX9SY03) Hash functions

Cryptanalysis of a Message Authentication Code due to Cary and Venkatesan

1 Cryptographic hash functions

Message Authentication Codes (MACs) and Hashes

New Proofs for NMAC and HMAC: Security without Collision-Resistance

1 Cryptographic hash functions

CPSC 467: Cryptography and Computer Security

Cryptographic Hash Functions Part II

Full Key-Recovery Attacks on HMAC/NMAC-MD4 and NMAC-MD5

SIGNATURE SCHEMES & CRYPTOGRAPHIC HASH FUNCTIONS. CIS 400/628 Spring 2005 Introduction to Cryptography

Security without Collision-Resistance

Provable-Security Approach begins with [GM82] Classical Approach. Practical Cryptography: Provable Security as a Tool for Protocol Design

12 Hash Functions Defining Security

Breaking Symmetric Cryptosystems Using Quantum Algorithms

Attacks on hash functions. Birthday attacks and Multicollisions

Forgery and Partial Key-Recovery Attacks on HMAC and NMAC Using Hash Collisions

Cryptographic Hashes. Yan Huang. Credits: David Evans, CS588

New Proofs for NMAC and HMAC: Security without Collision-Resistance

Solution of Exercise Sheet 7

CBC MAC for Real-Time Data Sources. Abstract. The Cipher Block Chaining (CBC) Message Authentication Code (MAC) is an

An introduction to Hash functions

Post-Quantum Cryptography & Privacy. Andreas Hülsing

STRIBOB : Authenticated Encryption

The Security of Abreast-DM in the Ideal Cipher Model

2: Iterated Cryptographic Hash Functions

Symmetric Ciphers. Mahalingam Ramkumar (Sections 3.2, 3.3, 3.7 and 6.5)

Lecture 10: NMAC, HMAC and Number Theory

Introduction Description of MD5. Message Modification Generate Messages Summary

On High-Rate Cryptographic Compression Functions

Digital Signatures. Adam O Neill based on

Notes for Lecture A can repeat step 3 as many times as it wishes. We will charge A one unit of time for every time it repeats step 3.

Lecture 1: Introduction to Public key cryptography

Winter 2008 Introduction to Modern Cryptography Benny Chor and Rani Hod. Assignment #2

New Attacks on the Concatenation and XOR Hash Combiners

Lecture 10: HMAC and Number Theory

Cryptographical Security in the Quantum Random Oracle Model

Public-key Cryptography: Theory and Practice

REU 2015: Complexity Across Disciplines. Introduction to Cryptography

HASH FUNCTIONS 1 /62

Introduction to Modern Cryptography Lecture 5

Problem 1. k zero bits. n bits. Block Cipher. Block Cipher. Block Cipher. Block Cipher. removed

New Attacks against Standardized MACs

Lecture 18: Message Authentication Codes & Digital Signa

SMASH - A Cryptographic Hash Function

Cryptography CS 555. Topic 13: HMACs and Generic Attacks

Information Security

Limits on the Efficiency of One-Way Permutation-Based Hash Functions

Avoiding collisions Cryptographic hash functions. Table of contents

A Composition Theorem for Universal One-Way Hash Functions

Second Preimages for Iterated Hash Functions and their Implications on MACs

Exam Security January 19, :30 11:30

Breaking H 2 -MAC Using Birthday Paradox

H Definition - hash function. Cryptographic Hash Functions - Introduction. Cryptographic hash functions. Lars R. Knudsen.

Introduction to Cybersecurity Cryptography (Part 4)

Weaknesses in the HAS-V Compression Function

b = 10 a, is the logarithm of b to the base 10. Changing the base to e we obtain natural logarithms, so a = ln b means that b = e a.

SYMMETRIC ENCRYPTION. Mihir Bellare UCSD 1

Transcription:

Foundations of Network and Computer Security John Black Lecture #5 Sep 7 th 2004 CSCI 6268/TLEN 5831, Fall 2004

Announcements Please sign up for class mailing list by end of today Quiz #1 will be on Thursday, Day after tomorrow

Building a MAC with a Blockcipher Let s use AES to build a MAC A common method is the CBC MAC: CBC MAC is stateless (no nonce N is used) Proven security in the ACMA model provided messages are all of once fixed length Resistance to forgery quadratic in the aggregate length of adversarial queries plus any insecurity of AES Widely used: ANSI X9.19, FIPS 113, ISO 9797-1 M 1 M 2 M m AES K AES K AES K tag

Breaking CBC MAC If we allow msg lengths to vary, the MAC breaks To forge we need to do some (reasonable) number of queries, then submit a new message and a valid tag Ask M 1 = 0 n We re done! we get t = AES K (0 n ) back We announce that M * = 0 n t has tag t as well (Note that A B denotes the concatenation of strings A and B)

CBC MAC Attack (notes) Attack was unfair We used varying lengths which is not allowed for CBC MAC Well, we were just demonstrating that the fixed-length condition is necessary! And we were giving an example of the ACMA model Attack was adaptive We used the output, t, from our first query as a message block in our forgery! Forged message wasn t really meaningful Doesn t matter, a forgery is a forgery

Varying Message Lengths: XCBC There are several well-known ways to overcome the fixed-length limitation of CBC MAC XCBC, is the most efficient one known, and is provablysecure (when the underlying block cipher is computationally indistinguishable from random) Uses blockcipher key K1 and needs two additional n-bit keys K2 and K3 which are XORed in just before the last encipherment A proposed NIST standard (as CMAC ) M 1 M 2 M m K2 if n divides M K3 otherwise AES K1 AES K1 AES K1 tag

UMAC: MACing Faster In many contexts, cryptography needs to be as fast as possible High-end routers process > 1Gbps High-end web servers process > 1000 requests/sec But AES (a very fast block cipher) is already more than 15 cycles-per-byte on a PPro Block ciphers are relatively expensive; it s possible to build faster MACs UMAC is roughly ten times as fast as current practice

UMAC follows the Wegman-Carter Paradigm Since AES is (relatively) slow, let s avoid using it unless we have to Wegman-Carter MACs provide a way to process M first with a non-cryptographic hash function to reduce its size, and then encrypt the result Message M hash key hash function hash(m) encryption key encrypt tag

The Ubiquitous HMAC The most widely-used MAC (IPSec, SSL, many VPNs) Doesn t use a blockcipher or any universal hash family Instead uses something called a collision resistant hash function H Sometimes called cryptographic hash functions Keyless object more in a moment HMAC K (M) = H(K opad H(K ipad M)) opad is 0x36 repeated as needed ipad is 0x5C repeated as needed

Notes on HMAC Fast Faster than CBC MAC or XCBC Slow Because these crypto hash functions are fast Slower than UMAC and other universal-hash-family MACs Proven security But these crypto hash functions have recently been attacked and may show further weaknesses soon

What are cryptographic hash functions? A cryptographic hash function takes a message from {0,1} * and produces a fixed size output Output is called hash or digest or fingerprint There is no key The most well-known are MD5 and SHA-1 but there are other options MD5 outputs 128 bits SHA-1 outputs 160 bits Message % md5 Hello There ^D A82fadb196cba39eb884736dcca303a6 % Output Hash Function e.g., MD5,SHA-1

512 bits SHA-1... M 1 M 2 M m for i = 1 to m do W t = { t-th word of M i 0 t 15 ( W t-3 W t-8 W t-14 W t-16 ) << 1 16 t 79 A H 0 ; B H 1 ; C H 2 ; D H 3 ; E H 4 for t = 1 to 80 do T A << 5 + g t (B, C, D) + E + K t + W t E D; D C; C B >> 2; B A; A T end H 0i A + H 0 ; H 1i B + H 1 ; H 2i C+ H 2 ; H 3i D + H 3 ; H 4i E + H 4 end return H 0m H 1m H 2m H 3m H 4 m 160 bits

Real-world applications Hash functions are pervasive Message authentication codes (HMAC) Digital signatures (hash-and-sign) File comparison (compare-by-hash, eg, RSYNC) Micropayment schemes Commitment protocols Timestamping Key exchange...

A cryptographic property (quite informal) 1. Collision resistance given a hash function it is hard to find two colliding inputs M H BAD: H(M) = M mod 701 M H {0,1} n Strings

More cryptographic properties 1. Collision resistance given a hash function it is hard to find two colliding inputs 2. Second-preimage given a hash function and resistance given a first input, it is hard to find a second input that collides with the first 3. Preimage resistance given a hash function and given an hash output it is hard to invert that output

Merkle-Damgard construction Compression function M 1 M 2 M 3 IV n k f h 1 f h 2 f h 3 = H (M) k Fixed initial value Chaining value MD Theorem: if f is CR, then so is H

M 1 M 2 M m M i 512 bits... for i = 1 to m do W t = { t-th word of M i 0 t 15 ( W t-3 W t-8 W t-14 W t-16 ) << 1 16 t 79 A H 0 ; B H 1 ; C H 2 ; D H 3 ; E H 4 for t = 1 to 80 do 160 bits H 0..4 end T A << 5 + g t (B, C, D) + E + K t + W t E D; D C; C B >> 2; B A; A T H 0i A + H 0 ; H 1i B + H 1 ; H 2i C+ H 2 ; H 3i D + H 3 ; H 4i E + H 4 end return H 0m H 1m H 2m H 3m H 4 m 160 bits 160 bits

Hash Function Security Consider best-case scenario (random outputs) If a hash function output only 1 bit, how long would we expect to avoid collisions? Expectation: 1 0 + 2 ½ + 3 ½ = 2.5 What about 2 bits? Expectation: 1 0 + 2 ¼ + 3 ¾ ½ + 4 ¾ ½ ¾ + 5 ¾ ½ ¼ 3.22 This is too hard

Birthday Paradox Need another method Birthday paradox: if we have 23 people in a room, the probability is > 50% that two will share the same birthday Assumes uniformity of birthdays Untrue, but this only increases chance of birthday match Ignores leap years (probably doesn t matter much) Try an experiment with the class

Birthday Paradox (cont) Let s do the math Let n equal number of people in the class Start with n = 1 and count upward Let NBM be the event that there are No-Birthday-Matches For n=1, Pr[NBM] = 1 For n=2, Pr[NBM] = 1 364/365.997 For n=3, Pr[NBM] = 1 364/365 363/365.991 For n=22, Pr[NBM] = 1 344/365.524 For n=23, Pr[NBM] = 1 343/365.493 Since the probability of a match is 1 Pr[NBM] we see that n=23 is the smallest number where the probability exceeds 50%

Occupancy Problems What does this have to do with hashing? Suppose each hash output is uniform and random on {0,1} n Then it s as if we re throwing a ball into one of 2 n bins at random and asking when a bin contains at least 2 balls This is a well-studied area in probability theory called occupancy problems It s well-known that the probability of a collision occurs around the square-root of the number of bins If we have 2 n bins, the square-root is 2 n/2

Birthday Bounds This means that even a perfect n-bit hash function will start to exhibit collisions when the number of inputs nears 2 n/2 This is known as the birthday bound It s impossible to do better, but quite easy to do worse It is therefore hoped that it takes Ω(2 64 ) work to find collisions in MD5 and Ω(2 80 ) work to find collisions in SHA-1

The Birthday Bound 1.0 Probability 0.5 0.0 2 n/2 2 n Number of Hash Inputs

Latest News At CRYPTO 2004 (August) Collisions found in HAVAL, RIPEMD, MD4, MD5, and SHA-0 (2 40 operations) Wang, Feng, Lai, Yu Only Lai is well-known HAVAL was known to be bad Dobbertin found collisions in MD4 years ago MD5 news is big! SHA-0 isn t used anymore (but see next slide)

Collisions in SHA-0 M 1, M 1 not in SHA-0 W t = { t-th word of M i 0 t 15 ( W t-3 W t-8 W t-14 W t-16 ) << 1 16 t 79 A H 0 ; B H 1 ; C H 2 ; D H 3 ; E H 4 65 for t = 1 to 80 do H 0..4 end T A << 5 + g t (B, C, D) + E + K t + W t E D; D C; C B >> 2; B A; A T H 0i Α + H 0 ; H 1i A + H 1 ; H 2i C+ H 2 ; H 3i D + H 3 ; H 4i E + H 4 Collision!

What Does this Mean? Who knows Methods are not yet understood Will undoubtedly be extended to more attacks Maybe nothing much more will happen But maybe everything will come tumbling down?! But we have OTHER ways to build hash functions

A Provably-Secure Blockcipher-Based Compression Function M i n bits h n bits E h i n bits

The Big (Partial) Picture Second-Level Protocols (Can do proofs) SSH, SSL/TLS, IPSec Electronic Cash, Electronic Voting First-Level Protocols (Can do proofs) Symmetric Encryption MAC Schemes Asymmetric Encryption Digital Signatures Primitives Block Ciphers Stream Ciphers Hash Functions Hard Problems (No one knows how to prove security; make assumptions)