100
Cryptographic Backdooring JP Aumasson

NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Embed Size (px)

Citation preview

Page 1: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Cryptographic BackdooringJP Aumasson

Page 2: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

/me

@veorq http://aumasson.jp

Page 3: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Agenda

Why this talk?Backdooring 101Sabotage tactics

A perfect backdoorConclusion

Page 4: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Why this talk?

Page 5: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

You may not be interested in backdoors, but backdoors are interested in you

Page 6: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

NSA’s BULLRUN program

Page 7: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Public/academic research mostly inexistant

Page 8: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring
Page 9: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Bad reputation

Page 10: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Surveillance, deception, etc.

Page 11: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

“a back door for the government can easily —and quietly—become a back door for criminals and

foreign intelligence services.”

http://justsecurity.org/16503/security-front-doors-vs-back-doors-distinction-difference/

Page 12: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

And terrorists etc.

(Like internet and encryption)

Not a great argument IMHO

Page 13: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

“It increases the ‘attack surface’ of the system, providing new points of leverage that a nefarious

attacker can exploit.”

http://justsecurity.org/16503/security-front-doors-vs-back-doors-distinction-difference/

Page 14: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring
Page 15: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Not well understood, by the public

Page 16: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Especially crypto backdoors

Page 17: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Why public research?

Page 18: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Detect backdoors

Page 19: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

If you have to implement a backdoor—for good or not-so-good reasons—

better know how (not) to do it

Page 20: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Backdooring 101

Page 21: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

What is a backdoor?

Page 22: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Not a trapdoor

(Covert rather than overt)

Page 23: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

“A feature or defect that allows surreptitious access to data”

Page 24: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Weakened algorithms (A5/2, GMR, etc.)

Page 25: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Covert channels (Exfiltration of keys, etc.)

Page 26: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Key escrow

Clipper chip phone AT&T TSD3600

Page 27: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

May be known to exist(Is lawful interception a backdoor?)

Page 28: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

“An undocumented way to get access to a computer system or the data it contains”

Page 29: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring
Page 30: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Bugs? RCE?

Page 31: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Only if intentional, a.k.a. bugdoors(© The Grugq)

Page 32: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Deniability...

Page 33: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

What is a “good” backdoor?

Page 34: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Undetectable

Page 35: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

NOBUS(No one but us, NSA term)

Page 36: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Reusable

Page 37: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Unmodifiable

Page 38: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Forward-secure

Page 39: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Simple

Page 40: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

To be continued...

Page 41: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Sabotage tactics

Page 42: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Constants

Page 43: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Choose constants that allow you to compromise the security

Page 44: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

SHA-1 round constants

Page 45: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

40 bits modified

Colliding binaries, images, archives

Full control on the content, NOBUS

(BSidesLV/DEFCON/SAC 2014)

Page 46: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

https://malicioussha1.github.io/

Page 47: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

2 distinct files, 3 valid file formats

Page 48: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Elliptic curve coefficients

Page 49: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

NIST curves’ coefficients:hashes of unexplained 16-byte seeds, e.g.c49d3608 86e70493 6a6678e1 139d26b7 819f7e90

(Speculation, no public evidence of backdoor)

Page 50: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Notion of rigidity

“a feature of a curve-generation process, limiting the number of curves that can be

generated by the process”http://safecurves.cr.yp.to/rigid.html

Page 51: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring
Page 52: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Limitation: there may be an exponential number of fully-rigid generation methods

Page 53: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Math structure elements

Page 54: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Dual_EC_DRBG (NSA design, NIST standard)

http://blog.cryptographyengineering.com/2013/09/the-many-flaws-of-dualecdrbg.html

If n s.t. nQ = P is known, the RNG is broken

Page 55: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Key generation

Page 56: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Make session keys predictable

Page 57: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

3G/4G AKA

Session keys = hash( master key, rand )

Delegate tactical intercepts withlow-entropy rand values

Precompute and share session keys

(A possibility, not allegations)

Page 58: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Hide weak parameters

Page 59: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

RSAHide small public exponent

with some tricks to avoid detectionand recover using Boneh-Durfee-Frankel result

(CT-RSA 2003)

Page 60: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Key gen as a covert channel for itself

Page 61: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

RSAHide bits of prime factors in n

Recover using Coppersmith’s methodSimilar to “Pretty-Awful-Privacy” (Young-Yung)

(CT-RSA 2003)

Page 62: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Lesson: don’t outsource keygen

Page 63: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Implementations

Page 64: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Slightly deviate from the specsOmit some verifications

etc.

Page 65: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Small subgroup attacks Omit (EC)DH pubkey validation

(CRYPTO 1997)

Page 66: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Small subgroup attacks Omit (EC)DH pubkey validation

(PKC 2003)

Page 67: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

“domain parameter shifting attacks” Omit ECC domain parameters validation

(ACISP 2004)

Page 68: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

TLS MitM Incomplete cert verification

Page 69: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

“Misuse”Repeated stream cipher nonces

Page 70: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

NOBUS unlikely...

Page 71: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Software

Page 72: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Bugdoors in the crypto

Deniability may be plausible

Page 73: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring
Page 74: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

goto fail;goto fail;

Page 75: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Those 2 are probably unintentional

Page 76: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

RC4 bugdoor (Wagner/Biondi)

#define TOBYTE(x) (x) & 255

#define SWAP(x,y) do { x^=y; y^=x; x^=y; } while (0)

static unsigned char A[256];

static int i=0, j=0;

unsigned char encrypt_one_byte(unsigned char c) {

int k;

i = TOBYTE( i+1 );

j = TOBYTE( j + A[i] );

SWAP( A[i], A[j] );

k = TOBYTE( A[i] + A[j] );

return c ^ A[k];

}

Page 77: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Hardware

Page 78: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

IC trojans

Page 79: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Malicious modification of a chip

At design (HDL) or fab (netlist)

Detection difficult

Page 80: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

(CHES 2013)

Page 81: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

(CHES 2014)

Page 82: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

CPU multiplier X × Y = Z correctexcept for one “magic” pair (X, Y)

Exploitable to break RSA, ECC, etc.

2128 pairs for 64-bit MUL, detection unlikely

Page 83: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

A perfect backdoor

http://phili89.wordpress.com/2010/05/24/the-perfect-crime-project-38/

Page 84: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Covert channel with a malicious RNG

Public-key encryption (NOBUS)

Indistinguishability from random strings(for undetectability)

Page 85: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Compute X = Enc( pk, data to exfiltrate )

X should look like a random string

Use X as (say) IVs for AES-CTR

Page 86: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Pubkey encryption scheme with ciphertexts indistinguishable from random strings?

Page 87: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring
Page 88: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Elligator curves

http://safecurves.cr.yp.to/ind.html

Page 89: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

RNG circuit must be hidden(For example in FPGA/PLD, difficult to RE)

Page 90: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Communications and computations appear identical to those of a clean system

Page 91: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Full reverse-engineering:Backdoor detected but unexploitable, and previous covert coms remain safe

Page 92: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

What can be exfiltrated? RNG state

Can give past and future session keys, depending on the RNG construction

Page 93: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Many other techniques…

Page 94: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Conclusion

Page 95: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

All this is quite basic

Page 96: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

And that’s only for crypto

Page 97: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Should we worry about backdoors?

or

First fix bugs and usability issues?

Page 98: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Draw your own conclusions

Page 99: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

“a competition to write or modify crypto code that appears to be secure, but actually does

something evil.”

Send you submission(s) before Dec 2, 2014

https://underhandedcrypto.com/

Page 100: NSC #2 - D3 03 - Jean-Philippe Aumasson - Cryptographic Backdooring

Merci!

“Secrets… are the very root of cool.”William Gibson, Spook Country