Download presentation
Presentation is loading. Please wait.
Published byAlankar Datta Modified over 6 years ago
1
Homework 2 Released Due: Tuesday, October 2nd at 3PM (beginning of class) Please Typeset Your Solutions (LaTeX, Word etcβ¦) You may collaborate, but must write up your own solutions in your own words
2
Recap Message Authentication Codes
Integrity vs Confidentiality Example: Mack (π) =FK(π) Extension to unbounded messages and pitfalls (block re-ordering, truncation) CBC-MAC Authenticated Encryption + CCA-Security Encrypt and Authenticate [SSL] Authenticate then Encrypt [TLS] (Caution Required) Encrypt then Authenticate! πΈππ πΎ π = c, Mac πΎ π β² c where c=Enc πΎ πΈ β² π
3
We will see a simpler MAC construction using hash functions soon.
Caveat: Tricky Padding Issues arise if |m| is not a multiple of the block-length. See textbook. We will see a simpler MAC construction using hash functions soon. CBC-MAC π 1 π 2 π 3 π β¨ β¨ β¨ FK(.) FK(.) FK(.) FK(.) π= Mac K π Advantages over Previous Solution Both MACs are secure Works for unbounded length messages Canonical Verification Short Authentication tag Parallelizable for i=1,β¦,d π‘ π = Mac πΎ β² πβ₯ββ₯π β₯π π (encode i and β as n/4 bit strings) Output π, π‘ 1 ,β¦, π‘ π
4
Recap: Authenticated Encryption
Authenticated Encryption ο CCA-Security (by definition) Conceptual Distinction CCA-Security the goal is secrecy (hide message from active adversary) Authenticated Encryption: the goal is integrity + secrecy CCA-Security does not necessarily imply Authenticate Encryption But most natural CCA-Secure constructions are also Authenticated Encryption Schemes Some constructions are CCA-Secure, but do not provide Authenticated Encryptions, but they are less efficient.
5
Secure Communication Session
Solution Protocol? Alice transmits c1 = EncK(m1) to Bob, who decrypts and sends Alice c2 = EncK(m2) etc⦠Authenticated Encryption scheme is Stateless For fixed length-messages We still need to worry about Re-ordering attacks Alice sends 2n-bit message to Bob as c1 = EncK(m1), c2 = EncK(m2) Replay Attacks Attacker who intercepts message c1 = EncK(m1) can replay this message later in the conversation Reflection Attack Attacker intercepts message c1 = EncK(m1) sent from Alice to Bob and replays to c1 Alice only
6
Secure Communication Session
Defense Counters (CTRA,B,CTRB,A) Number of messages sent from Alice to Bob (CTRA,B) --- initially 0 Number of messages sent from Bob to Alice (CTRB,A) --- initially 0 Protects against Re-ordering and Replay attacks Directionality Bit bA,B = 0 and bB,A = 1 (e.g., since A < B) Alice: To send m to Bob, set c=EncK(bA,B β₯ CTRA,B β₯m), send c and increment CTRA,B Bob: Decrypts c, (if β₯ then reject), obtain b β₯ CTR β₯m If CTRβ CTRA,B or bβ bA,B then reject Otherwise, output m and increment CTRA,B
7
Galois Counter Mode (GCM)
AES-GCM is an Authenticated Encryption Scheme Bonus: Authentication Encryption with Associated Data Ensure integrity of ciphertext Attacker cannot even generate new/valid ciphertext! Ensures attacker cannot tamper with associated packet data Source IP Destination IP Why canβt these values be encrypted? Encryption is largely parallelizable!
8
Cryptography CS 555 Cryptographic Hash Functions Week 5: HMACs
Generic Attacks Random Oracle Model Applications of Hashing Readings: Katz and Lindell Chapter 5, Appendix A.4 Fall 2017
9
Week 5: Topic 1: Cryptographic Hash Functions
10
Hash Functions H(x)=y Long Input: π± Short Output: y s.t. π² βͺ π±
11
βYou cannot fit 10 pigeons into 9 pigeonholesβ
Pigeonhole Principle βYou cannot fit 10 pigeons into 9 pigeonholesβ
12
By Pigeonhole Principle there must exist x and y s.t.
Hash Collisions By Pigeonhole Principle there must exist x and y s.t. H(x) = H(y)
13
Classical Hash Function Applications
Hash Tables O(1) lookup* βGood hash functionβ should yield βfew collisionsβ * Certain terms and conditions apply
14
Collision-Resistant Hash Function
Intuition: Hard for computationally bounded attacker to find any pair π₯, π₯β² s.t. π» π₯ =π» π₯β² How to formalize this intuition? Attempt 1: For all PPT A, Pr π΄ 1 π = π₯,π₯β² π .π‘ π» π₯ =π»(π₯β²) β€ππππ(π) The Problem: Let π₯,π₯β² be given s.t. π» π₯ =π» π₯ β² π΄ π₯,π₯β² 1 π =(π₯,π₯β²) We are assuming that |x| > |H(x)|. Why? H(x)=x is perfectly collision resistant! (but with no compression)
15
Keyed Hash Function Syntax
Two Algorithms Gen (1π;π
) (Key-generation algorithm) Input: Random Bits R Output: Secret key s π» π (π) (Hashing Algorithm) Input: key π and message mβ 0,1 β (unbounded length) Output: hash value π» π (π) β 0,1 β π Fixed length hash function πβ 0,1 ββ² π with β β² π >β π
16
Collision Experiment ( π»ππ βπΆπππ π΄,Ξ (π))
x1,x2 π»ππ βπΆπππ π΄,Ξ (π)= ππ π» π π₯ 1 = π» π π₯ ππ‘βπππ€ππ π s=Gen (1π;π
) Definition: (Gen,H) is a collision resistant hash function if βπππ π΄ βπ (negligible) s.t Pr π»ππ βπΆπππ π΄,Ξ (π)=1 β€π(π)
17
Collision Experiment ( π»ππ βπΆπππ π΄,Ξ (π))
For simplicity we will sometimes just say that H (or Hs) is a collision resistant hash function Key is not key secret (just random) s x1,x2 π»ππ βπΆπππ π΄,Ξ (π)= ππ π» π π₯ 1 = π» π π₯ ππ‘βπππ€ππ π s=Gen (1π;π
) Definition: (Gen,H) is a collision resistant hash function if βπππ π΄ βπ (negligible) s.t Pr π»ππ βπΆπππ π΄,Ξ (π)=1 β€π(π)
18
Theory vs Practice Most cryptographic hash functions used in practice are un-keyed Examples: MD5, SHA1, SHA2, SHA3 Tricky to formally define collision resistance for keyless hash function There is a PPT algorithm to find collisions We just usually canβt find this algorithm ο
19
Weaker Requirements for Cryptographic Hash
Target-Collision Resistance s,x xβ HashTgtColl A,Ξ (π)= if H s xβ² = H s x otherwise s=Gen (1π;π
) π₯β 0,1 π Question: Why is collision resistance stronger?
20
Weaker Requirements for Cryptographic Hash
Preimage Resistance (One-Wayness) s, π¦ x HashPreImgRes A,Ξ (n)= if H s x =y otherwise s=Gen (1π;π
) π¦β 0,1 β(π) Question: Why is collision resistance stronger?
21
Merkle-DamgΓ₯rd Transform
Most cryptographic hash functions accept fixed length inputs What if we want to hash arbitrary length strings? Construction: (Gen,h) fixed length hash function from 2n bits to n bits π» π (π₯1,β¦, π₯ π ) = β π β π β π β π β¦ β π 0 π β₯π₯1 β₯ π₯ πβ1 β₯ π₯ π β₯ π₯
22
Merkle-DamgΓ₯rd Transform
Construction: (Gen,h) fixed length hash function from 2n bits to n bits π» π (π₯) = Break x into n bit segments x1,..,xd (pad last block by 0βs) π§ 0 = 0 π (initialization) For i = 1 to d π§ π = β π π§ πβ1 β₯π₯i Output π§ π+1 = β π π§ π β₯πΏ where πΏ encodes π₯ as an n-bit string
23
Merkle-DamgΓ₯rd Transform
Theorem: If (Gen,h) is collision resistant then so is (Gen,H) Proof: Show that any collision in Hs yields a collision in hs. Thus a PPT attacker for (Gen,H) can be transformed into PPT attacker for (Gen,h). Suppose that π» π (π₯) = π» π (π₯β²) (note x and xβ may have different lengths)
24
Merkle-DamgΓ₯rd Transform
Theorem: If (Gen,h) is collision resistant then so is (Gen,H) Proof: Suppose that π» π (π₯) = π» π (π₯β²) Case 1: |x|=|xβ| (proof for case two is similar) π» π (π₯) =π§ π = β π π§ πβ1 β₯ π₯ π =π» π (π₯β²) = π§ π β² = β π π§ πβ1 β² β₯ π₯ π β² π§ πβ1 β₯ π₯ π =? π§ πβ1 β² β₯ π₯ π β² No ο Found collision Yes? π§ πβ1 =β π π§ πβ2 β₯ π₯ πβ1 = β π π§ πβ2 β² β₯ π₯ πβ1 β² = π§ πβ1 β²
25
Merkle-DamgΓ₯rd Transform
Theorem: If (Gen,h) is collision resistant then so is (Gen,H) Proof: Suppose that π» π (π₯) = π» π (π₯β²) Case 1: |x|=|xβ| (proof for case two is similar) If for some i we have π§ πβ1 β₯ π₯ π β π§ πβ1 β² β₯ π₯ π β² then we will find a collision But x and xβ are different!
26
Week 5: Topic 2: HMACs and Generic Attacks
27
Keyed Hash Function Syntax
Two Algorithms Gen (1π;π
) (Key-generation algorithm) Input: Random Bits R Output: Secret key s π» π (π) (Hashing Algorithm) Input: key π and message mβ 0,1 β Output: hash value π» π (π) β 0,1 β π
28
MACs for Arbitrary Length Messages
MacK(m)= Select random n/4 bit string r Let π‘ π = Mac πΎ β² πβ₯ββ₯π β₯π π for i=1,β¦,d (Note: encode i and β as n/4 bit strings) Output π, π‘ 1 ,β¦, π‘ π Theorem 4.8: If Ξ β is a secure MAC for messages of fixed length n, above construction Ξ =(Mac,Vrfy) is secure MAC for arbitrary length messages. Disadvage for not using randomized construction. 1. This may not be a Strong-MAC.
29
MACs for Arbitrary Length Messages
Disadvantages: Lose Strong-MAC Guarantee (Multiple valid MACs of same message) Disadvantage 1: Long output MacK(m)= Select random n/4 bit string r Let π‘ π = Mac πΎ β² πβ₯ββ₯π β₯π π for i=1,β¦,d (Note: encode i and β as n/4 bit strings) Output π, π‘ 1 ,β¦, π‘ π Theorem 4.8: If Ξ β is a secure MAC for messages of fixed length n, above construction Ξ =(Mac,Vrfy) is secure MAC for arbitrary length messages. Randomized Construction (no canonical verification). Disadvantage? Disadvage for not using randomized construction. 1. This may not be a Strong-MAC.
30
Hash and MAC Construction
Start with Ξ = Mac,Vrfy , a secure MAC for messages of fixed length, and (GenH,H) a collision resistant hash function and define Ξ β² πππ πΎπ,π β² π = πππ πΎπ π» π π ππππ¦ πΎπ,π β² π,π‘ = ππππ¦ πΎπ π» π π ,π‘ Theorem 5.6: Ξ β² is a secure MAC for arbitrary length message assuming that Ξ is a secure MAC and (GenH,H) is collision resistant. Note: If Vrfy πΎπ π,π‘ is canonical then Vrfy πΎπ,π β² π,π‘ is canonical.
31
Hash and MAC Construction
Start with (Mac,Vrfy) a MAC for messages of fixed length and (GenH,H) a collision resistant hash function πππ πΎπ,π β² π = πππ πΎπ π» π π Theorem 5.6: Above construction is a secure MAC. Proof Intuition: If attacker successfully forges a valid MAC tag tβ for unseen message mβ then either Case 1: π» π πβ² = π» π ππ for some previously requested message mi Case 2: π» π πβ² β π» π ππ for every previously requested message mi
32
Hash and MAC Construction
Theorem 5.6: Above construction is a secure MAC. Proof Intuition: If attacker successfully forges a valid MAC tag tβ for unseen message mβ then either Case 1: π» π πβ² = π» π ππ for some previously requested message mi Attacker can find hash collisions! Case 2: π» π πβ² β π» π ππ for every previously requested message mi Attacker forged a valid new tag on the βnew messageβ π― π πβ² Violates security of the original fixed length MAC
33
Recap Definition of Collision Resistant Hash Functions (Gen,H)
Definitional challenges Gen(1n) outputs a public seed. Merkle-DamgΓ₯rd construction to hash arbitrary length strings Proof of correctness Hash and MAC construction
34
MAC from Collision Resistant Hash
Failed Attempt: Broken if π» π uses Merkle-DamgΓ₯rd Transform. Let π3 encode length of π1β₯π2 πππ π,π π1β₯π2β₯π3 = β π β π β π β π β π 0πβ₯π β₯π1 β₯π2 β₯π3 β₯πΏ3 = β π πππ π,π π1β₯π2 β₯πΏ3 Why does this mean π΄ππ π,πΊ is broken? πππ π,π π = π» π πβ₯π
35
HMAC πππ π,π π = π» π πβ¨opad β₯ π» π πβ¨ipad β₯π ipad? Bad joke, I knowβ¦
36
HMAC πππ π,π π = π» π πβ¨opad β₯ π» π πβ¨ipad β₯π ipad=inner pad opad=outer pad Both ipad and opad are fixed constants. Why use key twice? Allows us to prove security from weak collision resistance of Hs Bad joke, I knowβ¦
37
HMAC Security πππ π,π π = π» π πβ¨opad β₯ π» π πβ¨ipad β₯π Theorem (Informal): Assuming that π» π is weakly collision resistant and that (certain other plausible assumptions hold) this is a secure MAC. Weak Collision Resistance: Give attacker oracle access to π π = π» π πβ₯π (secret key k remains hidden). Attacker Goal: Find distinct m,mβ such that π π =π πβ²
38
HMAC in Practice MD5 can no longer be viewed as collision resistant
However, HMAC-MD5 remained unbroken after MD5 was broken Gave developers time to replace HMAC-MD5 Nevertheless, donβt use HMAC-MD5! HMAC-SHA1 still seems to be okay (temporarily), despite collision HMAC is efficient and unbroken CBC-MAC was not widely deployed because it is βtoo slowβ Instead practitioners often used heuristic constructions (which were breakable)
39
Finding Collisions Ideal Hashing Algorithm Can we do better?
Random function H from {0,1}* to {0,1}β Suppose attacker has oracle access to H(.) Attack 1: Evaluate H(.) on 2β+1 distinct inputs.
40
Birthday Attack for Finding Collisions
Ideal Hashing Algorithm Random function H from {0,1}* to {0,1}β Suppose attacker has oracle access to H(.) Attack 2: Evaluate H(.) on π=2 β/ distinct inputs x1,β¦,xq. Pr No Collision =Pr βπ<π. π»(xi)β π»(xj) =Pr π« π π=3 π ππ π« π π« πβπ ,β¦, π« π π« π =πππππ ππππ π» π₯ π β π» π₯ πβ11 ,β¦,π» π₯ 1
41
Birthday Attack for Finding Collisions
Ideal Hashing Algorithm Random function H from {0,1}* to {0,1}β Suppose attacker has oracle access to H(.) Attack 2: Evaluate H(.) on π=2 β/ distinct inputs x1,β¦,xq. Pr βπ<π. π»(xi)β π»(xj) = 1Γ 1β 1 2 β Pr π» π₯ 2 β π» π₯ 1 Γ 1β 2 2 β Pr π« π | π« π Γβ¦Γ 1β 2 β/ β Pr π« π π« πβπ ,β¦, π« π π« π
42
Birthday Attack for Finding Collisions
Ideal Hashing Algorithm Random function H from {0,1}* to {0,1}β Suppose attacker has oracle access to H(.) Attack 2: Evaluate H(.) on π=2 β/ distinct inputs x1,β¦,xq. Pr βπ<π. π»(xi)β π»(xj) =1 1β 1 2 β 1β 2 2 β 1β 3 2 β β¦ 1β 2 β/ β βexp βπ πβ1 2 β+1
43
Birthday Attack for Finding Collisions
Ideal Hashing Algorithm Random function H from {0,1}* to {0,1}β Suppose attacker has oracle access to H(.) Attack 2: Evaluate H(.) on π=2 β/ distinct inputs x1,β¦,xq. Pr βπ<π. π»(xi)β π»(xj) =1 1β 1 2 β 1β 2 2 β 1β 3 2 β β¦ 1β 2 β/ β βexp βπ πβ1 2 β+1 <exp β4 2 β 2 β+1 = π β2 < 1 2
44
Birthday Attack for Finding Collisions
exp βπ πβ1 2 β+1 <πΊ for π> 2 β+1 ln πΊ +1 Ideal Hashing Algorithm Random function H from {0,1}* to {0,1}β Suppose attacker has oracle access to H(.) Attack 2: Evaluate H(.) on π=2 β/ distinct inputs x1,β¦,xq. Pr βπ<π. π»(xi)β π»(xj) =1 1β 1 2 β 1β 2 2 β 1β 3 2 β β¦ 1β 2 β/ β βexp βπ πβ1 2 β+1 <exp β4 2 β 2 β+1 = π β2 < 1 2
45
Birthday Attack for Finding Collisions
Ideal Hashing Algorithm Random function H from {0,1}* to {0,1}β Suppose attacker has oracle access to H(.) Attack 2: Evaluate H(.) on π=2 β/ distinct inputs x1,β¦,xq. Store values xi,π»(xi) in a hash table of size q Requires time/space O(π)=π 2 β Can we do better?
46
Floydβs Cycle Finding Algorithm
A cycle denotes a hash collision Occurs after O 2 β/2 steps by birthday paradox First attack phase detects cycle Second phase identifies collision Floydβs Cycle Finding Algorithm Let j denote the length of the chain before the cycle starts (3) in the example and let c denote the length of the cycle Let c denote length of cycle and suppose that x_{2i} = x_i then we have 2i-j=i-j mod c. Implies that 2i=c+i. We have h(x_{j-1}) = h(x_{j+c-1}), X reaches x_{j-1} in j-1 steps and xβ reaches x_{j+c-1}=x_{j+2c-1} in j-1 β steps (since we start at j) Analogy: Cycle detection in linked list Can traverse βlinked listβ by computing H
47
Small Space Birthday Attack
Attack 2: Select random x0, define xi=π»(xiβ1) Initialize: x=x0 and xβ²=x0 Repeat for i=1,2,β¦ x:=H(x) now x =xi xβ²:=H(H(xβ²)) now xβ²=x2i If x=xβ then break Reset x=x0 and set xβ²=x Repeat for j=1 to i If H(x) = H(xβ) then output x,xβ Else x:= H(x), xβ = H(x) Now x=xj AND xβ²=xi+j
48
Small Space Birthday Attack
Finds collision after O 2 β/2 steps in expectation Attack 2: Select random x0, define xi=π»(xiβ1) Initialize: x=x0 and xβ²=x0 Repeat for i=1,2,β¦ x:=H(x) now x =xi xβ²:=H(H(xβ²)) now xβ²=x2i If x=xβ then break Reset x=x0 and set xβ²=x Repeat for j=1 to i If H(x) = H(xβ) then output x,xβ Else x:= H(x), xβ = H(x) Now x=xj AND xβ²=xi+j Let j denote the length of the chain before the cycle starts (3) in the example and let c denote the length of the cycle Let c denote length of cycle and suppose that x_{2i} = x_i then we have 2i-j=i-j mod c. Implies that 2i=c+i. We have h(x_{j-1}) = h(x_{j+c-1}), X reaches x_{j-1} in j-1 steps and xβ reaches x_{j+c-1}=x_{j+2c-1} in j-1 β steps (since we start at j)
49
Small Space Birthday Attack
Can be adapted to find βmeaningful collisionsβ if we have a large message space O 2 β Example: S= π 1 βͺ π 2 with π 1 = π 2 = 2 ββ1 π 1 = Set of positive recommendation letters π 2 = Set of negative recommendation letters Goal: find π§1βπ 1 , π§2βπ 2 , such that H(z1) = H(z2) Can adapt previous attack by assigning unique binary string b x β 0,1 β of length to each π₯βπ xi=π»(b xiβ1 )
50
Targeted Collision Attacks
Precomputation (π‘Γπ steps, 2π memory) π π 2 = π₯ 1 2 π π π = π₯ 1 π π π 1 = π₯ 1 1 π π 1 = π₯ 1 1 π₯ 2 2 =π» π₯ 1 2 π₯ 2 π =π» π₯ 1 π π₯ 2 1 =π» π₯ 1 1 β¦ β¦ β¦ β¦ π₯ π+1 2 =π» π₯ π 2 β¦ π₯ π+1 1 =π» π₯ π 1 π₯ π+1 π =π» π₯ π π β¦ β¦ β¦ π₯ π‘ 2 = ππ 2 π₯ π‘ π = ππ π π₯ π‘ 1 = ππ 1 π₯ π‘ 1 = ππ 1
51
Targeted Collision Attacks
Precomputation (π‘Γπ steps, 2π Γβ memory) π π π = π₯ 1 π Goal: Find collision for target π¦=π»(π₯) π₯ 2 π =π» π₯ 1 π β¦ β¦ π¦ 0 =π¦ β¦ π¦ 1 =π» π¦ 0 β¦ π₯ π+1 π =π» π₯ π π β¦ β¦ β¦ π¦ π =π» π¦ πβ1 β¦ π₯ π‘ π = ππ π π¦ π = ππ π
52
Targeted Collision Attacks
Suppose π= π π π for some πβ€π, πβ€π ο π=π― π πβπ π = π― πβπ ππ π (takes t steps to recover π πβπ π from ππ π ) Precomputation (π‘Γπ steps, 2π Γβ memory) π π π = π₯ 1 π Goal: Find collision for target π¦=π»(π₯) πΓπ> π β+π ο good chance that π= π π π for some πβ€π, πβ€π π₯ 2 π =π» π₯ 1 π β¦ β¦ π¦ 0 =π¦ β¦ π¦ 1 =π» π¦ 0 β¦ π₯ π+1 π =π» π₯ π π β¦ β¦ Not quite trueβ¦chains can intersect and may not represent πΓπ distinct points β¦ β¦ π¦ π =π» π¦ πβ1 β¦ π₯ π‘ π = ππ π π¦ π = ππ π
53
Intersecting Chains Precomputation (π‘Γπ steps, 2π memory)
Intersecting chains contain βͺπ¬π distinct points. π π π = π₯ 1 π π π πβ² = π₯ 1 πβ² π₯ 2 π =π» π₯ 1 π π₯ 2 πβ² =π» π₯ 1 πβ² β¦ β¦ β¦ After initial intersection the chains merge together ο π₯ π πβ² = π₯ π+1 π π₯ π πβ² =π» π₯ π πβ² π₯ π+1 π =π» π₯ π π β¦ π₯ π‘ π = ππ π β¦ π₯ π‘ πβ² = ππ πβ²
54
Targeted Collision Attacks
Precomputation (π‘Γπ steps, 2π memory) π π 2 = π₯ 1 2 π π π = π₯ 1 π π π 1 = π₯ 1 1 π π 1 = π₯ 1 1 π₯ 2 2 =π» π₯ 1 2 π₯ 2 π =π» π₯ 1 π π₯ 2 1 =π» π₯ 1 1 β¦ β¦ β¦ β¦ π₯ π+1 2 =π» π₯ π 2 β¦ π₯ π+1 1 =π» π₯ π 1 π₯ π+1 π =π» π₯ π π β¦ β¦ β¦ π₯ π‘ 2 = ππ 2 π₯ π‘ π = ππ π π₯ π‘ 1 = ππ 1 π₯ π‘ 1 = ππ 1
55
Targeted Collision Attacks
π» π π₯ =π» πΉ πΎ π π₯ Precomputation (π‘Γπ steps, 2π memory) π π 2 = π₯ 1 2 π π π = π₯ 1 π π π 1 = π₯ 1 1 π π 1 = π₯ 1 1 π₯ 2 2 = π» 1 π₯ 1 2 π₯ 2 π = π» 1 π₯ 1 π π₯ 2 1 = π» 1 π₯ 1 1 β¦ β¦ β¦ β¦ π₯ π+1 2 = π» π π₯ π 2 β¦ π₯ π+1 1 = π» π π₯ π 1 π₯ π+1 π = π» π π₯ π π β¦ β¦ β¦ π₯ π‘ 2 = ππ 2 π₯ π‘ π = ππ π π₯ π‘ 1 = ππ 1 π₯ π‘ 1 = ππ 1
56
Targeted Collision Attacks
π» π π₯ =π» πΉ πΎ π π₯ Precomputation (π‘Γπ steps, 2π memory) π π 2 = π₯ 1 2 π π π = π₯ 1 π π π 1 = π₯ 1 1 π π 1 = π₯ 1 1 π₯ 2 2 = π» 1 π₯ 1 2 π₯ 2 π = π» 1 π₯ 1 π π₯ 2 1 = π» 1 π₯ 1 1 β¦ Ensures Chains Contain: Ξ© π π‘ distinct points π ππππ ππ£πππππ πππ‘π€πππ πβππππ β¦ β¦ β¦ π₯ π+1 2 = π» π π₯ π 2 β¦ π₯ π+1 1 = π» π π₯ π 1 π₯ π+1 π = π» π π₯ π π Untangling Chains: If π₯ π 1 = π₯ π 2 with πβ π then (whp) π» π π₯ π 1 β π» π π₯ π 2 β¦ β¦ β¦ π₯ π‘ 2 = ππ 2 π₯ π‘ π = ππ π π₯ π‘ 1 = ππ 1 π₯ π‘ 1 = ππ 1
57
Targeted Collision Attacks
Suppose π= π π π for some πβ€π, πβ€π ο π= π― πβπ πΉ πΎ πβ1 π πβπ π (takes t steps to recover π πβπ π from ππ π ) Precomputation (π‘Γπ steps, 2π Γβ memory) π π π = π₯ 1 π Goal: Find collision for target π¦=π»(π₯) πΓπ> π β+π ο good chance that π= π π π for some πβ€π, πβ€π π₯ 2 π = π» 1 π₯ 1 π β¦ β¦ π¦ 0 =π¦ β¦ π¦ 1 = π» 1 π¦ 0 β¦ π₯ π+1 π = π» πβ1 π₯ π π πππππ π·πππππππ: πβ π π π for any πβ€π, πβ€π (expect about πΆ π π π / π β ) ο Running Time: πΆ π π π / π β β¦ β¦ β¦ π¦ π = π» πβ1 π¦ πβ1 β¦ π₯ π‘ π = ππ π π¦ π = ππ π
58
Targeted Collision Attacks
Precomputation (π‘Γπ steps, 2π Γβ memory) π π π = π₯ 1 π Goal: Find collision for target π¦=π»(π₯) Set π = 2 2β 3 +1 , π‘= 2 β 3 +1 Precomputation: π π β Space: π 2 2β 3 Γβ Collision Search: πΆ 2 πβ π π₯ 2 π = π» 1 π₯ 1 π β¦ β¦ π¦ 0 =π¦ β¦ Amortized cost to find 2 β 3 targeted collisions π¦ 1 = π» 1 π¦ 0 β¦ π₯ π+1 π = π» πβ1 π₯ π π β¦ β¦ β¦ π¦ π = π» πβ1 π¦ πβ1 β¦ π₯ π‘ π = ππ π π¦ π = ππ π
59
Applications Key-Recovery Attacks on Block Cipher πΈ:π¦Γ 0,1 π β 0,1 π
Pre-Computation: π π¦ Crack 2 π π secret keys in total time πΆ π¦ with space s=πΆ 2 2π π Run prior attack with βhash functionβ H: 0,1 π β 0,1 π H πΎ = πΈ πΎ π for some random (fixed) πβ 0,1 π Password Cracking Attacker is given π»β² π₯ 1 ,β¦, π»β² π₯ π for passwords π₯ 1 ,β¦, π₯ π βπ«π²ππ with π«π²ππ βͺ π¦ Goal: Recover passwords π₯ 1 ,β¦, π₯ π Can crack all π= π«π²ππ 1/3 passwords in total time πΆ π«π²ππ with space s= πΆ π«π²ππ 2/3 Domain Challenge: H β² : π«π²ππ β 0,1 π with π«π²ππ βͺ2π Define (pseudo)random mapping π: 0,1 π βπ«π²ππ Run prior attack with βhash functionβ H:π«π²ππβπ«π²ππ as H π₯ =π H β² π₯
60
Week 5: Topic 3: Random Oracle Model + Hashing Applications
61
(Recap) Collision-Resistant Hash Function
Intuition: Hard for computationally bounded attacker to find x,y s.t. H(x) = H(y) How to formalize this intuition? Attempt 1: For all PPT A, Pr π΄ π₯,π¦ 1 π = π₯,π¦ π .π‘ π» π₯ =π»(π¦) β€ππππ(π) The Problem: Let x,y be given s.t. H(x)=H(y) π΄ π₯,π¦ 1 π =(π₯,π¦) We are assuming that |x| > |H(x)|. Why? H(x)=x is perfectly collision resistant! (but with no compression)
62
(Recap) Keyed Hash Function Syntax
Two Algorithms Gen (1π;π
) (Key-generation algorithm) Input: Random Bits R Output: Secret key s π» π (π) (Hashing Algorithm) Input: key π and message mβ 0,1 β (unbounded length) Output: hash value π» π (π) β 0,1 β π Fixed length hash function πβ 0,1 ββ² π with β β² π >β π
63
When Collision Resistance Isnβt Enough
Example: Message Commitment Alice sends Bob: Hs πβ₯π (e.g., predicted winner of NCAA Tournament) Alice can later reveal message (e.g., after the tournament is over) Just send r and m (note: r has fixed length) Why can Alice not change her message? In the meantime Bob shouldnβt learn anything about m Problem: Let (Gen,Hβ) be collision resistant then so is (Gen,H) π» π π₯1,β¦,π₯π = π» β²π π₯1,β¦,π₯π β₯π₯π Why include r in the hash? Brute-force attack if message space is smallβ¦attacker can quickly learn message is not _____
64
When Collision Resistance Isnβt Enough
Problem: Let (Gen,Hβ) be collision resistant then so is (Gen,H) π» π π₯1,β¦, π₯ π = π» β²π π₯1,β¦, π₯ π β₯π₯π (Gen,H) definitely does not hide all information about input (π₯1,β¦, π₯ π ) Conclusion: Collision resistance is not sufficient for message commitment
65
This is still a reasonable approach in practice!
The Tension Example: Message Commitment Alice sends Bob: Hs πβ₯π (e.g., predicted winners of NCAA Final Four) Alice can later reveal message (e.g., after the Final Four is decided) In the meantime Bob shouldnβt learn anything about m This is still a reasonable approach in practice! No attacks when instantiated with any reasonable candidate (e.g., SHA3) Cryptographic hash functions seem to provide βsomethingβ beyond collision resistance, but how do we model this capability?
66
Random Oracle Model Model hash function H as a truly random function
Algorithms can only interact with H as an oracle Query: x Response: H(x) If we submit the same query you see the same response If x has not been queried, then the value of H(x) is uniform Real World: H instantiated as cryptographic hash function (e.g., SHA3) of fixed length (no Merkle-DamgΓ₯rd)
67
Back to Message Commitment
Example: Message Commitment Alice sends Bob: H πβ₯π (e.g., predicted winners of NCAA Final Four) Alice can later reveal message (e.g., after the Final Four is decided) Just send r and m (note: r has fixed length) Why can Alice not change her message? In the meantime Bob shouldnβt learn anything about m Random Oracle Model: Above message commitment scheme is secure (Alice cannot change m + Bob learns nothing about m) Information Theoretic Guarantee against any attacker with q queries to H Suppose when attacker submits query H(rβ|mβ) we tell him that rβ is correct/incorrect. As long as rβ is incorrect the attacker learns nothing in an information theoretic sense. The probability of submitting rβ=r is at most (1/2^|r|)
68
Random Oracle Model: Pros
It is easier to prove security in Random Oracle Model Suppose we are simulating attacker A in a reduction Extractability: When A queries H at x we see this query and learn x (and can easily find H(x)) Programmability: We can set the value of H(x) to a value of our choice As long as the value is correctly distribute i.e., close to uniform Both Extractability and Programmability are useful tools for a security reduction!
69
Random Oracle Model: Pros
It is easier to prove security in Random Oracle Model Provably secure constructions in random oracle model are often much more efficient (compared to provably secure construction is βstandard modelβ Sometimes we only know how to design provably secure protocol in random oracle model
70
Random Oracle Model: Cons
Lack of formal justification Why should security guarantees translate when we instantiate random oracle with a real cryptographic hash function? We can construct (contrived) examples of protocols which are Secure in random oracle model⦠But broken in the real world
71
Random Oracle Model: Justification
βA proof of security in the random-oracle model is significantly better than no proof at all.β Evidence of sound design (any weakness involves the hash function used to instantiate the random oracle) Empirical Evidence for Security βthere have been no successful real-world attacks on schemes proven secure in the random oracle modelβ
72
Hash Function Application: Fingerprinting
The hash h(x) of a file x is a unique identifier for the file Collision Resistance ο No need to worry about another file y with H(y)=H(y) Application 1: Virus Fingerprinting Application 2: P2P File Sharing Application 3: Data deduplication
73
Tamper Resistant Storage
H(m1) m1β
74
Tamper Resistant Storage
File Index Hash 1 H(m1) 2 H(m2) 3 H(m3) Disadvantage: Too many hashes to store m1,m2,m3 Send file 1 m1β
75
Tamper Resistant Storage
Disadvantage: Need all files to compute hash m1,m2,m3 H(m1,m2,m3) m1,m2,m3 Send file 1 m1β
76
Merkle Trees Proof of Correctness for data block 2
Verify that root matches Proof consists of just log(n) hashes Verifier only needs to permanently store only one hash value
77
Merkle Trees Theorem: Let (Gen, hs) be a collision resistant hash function and let Hs(m) return the root hash in a Merkle Tree. Then Hs is collision resistant.
78
Tamper Resistant Storage
Root: H1-4 m1,m2,m3,m4 Send file 2 m2β,h1,h3-4
79
Commitment Schemes Alice wants to commit a message m to Bob Properties
And possibly reveal it later at a time of her choosing Properties Hiding: commitment reveals nothing about m to Bob Binding: it is infeasible for Alice to alter message
80
Commitment Hiding ( Hiding π΄,πΆππ (π))
commit(r,mb) bβ Hiding π΄,πΆππ (π)= if π= π β² ππ‘βπππ€ππ π r = Gen(.) Bit b βπππ π΄ βπ (negligible) s.t Pr Hiding π΄,πΆππ π =1 β€ 1 2 +π(π)
81
Commitment Binding ( Binding π΄,πΆππ (π))
r0,r1,m0,m1 Binding π΄,πΆππ (π)= if commit(r0,m0)= commit(r1,m1) ππ‘βπππ€ππ π βπππ π΄ βπ (negligible) s.t Pr Binding π΄,πΆππ π =1 β€π(π)
82
Secure Commitment Scheme
Definition: A secure commitment scheme is hiding and binding Hiding Binding βπππ π΄ βπ (negligible) s.t Pr Hiding π΄,πΆππ π =1 β€ 1 2 +π(π) βπππ π΄ βπ (negligible) s.t Pr Binding π΄,πΆππ π =1 β€π(π)
83
Commitment Scheme in Random Oracle Model
Commit(r,m):=H(m|r) Reveal(c):= (m,r) Theorem: In the random oracle model this is a secure commitment scheme.
84
Commitment Hiding ( Hiding π΄,πΆππ (π))
H(r,mb) bβ Hiding π΄,πΆππ (π)= πππ= π β² ππ‘βπππ€ππ π Proof: Suppose we gave attacker extra information for every query. Tell him if r matches. Now unless he sends r = Gen(.) Bit b βπππ π΄ ππππππ ππ‘ πππ π‘ π π ππ’πππππ Pr Hiding π΄,πΆππ π =1 β€ π(π) 2 π
85
Other Applications Password Hashing Key Derivation
86
Next Week Stream Ciphers Block Ciphers Feistel Networks DES, 3DES
Read Katz and Lindell
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.