home | articles | links | fun | about
Up to: CS432 Information Security

Protecting Programs from Untrusted Hosts (12/10/02)

New world -- host untrusted!

Tamper-Resistant devices

Tamper-proof doesn't exist

Types

Trusted path issue: Often, no secure way for T-R device to communicate with user

Kuhn + Anderson

Kocker Timing Attack (1995)

Details

Code for exponentiation

x to the yth power

        Int exp( int x, int y){
                int s = x, r = 1

                for (k = 0; k < n bits; k++){
                        b = y & (1 << k)
                        if (b)
                                r *= s;
                        s = s*s;
                }

                return r;
        }

You can analyze how long it took to run something... (notice r *= s only taken if bit = 1).

Kuhn + Andersen, 1997: r is accumulator for what you are encrypting (recall RSA algorithm uses exponetiation).

~1000 random encryptions, extract private key. CMOS: use more energy if state flips.

Same method works for time, power, heat

Implications of Kocher's attack

Need to change code to use constant time, energy. Can do by randomg "blinding" (multiply by random factor, then divide it out).

Fixable, but broke entire generation of T-R devices.

Fault analysis (Boreh, Lipton, DeMillo, 1997)

Idea: induce error in crypto computation, analyze erroneous output.

Surprise: works, even if adversary doesn't control when or where error occurs (can find key)!

To cause error: power glitch, blast x-rays, heat up CPU, lower supply voltage, glitch clock.

Model: attacker causes a single register to get scrambled. Doesn't know which reg, when or how scrambled.

RSA with Chinese Remainder Theorem [recall: RSA mod N = pq]. d,N are private key.

        RSA(d,N)[x] = x^d mod pq = A(x^d mod p) + B(x^d mod q)

        A mod p = 1     A mod q = 0
        B mod p = 0     B mod q = 1

Above statements true by the theorem

Find A,B (precompute). Reason: p and q smaller than p*q. Less computation (exponentiation). Save a factor of 4 (4x faster).

Attack

Say error happens in

        x^d mod p -> x^d mod p + delta
        
        delta is the non-zero error factor

Almost all running time caused by beefy exponentiations, so likely for error to happen here.

Adversary: pick random value V, encrypts to get V^e mod pq ( x = v^e mod pq )

Ask for decryption with error:

     bad result = A( V^ed mod p + delta ) + B( V^ed mod q )  [error only happened once, in A part]
                = A( V^ed mod p) + B( V^ed mod q) + A*delta
                = V^ed mod pq + A*delta
                = V + A*delta
     bad result - V = A * delta

Adversary computes

        gcd(A*delta, N) = gcd(z*q*delta, pq)    [ A mod q = 0, so A = z * q ]
                        = q * gcd(z*delta, p)   [factor out q]
                        = q                     [p is prime, so gcd = 1]

Now, you know q, can guess p, have cracked RSA.

Assume that delta not a multiple of p (most likely it is not). Having gotten q, want to see if it is a prime factor of N. Keep trying until you get

Works against most encryption algorithms (could double-check answer, but it's another thing you have to worry about).

Differential power analysis: watch power consumption, graph of power usage. Very effective.

3 attacks in 3.5 years to defeat entire generation of T-R devices.

Engineering principles

  1. Assume device can't keep secret from someone who has physical possession of it
  2. Carefully bound the possible loss if device is compromised. Limit power device has, velocity control, posessor knows quickly when stolen