Top Banner
Foundations of Network Foundations of Network and Computer Security and Computer Security J John Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009
25

Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Dec 19, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Foundations of Network and Foundations of Network and Computer SecurityComputer Security

JJohn Black

Lecture #5Aug 31st 2009

CSCI 6268/TLEN 5550, Fall 2009

Page 2: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

How about Triple-DES!

• Triple DES uses a 168-bit key K=(K1, K2, K3) TDESK(P) = DESK3(DESK2(DESK1(P)))

• No known attacks against TDES– Provides 112-bits of security against key-search– Widely used, standardized, etc– More often used in “two-key triple-DES” mode with

EDE format (K is 112 bits like DDES):

TDESK(P) = DESK1(DES-1K2(DESK1(P)))

– Why is the middle operation a decipherment?

Page 3: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

AES – The Advanced Encryption Standard

• If TDES is secure, why do we need something else?– DES was slow– DES times 3 is three times slower– 64-bit blocksize could be bigger without

adding much cost– DES had other annoying weakness which

were inherited by TDES– We know a lot more about blockcipher design,

so time to make something really cool!

Page 4: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

AES Competition

• NIST sponsored a competition– Individuals and groups submitted entries

• Goals: fast, portable, secure, constrained environments, elegant, hardware-friendly, patent-free, thoroughly analyzed, etc

– Five finalists selected (Aug 1999)• Rijndael (Belgium), MARS (IBM), Serpent (Israel),

TwoFish (Counterpane), RC6 (RSA, Inc)

– Rijndael selected (Dec 2001)• Designed by two Belgians

Page 5: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

AES – Rijndael

• Not a Feistel construction!– 128 bit blocksize– 128, 192, 256-bit keysize– SP network

• Series of invertible (non-linear) substitutions and permutations

– Much faster than DES• About 300 cycles on a Pentium III

– A somewhat risky choice for NIST

Page 6: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Security of the AES

• Four rounds are easily broken via the “Square Attack”– Within the scope of this class, but we won’t do

it– Six rounds breakable, but quite a bit harder– Initial proposal was therefore using 8 rounds– Objections during assessment phase caused

designers to go to 10 rounds

Page 7: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Block Ciphers – Conclusion

• There are a bunch out there besides AES and DES– Some are pretty good (IDEA, TwoFish, etc)– Some are pretty lousy

• LOKI, FEAL, TEA, Magenta, Bass-O-Matic

• If you try and design your own, it will probably be really really bad– Plenty of examples, yet it still keeps

happening

Page 8: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Aren’t We Done?

• Blockciphers are only a start– They take n-bits to n-bits under a k-bit key– Oftentimes we want to encrypt a message

and the message might be less than or greater than n bits!

– We need a “mode of operation” which encrypts any M in {0,1}*

– There are many, but we focus on three: ECB, CBC, CTR

Page 9: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Recall Indistinguishability

• Recall blockcipher X:– I hand you an oracle that is either a random

permutation or blockcipher X under a random key K; can you distinguish?

• Recall one-round of DES:– I hand you an oracle that is either a random

permutation or 1-round DES under a random key K; can you distinguish?

• Recall two-rounds of DES:– Same question… it might be on the midterm.

Page 10: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Goals of Encryption

• Cryptographers want to give up exactly two pieces of information when encrypting a message1) That M exists2) The approximate length of M

• The military sometimes does not even want to give up these two things!– Traffic analysis

• We definitely don’t want to make it obvious when a message repeats

Page 11: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

ECB – Electronic Codebook

• This is the most natural way to encrypt– It’s what we used with the Substitution Cipher– For blockcipher E under key K:

– First, pad (if required) to ensure M in ({0,1}n)+

– Write M = M1 M2 … Mm where each Mi has size n-bits

– Then just encipher each chunk:• Ci = EK(Mi) for all 1 ≤ i ≤ m

– Ciphertext is C = C1 C2 … Cm

Page 12: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Why ECB Mode is BAD

• ECB leaks more than we wanted– Repetitions in the plaintext show through to

the ciphertext– This is easily avoided, so let’s do so

• There ARE applications where ECB makes sense

• What’s a nice advantage of ECB mode?

Page 13: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

CBC Mode Encryption

• Start with an n-bit “nonce” called the IV– Initialization Vector– Usually a counter or a random string

• Blockcipher E under key K, M broken into m blocks of n bits as usual– C0 = IV– Ci = EK(Mi C⊕ i-1) for all 1 ≤ i ≤ m

EK EK EK

M2 MmM1

IV

C1 C2Cm

Page 14: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Digression on the One-Time Pad

• Suppose Alice and Bob shared a 10,000 bit string K that was secret, uniformly random– Can Alice send Bob a 1KB message M with

“perfect” security?– 1KB is 8192 bits; let X be the first 8192 bits of

the shared string K– Alice sets C = M X, and sends C to Bob⊕– Bob computes C X and recovers M⊕

• Recall that M X X = M⊕ ⊕

Page 15: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Security of the One-Time Pad

• Consider any bit of M, mi, and the corresponding bits of X and C, (xi, ci)– Then ci = mi x⊕ i

– Given that some adversary sees ci go across a wire, what can he discern about the bit mi?

• Nothing! Since xi is equally likely to be 0 or 1

– So why not use the one-time pad all the time?• Shannon proved (1948) that for perfect security the

key must be at least as long as the message– Impractical

Page 16: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

One-Time Pad (cont)

• Still used for very-top-secret stuff– Purportedly used by Russians in WW II

• Note that it is very important that each bit of the pad be used at most one time!– The infamous “two time pad” is easily broken

• Imagine C = M X, C’ = M’ X⊕ ⊕• Then C C’ = M X M’ X = M M’⊕ ⊕ ⊕ ⊕ ⊕• Knowing the xor of the two messages is potentially very

useful• n-time pad for large n is even worse (WEP does this)

Page 17: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Counter Mode – CTR

• Blockcipher E under key K, M broken into m blocks of n bits, as usual

• Nonce N is typically a counter, but not required C0 = N

Ci = EK(N++) M⊕ i

• Ciphertext is C = C0 C1 … Cm

Page 18: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

CTR Mode

• Again, n bits of ciphertext expansion

• Non-deterministic encryption

• Fully parallelizable in both directions

• Not that widely used despite being known for a long time– People worry about counter overlap producing

pad reuse

Page 19: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Why I Like Modes of Operation

• Modes are “provably secure”– Unlike blockciphers which are deemed “hopefully

secure” after intense scrutiny by experts, modes can be proven secure like this:

• Assume blockcipher E is secure (computationally indistinguishable from random, as we described)

• Then the mode is secure in an analogous black-box experiment

– The proof technique is done via a “reduction” much like you did in your NP-Completeness class

– The argument goes like this: suppose we could break the mode with computational resources X, Y, Z. Then we could distinguish the blockcipher with resources X’, Y’, Z’ where these resources aren’t that much different from X, Y, and Z

Page 20: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Security Model

• Alice and Bob– Traditional names– Let’s us abbreviate A and B– Adversary is the bad guy

• This adversary is passive; sometimes called “eve”

– Note also the absence of side-channels• Power consumption, timing, error messages, etc

Adversary

Alice

Key K Key K

Bob

Page 21: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Various Attack Models

• Known-Ciphertext Attack (KCA)– You only know the ciphertext– Requires you know something about the plaintext (eg,

it’s English text, an MP3, C source code, etc)– This is the model for the Sunday cryptograms which

use a substitution cipher• Known-Plaintext Attack (KPA)

– You have some number of plaintext-ciphertext pairs, but you cannot choose which plaintexts you would like to see

– This was our model for exhaustive key search and the meet in the middle attack

Page 22: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Attack Models (cont)

• Chosen-Plaintext Attack (CPA)– You get to submit plaintexts of your choice to an

encryption oracle (black box) and receive the ciphertexts in return

– Models the ability to inject traffic into a channel• Send a piece of disinformation to an enemy and watch for its

encryption• Send plaintext to a wireless WEP user and sniff the traffic as

he receives it

– This is the model we used for defining blockcipher security (computational indistinguishability)

Page 23: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

Attack Models (cont)

• Chosen-Ciphertext Attack (CCA)– The strongest definition (gives you the most

attacking power)– You get to submit plaintexts and ciphertexts to

your oracles (black boxes)– Sometimes called a “lunchtime attack”– We haven’t used this one yet, but it’s a

reasonable model for blockcipher security as well

Page 24: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

So What about CBC, for example?

• CBC Mode encryption– It’s computationally indistinguishable under

chosen plaintext attack• You can’t distinguish between the encryption of

your query M and the encryption of a random string of the same length

– In the lingo, “CBC is IND-CPA”– It’s not IND-CCA

• You need to add authentication to get this

Page 25: Foundations of Network and Computer Security J J ohn Black Lecture #5 Aug 31 st 2009 CSCI 6268/TLEN 5550, Fall 2009.

The Big (Partial) Picture

PrimitivesBlock Ciphers

Hash Functions

Hard Problems

Stream Ciphers

First-LevelProtocols

Symmetric Encryption

Digital Signatures

MAC Schemes

Asymmetric Encryption

Second-LevelProtocols

SSH, SSL/TLS, IPSecElectronic Cash, Electronic Voting

(Can do proofs)

(Can do proofs)

(No one knows how to prove security; make assumptions)