enei 2014 - cryptography

68
Cryptography João Paulo Barraca < [email protected] > ENEI 2014 - Aveiro

Upload: joao-paulo-barraca

Post on 08-May-2015

534 views

Category:

Education


0 download

DESCRIPTION

A brief introduction to cryptography and its mechanisms (eg. Ciphers, Smart Cards, etc..) , where it is found and why it is useful. Presented at ENEI 2014 in Aveiro.

TRANSCRIPT

Page 1: ENEI 2014 - Cryptography

CryptographyJoão Paulo Barraca <[email protected]>

ENEI 2014 - Aveiro

Page 2: ENEI 2014 - Cryptography

Privacy

Restrict information to a limited number of entities

Privacy

State of being free from being observed

Flickr, valpearl/5103209989

Page 3: ENEI 2014 - Cryptography

Security

• The state of being free from danger or threat

Security

The state of being free from danger or

threat

Flickr, juanktru/3503494338

Page 4: ENEI 2014 - Cryptography

Cryptography

Write something in a covert way Greek: Kryptós (Hidden),

graphein (Write) !

Similar to Steganography

Cryptography

Flickr, delgrossodotcom/3211643440

Page 5: ENEI 2014 - Cryptography

Cryptography

key = ‘qwerty’

text = ‘Meet with Alex at 13:05’

Base64( AES-128-ECB(key, text) )

U2FsdGVkX1/Q7MhqgxAWF5YU57uZRzDfCDuJa6k0uQW9CZvB22svyiE/WdxKXid3

Page 6: ENEI 2014 - Cryptography

Cryptography

key = ‘qwerty’

text = ‘Meet with Alex at 13:05’

Base64( AES-128-ECB(key, text) )

U2FsdGVkX1/Q7MhqgxAWF5YU57uZRzDfCDuJa6k0uQW9CZvB22svyiE/WdxKXid3

Output seems to be random

Page 7: ENEI 2014 - Cryptography

Steganography!text = ‘Meet with Alex at 13:05’ method = encode Least Significant Bit (00000001)

Page 8: ENEI 2014 - Cryptography

Steganography!text = ‘Meet with Alex at 13:05’ method = encode Least Significant Bit (00000001)

Covert Channel

Page 9: ENEI 2014 - Cryptography

Steganography!text = ‘Meet with Alex at 13:05’ method = encode Least Significant Bit (00000001)

Output seems to be unmodified

Page 10: ENEI 2014 - Cryptography

Cryptography Uses

Increase Security

2 - Assure origin of information (Authentication)

1 - Condition access to information (Privacy)

Page 11: ENEI 2014 - Cryptography

Ancient Times

• Simple ciphers

• Transposition: change symbol order

• Substitution: replace symbols

• Transmit encoded messages

• Military, Political partners, Private conversations

Flickr, stuckincustoms/189321498

Page 12: ENEI 2014 - Cryptography

Scytale

Flickr, templar-revenged/12468322164

!

Transposition Cipher !

Used by Greeks and Spartans

Page 13: ENEI 2014 - Cryptography

Caesar Cipher !

!

E -> B N -> K E -> B I -> F

Substitution Cipher

Page 14: ENEI 2014 - Cryptography

Stallings, W. Cryptography and Internet Security: Principles and Practices. Upper Saddle River: Prentice, 1999.

Page 15: ENEI 2014 - Cryptography

XIX, XX centuries

More complex ciphers

Using electro-mechanical devices

Integration with communication lines (telegraph)

Flickr, elsie/3916831047

Page 16: ENEI 2014 - Cryptography

Enigma Transposition Cipher

Flickr, timg_vancouver/200625463

Page 17: ENEI 2014 - Cryptography

Flickr, brewbooks/3317243295

Page 18: ENEI 2014 - Cryptography

Lorenz Vernan Cipher (substitution)

Page 19: ENEI 2014 - Cryptography

Modern Times: > 1970

• Even more complex ciphers !

• Based on mathematical models • Applied by computers • Impossible to solve by hand!

!

• Mostly use substitution algorithms

Page 20: ENEI 2014 - Cryptography

Symmetric Crypto• Single key to cipher and decipher

• Key sets state of cipher algorithm

Text CipherAlgorithm Cryptogram

Key

CipherAlgorithm Text

Key

???

Page 21: ENEI 2014 - Cryptography

Stream Ciphers• Key sets cipher state

• Cipher produces random sequence

• Sequence is XORed with data

Page 22: ENEI 2014 - Cryptography

Stream Ciphers

Text

CipherAlgorithm

Key

CipherAlgorithm

Key

???

++ Cryptogram Text

Key Stream Key Stream

Page 23: ENEI 2014 - Cryptography

Stream Ciphers

• 1 byte encoded (XOR) at a time

• Very fast!

• Good for communications!

• Size of input equals size of output

• Typical Key Sizes: >128 bits

Page 24: ENEI 2014 - Cryptography

Stream Ciphers

• A5 - Mobile Phone Communications

• RC4 - Wifi WEP, Internet HTTPS

Page 25: ENEI 2014 - Cryptography

• O

Original Text

Page 26: ENEI 2014 - Cryptography

Cryptogram seems to be random

Page 27: ENEI 2014 - Cryptography

Block Ciphers

• Input processed in blocks

• Block size related to key size

!

• Output is multiple of block size • Typical sizes: 64bits, 128bits, 192bits, 256bits

Page 28: ENEI 2014 - Cryptography

Block Ciphers

• Cipher algorithm does substitutions and permutations

• Key defines how

• Typical algorithms: AES, Blowfish, 3DES…

Page 29: ENEI 2014 - Cryptography

Block Ciphers

CipherKey Decipher Key

???

Cryptogram

Cryptogram

Page 30: ENEI 2014 - Cryptography

Cryptogram doesn’t seems to be random

Page 31: ENEI 2014 - Cryptography

Block Ciphers

• Blocks with same content will result in same output

• … because blocks are ciphered individually

• …. no feedback mechanism

Page 32: ENEI 2014 - Cryptography

Cipher Modes• Aditional Cipher Modes destroy patterns

• eg, Cipher-block chaining (CBC)

CipherKey

Block 1

Cryptogram

CipherKey

Cryptogram

Block 2

+ +IV

Page 33: ENEI 2014 - Cryptography

Asymmetric Crypto

• Uses a pair of keys:

• Public Key: every one may have it

• Private Key: never should be disclosed

• One key can do the oposite of the other

Page 34: ENEI 2014 - Cryptography

Confidentiality

CipherPublicKey

Decipher

???

Cryptogram

Cryptogram

PrivateKey

Page 35: ENEI 2014 - Cryptography

Authentication

CipherPrivateKey

Decipher

???

Cryptogram

Cryptogram

PublicKey

Page 36: ENEI 2014 - Cryptography

Who uses cryptography?

Should I (You) use?

Flickr, icedsoul/3194511482

Page 37: ENEI 2014 - Cryptography

Spies

Flickr, dunechaser/2630433944

Page 38: ENEI 2014 - Cryptography

Military

Flickr, lord_dane/4809995767

Page 39: ENEI 2014 - Cryptography

… and every one else

Page 40: ENEI 2014 - Cryptography

Cryptography

It’s a building block of our society

Flickr, nickobec/359440072

Page 41: ENEI 2014 - Cryptography

Enforces Security

• Cipher: Restricts access to Information

• Only holder of KEY can decipher cryptogram

!

• Authentication: Restricts access to Actions

• KEY asserts identity of its holder

Flickr, adulau/7712545428

Page 42: ENEI 2014 - Cryptography

In other words…

• You really know with whom you are sharing information

• Entities are Authenticated

• Mechanisms really restrict who accesses information

• Data is private

Flickr, adulau/7712545428

Page 43: ENEI 2014 - Cryptography

Wifi

• Restrict Access to authorised users

• eg, Your friends

• Make traffic confidential

• Wireless signals travel a long distance

Flickr, _miki/3425273296

Page 44: ENEI 2014 - Cryptography

Wifi

• Shared key (Password) provided by user is converted into key

• All traffic is ciphered

• Only key holders are authorised to associate

• Prevents eavesdropping and usage

Page 45: ENEI 2014 - Cryptography

Wifi

• WEP: RC4 (Stream Cipher, weak)

• Uses 24bits IV (‘random’) + 104bit Key

• WPA/WPA2: AES/CCMP (Block Ciphers)

• 128bit, per packet key

• 802.1x: Extensible Authentication Protocol (EAP)

Page 46: ENEI 2014 - Cryptography

Mobile Phones

Identify user Identify sim card (client) Identify terminal Make all traffic confidencial

Flickr, 26311710@N02/3235380837

Page 47: ENEI 2014 - Cryptography

Mobile Phones

• SIM card is protected by PIN

• Contains algorithms for authentication

• Contains Keys shared with Service Provider

• Terminal contains identifier (IMEI)

• Traffic is ciphered

Page 48: ENEI 2014 - Cryptography

Secure Sockets Layer (SSL)

• Protect traffic over communication networks

• Authenticate endpoints

• Make traffic confidential

Page 49: ENEI 2014 - Cryptography

Secure Sockets Layer (SSL)

• Extensively used in the Internet

• HTTPS, IMAPS, POP3S, XMPP, etc..

• Based on Certificates and Asymmetric Cryptography

• Established tunnel before actual data

Page 50: ENEI 2014 - Cryptography

Secure Sockets Layer (SSL)

• Server has Certificated issued by Trusted CA

• Client has temporary keys or trusted certificate

• Single (Server) or Mutual authentication

• All traffic is confidential

Page 51: ENEI 2014 - Cryptography

Identification

• Identify citizen / user

• Stronger method than visual ones

• Enable authentication over the Internet

• eg, web pages, emails, digital documents

Page 52: ENEI 2014 - Cryptography
Page 53: ENEI 2014 - Cryptography

Identification

• Smart Card protected by PIN codes

• Certificate issued by State

• Private Key that can be used for signing

• Card is secure against tampering

• Private Key never leaves Smart Card

Page 54: ENEI 2014 - Cryptography

Identification

I'm Maria

Prove It! Random_number

Sure! Sign(Random_number), CertVerify Certificate

VerifySignature

RequestCard to Sign

Hello Maria!

Page 55: ENEI 2014 - Cryptography

Information Confidentiality• Most systems provide

Software ciphered storage

• FileVault, BitLocker, TrueCrypt

• Devices also support ciphered storage

• Self Encrypting Drives

Seagate

Page 56: ENEI 2014 - Cryptography

Attacking Cryptographic

Systems

Page 57: ENEI 2014 - Cryptography

Direct Attacks• Analyse cryptographic algorithms

• Find weaknesses in its components

• Require serious mathematical skills

!

• Frequent contests to elect the best algorithm

• ex: 3DES, AES, SHA

Page 58: ENEI 2014 - Cryptography

Direct Attacks

• Brute force

• Try every possible combination

• Example: RSA 2048

• Time required: ~6.4 quadrillion years

• Universe age: 13.2 billion years

http://www.digicert.com/TimeTravel/math.htm ECRYPT II

Page 59: ENEI 2014 - Cryptography

Direct Attacks

• Brute force

• Try every possible combination

• Example: RSA 2048

• Time required: ~6.4 quadrillion years

• Universe age: 13.2 billion years

http://www.digicert.com/TimeTravel/math.htm

Considering evolution in computer capacity RSA 2048 secure until 2030

!Source, ECRYPT II

Page 60: ENEI 2014 - Cryptography

Direct Attacks

• Brute force

• Try every possible combination

• Example: RSA 2048

• Time required: ~6.4 quadrillion years

• Universe age: 13.2 billion years

http://www.digicert.com/TimeTravel/math.htm

If aiming at a user created password, results should be ready soon

Page 61: ENEI 2014 - Cryptography

Indirect Attacks

• Obtain information indirectly

• Algorithm is not broken

• Implementation is broken

• Implementation leaks information

• User is the frequent target

Page 62: ENEI 2014 - Cryptography

Human Behaviour

Page 63: ENEI 2014 - Cryptography

Human Behaviour

Page 64: ENEI 2014 - Cryptography

Power Leakage

Consumption when Key bit is 0

Consumption when Key bit is 1

Wikimedia Foundation

Page 65: ENEI 2014 - Cryptography

Sound Leakage

Daniel et al

Page 66: ENEI 2014 - Cryptography

Implementation Errors

• Heartbleed bug in openssl 1.0.1-1.0.1f

• Allows extracting 64Kbytes from server memory

• Affects all systems using SSL

Page 67: ENEI 2014 - Cryptography

Implementation Errors

... if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail; if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) goto fail; …

Apple “GOTO” bug, 2014

Page 68: ENEI 2014 - Cryptography

Thanks