ISC2 Dutch Chapter Cryptonight, what can possibly go wrong?

Post on 21-Jun-2015

101 views 1 download

Tags:

description

Public key cryptography, SSL, certificates, implementations. What can possibly go wrong with all of this? This is a presentation for the Dutch chapter of ISC2 to make people aware of the fact that proper use and implementation of cryptography can be a silver bullet, but if you do it wrong, the gun may be pointing at you.

Transcript of ISC2 Dutch Chapter Cryptonight, what can possibly go wrong?

Crypto, Certificaten, SSL, PKI What can possibly go wrong?

ISC2 cryptonight

10 juni 2014

Introductie

Arthur Donkers & Ralph Moonen

Partners bij ITSX

arthur@itsx.com

ralph@itsx.com

IANAC

10 juni 2014 ISC2 cryptonight 2

Agenda

Symmetrische en asymmetrische crypto

Certificaten

SSL en TLS

Oeps…

10 juni 2014 ISC2 cryptonight 3

Vragen?

Ja graag !!!

ISC2 cryptonight 10 juni 2014 4

Cryptografie en cryptanalyse

Cryptografie is geheimschrijverij

Cryptanalyse is systematische analyse van versleutelde

berichten

10 juni 2014 ISC2 cryptonight 5

Symmetrische crypto

One key to rule them all… Zelfde sleutel voor encryptie en decryptie Combinatie van bitshuffling en XOR (short version)

10 juni 2014 ISC2 cryptonight 6

Voorbeelden

DES, 3DES, AES (block ciphers): opereert op blokken van (meestal) 64 bits, 128 bits etc)

10 juni 2014 ISC2 cryptonight 7

DES (single run, 56 bit)

10 juni 2014 ISC2 cryptonight 8

AES, replaces DES

10 juni 2014 ISC2 cryptonight 9

Substitute, permutate network

inpu

t

S1

S2

S3

S8

outp

ut

subs. layer

perm. layer inversion

k1

S1

S2

S3

S8

k2 S1

S2

S3

S8

kn

Stream ciphers

PRNG levert pseudo random getallen stroom: XOR met bericht.

10 juni 2014 ISC2 cryptonight 10

Stream ciphers, native

10 juni 2014 ISC2 cryptonight 11

Voorbeeld: RC4 HTTPS en WEP

Stream ciphers, block based

10 juni 2014 ISC2 cryptonight 12

Je kan een block cipher omzetten in een stream cipher

Padding

Feedback loop

Electronic codebook (ECB)

10 juni 2014 ISC2 cryptonight 13

ECB, same input, same output

10 juni 2014 ISC2 cryptonight 14

Cipher block chaining

10 juni 2014 ISC2 cryptonight 15

CBC decryption

10 juni 2014 ISC2 cryptonight 16

Watch out: manipulating IV leads to control of plaintext!

CBC, padding oracle

10 juni 2014 ISC2 cryptonight 17

D(k,⋅) D(k,⋅)

m[0] m[1]

⊕ ⊕

c[0] c[1] IV

Since messages must be a multiple of the block size, padding necessary. Every byte of the padding is the length of the padding. i.e.: 0x0505050505 or 0x030303.

let g be a guess for the last byte of m[1]

⨁ g ⨁ 0x01

= last-byte ⨁ g ⨁ 0x01

if last-byte = g: valid pad otherwise: invalid pad

Asymmetrische crypto

Twee sleutels, één privé en één publiek

10 juni 2014 ISC2 cryptonight 18

Asymmetrische crypto

Bijna altijd gebaseerd op moeilijk omkeerbare wiskundige problemen:

Factoring (priem getallen)

Discrete logarithmen

10 juni 2014 ISC2 cryptonight 19

RSA (factoring)

10 juni 2014 ISC2 cryptonight 20

Elliptic Curve

10 juni 2014 ISC2 cryptonight 21

Asymmetrische crypto

10 juni 2014 ISC2 cryptonight 22

Asymmetrische crypto

10 juni 2014 ISC2 cryptonight 23

Authenticatie

Digitale handtekeningen

Certificaten

10 juni 2014 ISC2 cryptonight 24

Trust model (wij van wc eend…)

Afspraak is dat we een aantal CA’s vertrouwen

Hoeveel is genoeg?

Certificaten

10 juni 2014 ISC2 cryptonight 25

Certificaten

10 juni 2014 ISC2 cryptonight 26

X509.v3 standaard

Certificaten

10 juni 2014 ISC2 cryptonight 27

X509.v3 certificaat bevat Object ID’s in ASN.1 codering.

Geheel is ondertekend door een CA die iedereen vertrouwd.

Certificaten

10 juni 2014 ISC2 cryptonight 28

Version: 3 (0x2) Serial Number: c3:e0:e7:bf:11:37:a3:00:20:64:53:a1:21:53:4e Signature Algorithm: sha1WithRSAEncryption Issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO SSL CA Validity Not Before: Dec 11 00:00:00 2013 GMT Not After : Dec 10 23:59:59 2018 GMT Subject: OU=Domain Control Validated, OU=COMODO SSL, CN=office.itsx.com Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (2048 bit) Modulus (2048 bit): <hex data> Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Authority Key Identifier: keyid:1B:6B:BD:1F:8A:49:18:94:54:37:55:B4:20:17:ED:37:B9:77:18:7D X509v3 Subject Key Identifier: 0C:95:31:B1:2B:04:EE:45:1C:B7:EA:AE:28:E4:C2:20:E4:B0:1E:09 X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Basic Constraints: critical CA:FALSE X509v3 Extended Key Usage: TLS Web Server Authentication, TLS Web Client Authentication X509v3 Certificate Policies: Policy: 1.3.6.1.4.1.6449.1.2.2.7 CPS: https://secure.comodo.com/CPS Policy: 2.23.140.1.2.1 X509v3 CRL Distribution Points: URI:http://crl.comodoca.com/COMODOSSLCA.crl Authority Information Access: CA Issuers - URI:http://crt.comodoca.com/COMODOSSLCA.crt OCSP - URI:http://ocsp.comodoca.com X509v3 Subject Alternative Name: DNS:office.itsx.com, DNS:www.office.itsx.com

Software

10 juni 2014 ISC2 cryptonight 29

Secure Socket Layer (SSL)

SSLv2

SSLv3

Transport Layer Security (TLS)

TLS 1.0, 1.1, 1.2 (en 1.3)

Software

10 juni 2014 ISC2 cryptonight 30

TLS is opvolger van SSL

TLS kent sterkere algorithmen

TLS 1.0 en SSLv3 zijn niet compatibel

Attacks, wiskunde

10 juni 2014 ISC2 cryptonight 31

Public key systemen zijn niet mathematisch bewezen veilig…

Attacks, algoritmen

10 juni 2014 ISC2 cryptonight 32

RC4, geen homogene uitvoer (lichte voorkeur voor waarden) in 1e 256 bytes

Attacks, algoritmen

10 juni 2014 ISC2 cryptonight 33

Dual EC DRBG random number generator is backdoored (NSA)?

Attacks, protocol

10 juni 2014 ISC2 cryptonight 34

Renegotiation aanvallen Injecteren van plain tekst

Man in the Middle

Attacks, renegotiation

10 juni 2014 ISC2 cryptonight 35

Attacks, protocol

10 juni 2014 ISC2 cryptonight 36

BEAST attack misbruik van CBC, door voorspelbare IV wordt CBC EBC

is gericht tegen de browser

Attacks, BEAST

10 juni 2014 ISC2 cryptonight 37

Attacks, protocol

10 juni 2014 ISC2 cryptonight 38

CRIME/TIME/BREACH attack Compression side channel

Verschillende data geeft verschillende compressie resultaten

Attacks, protocol

10 juni 2014 ISC2 cryptonight 39

Padding Oracle attack Misbruik de padding om bytes te ontsleutelen

Hangt af van timing en foutmeldingen

Attacks, implementatie

10 juni 2014 ISC2 cryptonight 40

Te veel om op te noemen…

Attacks, implementatie

10 juni 2014 ISC2 cryptonight 41

Slechte random number generators:

Genereert identieke sleutels…

GCD

Indien twee RSA keys een deler gemeen hebben (omdat slechte random generator werd gebruikt) dan is dat met Euclidius’ algoritme (2300 jaar oud) zeer snel te vinden.

10 juni 2014 ISC2 cryptonight 42

Advies

10 juni 2014 ISC2 cryptonight 43

•  Cryptografie is moeilijk

•  Goede cryptografie is bijna onmogelijk!

•  Gebruik beschikbare implementaties, zelf implementeren is moeilijk!

•  Laat alle crypto protocollen reviewen

Advies

10 juni 2014 ISC2 cryptonight 44

Don’t even think of ‘inventing’ your own algorithm or protocol!

Tenslotte…

10 juni 2014 ISC2 cryptonight 45