Cryptography Lecture 10.

Slides:



Advertisements
Similar presentations
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (3) Information Security.
Advertisements

Sri Lanka Institute of Information Technology
CMSC 414 Computer and Network Security Lecture 4 Jonathan Katz.
Asymmetric Cryptography part 1 & 2 Haya Shulman Many thanks to Amir Herzberg who donated some of the slides from
CS555Spring 2012/Topic 111 Cryptography CS 555 Topic 11: Encryption Modes and CCA Security.
CMSC 414 Computer and Network Security Lecture 5 Jonathan Katz.
IND-CPA and IND-CCA Concepts Summary  Basic Encryption Security Definition: IND-CPA  Strong Encryption Security Definition: IND-CCA  IND-CPA, IND-CCA.
Cryptography Lecture 4 Arpita Patra.
CS555Spring 2012/Topic 71 Cryptography CS 555 Topic 7: Stream Ciphers and CPA Security.
Cryptography Lecture 8 Arpita Patra © Arpita Patra.
Message Authentication Codes
Updated Office Hours Tuesday: 10:30 AM-11:30 AM
Authenticated encryption
Homework 1 Due: Thursday at 9 AM (beginning of class)
Secrecy of (fixed-length) stream ciphers
B504/I538: Introduction to Cryptography
B504/I538: Introduction to Cryptography
Cryptography Lecture 9.
Cryptography Lecture 26.
Topic 11: Authenticated Encryption + CCA-Security
Cryptography Lecture 3.
Cryptography Lecture 13.
Cryptography Lecture 12.
Cryptography Lecture 4.
Cryptography Lecture 27.
Cryptography Lecture 16.
Cryptography Lecture 6.
Topic 7: Pseudorandom Functions and CPA-Security
B504/I538: Introduction to Cryptography
Cryptography Lecture 11 Arpita Patra © Arpita Patra.
Cryptography Lecture 7 Arpita Patra © Arpita Patra.
Cryptography Lecture 7.
Cryptography Lecture 25.
Cryptography Lecture 7 Arpita Patra © Arpita Patra.
Cryptography Lecture 11.
Message Authentication and Hash Functions
Homework 1 Due: Thursday at 3PM (beginning of class)
Cryptography Lecture 12 Arpita Patra © Arpita Patra.
Cryptography Lecture 4.
Cryptography Lecture 5.
Cryptography Lecture 8.
Cryptography Lecture 11.
Cryptography Lecture 9.
Cryptography Lecture 12.
Padding Oracle Attacks
Topic 13: Message Authentication Code
Cryptography Lecture 6.
Cryptography Lecture 7.
Cryptography Lecture 14.
Cryptography Lecture 9 Arpita Patra © Arpita Patra.
Cryptography Lecture 13.
Cryptography Lecture 3.
Cryptography Lecture 10.
Cryptography Lecture 9.
Cryptography Lecture 22.
Cryptography Lecture 11.
Cryptography Lecture 10.
Cryptography Lecture 6.
Cryptography Lecture 21.
Cryptography Lecture 13.
Cryptography Lecture 25.
2. Perfect Secret Encryption
Cryptography Lecture 24.
Cryptography Lecture 23.
Cryptography Lecture 26.
Secret-Key Encryption
CIS 5371 Cryptography 2. Perfect Secret Encryption
Presentation transcript:

Cryptography Lecture 10

Padding-oracle attack In the definition of CCA-security, the attacker can obtain the decryption of any ciphertext of its choice (besides the challenge ciphertext) Is this realistic? We show a scenario where: One bit about decrypted ciphertexts is leaked This can be exploited to learn the entire plaintext The scenario occurs in the real world!

CBC-mode encryption m1 m2 ml IV    … Fk Fk Fk c0 c1 c2 cl

CBC-mode decryption m1 m2 ml    … F-1k F-1k F-1k c0 c1 c2 cl

Arbitrary-length messages? Message  encoded data  ciphertext PKCS #5 encoding: Assume message is an integral # of bytes Let L be the block length (in bytes) of the cipher Let b ≥ 1 be # of bytes that need to be appended to the message to get length a multiple of L 1 ≤ b ≤ L; note b  0 Append b (encoded in 1 byte), b times I.e., if 3 bytes of padding are needed, append 0x030303

Decryption? To decrypt: Use CBC-mode decryption to obtain encoded data Say the final byte of encoded data has value b If b=0 or b > L, return “error” If final b bytes of encoded data are not all equal to b, return “error” Otherwise, strip off the final b bytes of the encoded data, and output what remains as the message

c k k c  Enck(m) Deck(c') c’ error? Padding oracle!

 = Fk-1(c1): IV: “Success” “Error” XX XX XX XX XX XX XX XX 98 AB 01 0x9E  0x06 Fk-1(c1): XX XX XX XX XX XX XX XX 98  IV: AB 01 4F 21 00 7C 02 9E = Encoded data: XX XX XX XX 06 XX 06 06 XX XX 06 XX 06 “Success” “Error”

 plaintext byte = XX  0x01 = 0x47 Fk-1(c1): XX XX XX XX XX XX XX 98  0x02  0x06  0x07 0x98  0x07 IV: AB 00 41 01 01 02 4E 4F 20 21 01 00 7D 7C 02 03 9F 9E = Encoded data: XX XX 07 07 06 06 07 07 06 06 07 06 07 06 07 XX  0x41 = 0x07  XX = 0x41  0x07  plaintext byte = XX  0x01 = 0x47 “Success!”

Attack complexity? ≤ L tries to learn the # of padding bytes ≤ 28 = 256 tries to learn each plaintext byte

CCA-security: a summary Chosen-ciphertext attacks represent a significant, real-world threat Modern encryption schemes are designed to be CCA-secure None of the schemes we have seen so far are CCA-secure – why? Will see an example of a CCA-secure scheme later

Message integrity

Secrecy vs. integrity So far we have been concerned with ensuring secrecy of communication What about integrity? I.e., ensuring that a received message originated from the intended party, and was not modified Even if an attacker controls the channel! Standard error-correction techniques not enough! The right tool is a message authentication code

m, t m’, t’ k k m t = Mack(m) Vrfyk(m’, t’) = 1?

m, t k k m

k m, t m, t m, t m, t k Vrfyk(m, t)=1?

…price=10… k cookie, t cookie cookie, t k cookie

Secrecy vs. integrity Secrecy and integrity are orthogonal concerns Possible to have either one without the other Sometimes you might want one without the other Most often, both are needed Encryption does not (in general) provide any integrity Integrity is even stronger than non-malleability None of the schemes we have seen so far provide any integrity

Message authentication code (MAC) A message authentication code is defined by three PPT algorithms (Gen, Mac, Vrfy): Gen: takes as input 1n; outputs k. (Assume |k|≥n.) Mac: takes as input key k and message m{0,1}*; outputs tag t t := Mack(m) Vrfy: takes key k, message m, and tag t as input; outputs 1 (“accept”) or 0 (“reject”) For all m and all k output by Gen, Vrfyk(m, Mack(m)) = 1

Security? Only one standard definition Threat model Security goal “Adaptive chosen-message attack” Assume the attacker can induce the sender to authenticate messages of the attacker’s choice Security goal “Existential unforgeability” Attacker should be unable to forge a valid tag on any message not previously authenticated by the sender

m1, t1 k m2, t2 t1 := Mack(m1) t2 := Mack(m2) … ti := Mack(mi) … mi, ti m’, t’ k Vrfyk(m’, t’) ??

Formal definition Fix A,  Define randomized experiment ForgeA,(n): k  Gen(1n) A interacts with an oracle Mack(·) ; let M be the set of messages submitted to this oracle A outputs (m, t) A succeeds, and the experiment evaluates to 1, if Vrfyk(m, t)=1 and mM

Security for MACs  is secure if for all PPT attackers A, there is a negligible function  such that Pr[ForgeA,(n) = 1] ≤ (n)

Security? Is the definition too strong? We don’t want to make any assumptions about what the sender might authenticate We don’t want to make any assumptions about what forgeries are “meaningful” A MAC satisfying this definition can be used anywhere integrity is needed

Replay attacks Note that replay attacks are not prevented No stateless mechanism can prevent them Replay attacks are often a significant real-world concern Need to protect against replay attacks at a higher level Decision about what to do with a replayed message is application-dependent

A fixed-length MAC

Intuition? We need a keyed function Mac such that: Given Mack(m1), Mack(m2), …, …it is infeasible to predict the value Mack(m) for any m{m1, …, } Let Mac be a pseudorandom function!

Construction Let F be a length-preserving pseudorandom function (aka block cipher) Construct the following MAC : Gen: choose a uniform key k for F Mack(m): output Fk(m) Vrfyk(m, t): output 1 iff Fk(m)=t Theorem:  is a secure MAC