Computer Security CS 526 Topic 4

Slides:



Advertisements
Similar presentations
Cryptographic Hash Functions Rocky K. C. Chang, February
Advertisements

Digital Signatures and Hash Functions. Digital Signatures.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
CMSC 414 Computer and Network Security Lecture 5 Jonathan Katz.
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Hash Functions Nathanael Paul Oct. 9, Hash Functions: Introduction Cryptographic hash functions –Input – any length –Output – fixed length –H(x)
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
Cryptography and Network Security Chapter 11 Fourth Edition by William Stallings Lecture slides by Lawrie Brown/Mod. & S. Kondakci.
CS526Topic 5: Hash Functions and Message Authentication 1 Computer Security CS 526 Topic 5 Cryptography: Cryptographic Hash Functions And Message Authentication.
Cryptography1 CPSC 3730 Cryptography Chapter 11, 12 Message Authentication and Hash Functions.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 15 Lecture’s outline Public algorithms (usually) that are each other’s inverse.
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
Hash Functions A hash function H accepts a variable-length block of data M as input and produces a fixed-size hash value h = H(M) Principal object is.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
EE515/IS523 Think Like an Adversary Lecture 4 Crypto in a Nutshell Yongdae Kim.
Message Authentication Code July Message Authentication Problem  Message Authentication is concerned with:  protecting the integrity of a message.
Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2015 Nitesh Saxena.
CSCI 172/283 Fall 2010 Hash Functions, HMACs, and Digital Signatures.
CS426Fall 2010/Lecture 61 Computer Security CS 426 Lecture 6 Cryptography: Message Authentication Code.
Cryptographic Hash Functions and Protocol Analysis
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Modern Cryptography.
Hash Functions Ramki Thurimella. 2 What is a hash function? Also known as message digest or fingerprint Compression: A function that maps arbitrarily.
Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2014 Nitesh Saxena.
CS426Fall 2010/Lecture 51 Computer Security CS 426 Lecture 5 Cryptography: Cryptographic Hash Function.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
CS555Spring 2012/Topic 151 Cryptography CS 555 Topic 15: HMAC, Combining Encryption & Authentication.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Data Integrity / Data Authentication. Definition Authentication (Signature) algorithm - A Verification algorithm - V Authentication key – k Verification.
CS555Spring 2012/Topic 141 Cryptography CS 555 Topic 14: CBC-MAC & Hash Functions.
Cryptographic Hash Function. A hash function H accepts a variable-length block of data as input and produces a fixed-size hash value h = H(M). The principal.
@Yuan Xue 285: Network Security CS 285 Network Security Hash Algorithm Yuan Xue Fall 2012.
Chapter 12 – Hash Algorithms
Message Integrity and Message Authentication
CSE 4095 Digital Signatures and Hashing
Computer Security CS 526 Topic 4
Cryptographic Hash Functions
Cryptographic Hash Function
Public Key Encryption and Digital Signatures
Cryptographic Hash Functions
Topic 14: Random Oracle Model, Hashing Applications
Cryptographic Hash Functions Part I
Cryptography Lecture 13.
Cryptographic Hash Functions
ICS 454 Principles of Cryptography
Cryptographic Hash Functions
Cryptography Lecture 10.
Security through Encryption
Introduction to Symmetric-key and Public-key Cryptography
Cryptography: Basics (2)
Data Integrity: Applications of Cryptographic Hash Functions
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
ICS 454 Principles of Cryptography
Chapter -7 CRYPTOGRAPHIC HASH FUNCTIONS
Topic 13: Message Authentication Code
Lecture 4.1: Hash Functions, and Message Authentication Codes
Computer Security CS 526 Topic 5
Cryptography Lecture 14.
Cryptography Lecture 13.
Cryptography Lecture 9.
Cryptography Lecture 13.
Cryptography Lecture 15.
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Lecture 4: Hash Functions
Hash Function Requirements
CRYPTOGRAPHY & NETWORK SECURITY
Blockchains Lecture 4.
Presentation transcript:

Computer Security CS 526 Topic 4 Cryptography: Cryptographic Hash Functions And Message Authentication Code CS526 Topic 4: Hash Functions and Message Authentication

Readings for This Lecture Wikipedia Cryptographic Hash Functions Message Authentication Code CS526 Topic 4: Hash Functions and Message Authentication

Data Integrity and Source Authentication Encryption does not protect data from modification by another party. Most encryption schemes are malleable: Modifying ciphertext result in (somewhat) predictable change in plaintext Need a way to ensure that data arrives at destination in its original form as sent by the sender. Modified ciphertext can often still be decrypted into plaintexts. CS526 Topic 4: Hash Functions and Message Authentication

Topic 4: Hash Functions and Message Authentication A hash function maps a message of an arbitrary length to a m-bit output output known as the fingerprint or the message digest What is an example of hash functions? Give a hash function that maps Strings to integers in [0,2^{32}-1] Cryptographic hash functions are hash functions with additional security requirements Example hash function: v:=1; for each character c, v=v*(c+1)+2 mod 2^{32}; CS526 Topic 4: Hash Functions and Message Authentication

Using Hash Functions for Message Integrity Method 1: Uses a Hash Function h, assuming an authentic (adversary cannot modify) channel for short messages Transmit a message M over the normal (insecure) channel Transmit the message digest h(M) over the authentic channel When receiver receives both M’ and h, how does the receiver check to make sure the message has not been modified? This is insecure. How to attack it? A hash function is a many-to-one function, so collisions can happen. An authenticated channel for short messages bootstraps authenticity. A short secret key in encryption boostraps confidentiality. CS526 Topic 4: Hash Functions and Message Authentication

Security Requirements for Cryptographic Hash Functions Given a function h:X Y, then we say that h is: preimage resistant (one-way): if given y Y it is computationally infeasible to find a value x X s.t. h(x) = y 2-nd preimage resistant (weak collision resistant): if given x  X it is computationally infeasible to find a value x’  X, s.t. x’x and h(x’) = h(x) collision resistant (strong collision resistant): if it is computationally infeasible to find two distinct values x’,x  X, s.t. h(x’) = h(x) CS526 Topic 4: Hash Functions and Message Authentication

Usage of Hash Functions? Suppose that you have outsourced a database, and want to find a record; how to ensure that a result you get back is really in the database? CS526 Topic 4: Hash Functions and Message Authentication

Merkle Hash Tree for Data Authentication Construct a binary tree where each leaf corresponds to a piece of data Each internal node is hash of two children Authentication the root using some method A leaf node along with the sibling node of each node to the path suffices to authenticate the node Needs log(n) to authenticate any node CS526 Topic 4: Hash Functions and Message Authentication

Merkle Hash Tree for Data Authentication "MerkleTree2" by Tsuruya - Own work. Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:MerkleTree2.svg#/media/File:MerkleTree2.svg CS526 Topic 4: Hash Functions and Message Authentication

Usages of Cryptographic Hash Functions Software integrity E.g., tripwire Timestamping (cryptographic commitment) How to prove that you have discovered a secret on an earlier date without disclosing the context of a secret? Authenticating logs (a long history of events) Covered later Message authentication One-time passwords Digital signature CS526 Topic 4: Hash Functions and Message Authentication

Bruteforce Attacks on Hash Functions Attacking one-wayness Goal: given h:XY, yY, find x such that h(x)=y Algorithm: pick a random value x in X, check if h(x)=y, if h(x)=y, returns x; otherwise iterate after failing q iterations, return fail The average-case success probability is The first approximation holds when |Y| is large, The second roughly holds when q/|Y| is small (e.g., < 0.5) Let |Y|=2m, to get  to be close to 0.5, q 2m-1 CS526 Topic 4: Hash Functions and Message Authentication

Bruteforce Attacks on Hash Functions Attacking collision resistance Goal: given h, find x, x’ such that h(x)=h(x’) Algorithm: pick a random set X0 of q values in X for each xX0, computes yx=h(x) if yx=yx’ for some x’x then return (x,x’) else fail The average success probability is Let |Y|=2m, to get  to be close to 0.5, q 2m/2 This is known as the birthday attack. Assuming |Y|=N. With q choices, the Prob that there is no collision is P = (N-1)/N * (N-2)/N * … * (N-q+1)/N = [i=1 to q-1] (1 – i/N) 1-i/N  e^{-i/N} P  e^{-  [i=1 to q-1] i/N} = e^{-q(q-1) / 2N } CS526 Topic 4: Hash Functions and Message Authentication

Topic 4: Hash Functions and Message Authentication Choosing Parameters The level of security (for collision resistance) of a hash function that outputs n bits, is about n/2 bits i.e., it takes 2n/2 time to bruteforce it Assuming that no better way of attacking the hash function is known Longer outputs often means more computation time and more communication overhead The level of security for encryption function using k-bit key is about k bits CS526 Topic 4: Hash Functions and Message Authentication

Choosing the length of Hash outputs The Weakest Link Principle: A system is only as secure as its weakest link. Hence all links in a system should have similar levels of security. Because of the birthday attack, the length of hash outputs in general should double the key length of block ciphers SHA-224 matches the 112-bit strength of triple-DES (encryption 3 times using DES) SHA-256, SHA-384, SHA-512 match the new key lengths (128,192,256) in AES If small output size is highly important, and one is sure that collision-resistance is not needed (only one-wayness is needed), then same size should be okay. Which hash function to use? CS526 Topic 4: Hash Functions and Message Authentication

Well Known Hash Functions MD5 output 128 bits collision resistance completely broken by researchers in China in 2004 (Prof. Xiaoyun Wang) SHA1 output 160 bits considered insecure for collision resistance one-wayness still holds On February 23, 2017 CWI Amsterdam and Google announced they had performed a collision attack against SHA-1, publishing two dissimilar PDF files which produce the same SHA-1 hash as proof of concept

Well Known Hash Functions SHA2 (SHA-224, SHA-256, SHA-384, SHA-512) outputs 224, 256, 384, and 512 bits, respectively No real security concerns yet SHA3 (224, 256, 384, 512) CS526

Merkle-Damgard Construction for Hash Functions (1979) Message is divided into fixed-size blocks and padded Uses a compression function f, which takes a chaining variable (of size of hash output) and a message block, and outputs the next chaining variable Final chaining variable is the hash value M=m1m2…mn; C0=IV, Ci+1=f(Ci,mi); H(M)=Cn CS526 Topic 4: Hash Functions and Message Authentication

Topic 4: Hash Functions and Message Authentication NIST SHA-3 Competition NIST completed a competition for SHA-3, the next generation of standard hash algorithms 2007: Request for submissions of new hash functions 2008: Submissions deadline. Received 64 entries. Announced first-round selections of 51 candidates. 2009: After First SHA-3 candidate conference in Feb, announced 14 Second Round Candidates in July. 2010: After one year public review of the algorithms, hold second SHA-3 candidate conference in Aug. Announced 5 Third-round candidates in Dec. 2011: Public comment for final round 2012: October 2, NIST selected SHA3 Keccak (pronounced “catch-ack”) created by Guido Bertoni, Joan Daemen and Gilles Van Assche, Michaël Peeters CS526 Topic 4: Hash Functions and Message Authentication

Limitation of Using Hash Functions for Authentication Require an authentic channel to transmit the hash of a message Without such a channel, it is insecure, because anyone can compute the hash value of any message, as the hash function is public Such a channel may not always exist How to address this? use more than one hash functions use a key to select which one to use CS526 Topic 4: Hash Functions and Message Authentication

Topic 4: Hash Functions and Message Authentication Hash Family A hash family is a four-tuple (X,Y,K,H ), where X is a set of possible messages Y is a finite set of possible message digests K is the keyspace For each KK, there is a hash function hKH . Each hK: X Y Alternatively, one can think of H as a function KXY CS526 Topic 4: Hash Functions and Message Authentication

Message Authentication Code (MAC) A MAC scheme is a hash family, used for message authentication MAC(K,M) = HK(M) The sender and the receiver share secret K The sender sends (M, Hk(M)) The receiver receives (X,Y) and verifies that HK(X)=Y, if so, then accepts the message as from the sender To be secure, an adversary shouldn’t be able to come up with (X’,Y’) such that HK(X’)=Y’. MAC: Using a shared secret (or a limit-bandwidth confidential channel) to achieve authenticity/integrity. CS526 Topic 4: Hash Functions and Message Authentication

Security Requirements for MAC Secure against the “Existential Forgery under Chosen Plaintext Attack” Challenger chooses a random key K Adversary chooses a number of messages M1, M2, .., Mn, and obtains tj=MAC(K,Mj) for 1jn Adversary outputs M’ and t’ Adversary wins if j M’≠Mj, and t’=MAC(K,M’) Basically, adversary cannot create the MAC value for a message for which it hasn’t seen an MAC MAC uses shared secret key to bootstrap integrity/authenticity. CS526 Topic 4: Hash Functions and Message Authentication

HMAC: Constructing MAC from Cryptographic Hash Functions HMACK[M] = Hash[(K+  opad) || Hash[(K+  ipad)||M)]] K+ is the key padded (with 0) to B bytes, the input block size of the hash function ipad = the byte 0x36 repeated B times opad = the byte 0x5C repeated B times. At high level, HMACK[M] = H(K || H(K || M)) Hash function is used twice, in nested fashion. CS526 Topic 4: Hash Functions and Message Authentication

Topic 4: Hash Functions and Message Authentication HMAC Security If used with a secure hash functions (e.g., SHA-256) and according to the specification (key size, and use correct output), no known practical attacks against HMAC CS526 Topic 4: Hash Functions and Message Authentication

Topic 4: Hash Functions and Message Authentication Coming Attractions … Cryptography: Public Key Cryptography CS526 Topic 4: Hash Functions and Message Authentication