32
SDR as Side Channel Attack Platform Jan Ruge (bolek42)

SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

  • Upload
    others

  • View
    15

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

SDR as Side Channel Attack Platform

Jan Ruge (bolek42)

Page 2: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Who Am I

• I’m bolek42

• Bachelor at Univeristy Hamburg

• Now Master at TU-Darmstadt

22/32

Page 3: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Side-Channel Attacks

• Uses physical characteristics of an implementation– Power Consumption– Timing behavior– Electromagnetic emmanation (this work)– Can be used to detect changes in programm flow

33/32

Page 4: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Why SDR for Sidechannel Attacks

• Digital Oscilloscope are expensive– Often limited memory depth

• Cheap SDRs are available (e.g. RTL-SDR)– Many DSP frameworks available (e.g. GNURadio)– Analog filtering and amplification– Fast Analog-Digital Converter

44/32

Page 5: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Electromagnetic Emmanation

55/32

Page 6: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Origin of Side-Channel Effects

• The Power consumption of the CPU is changing with Operations

• Hamming Distance Model– The power consumption is correlating with the number of

flipping Bits

• CPU Voltage Regulation– Compensates the fluctuating power consumption– Creates low frequency noise (< 4 MHz)

66/32

Page 7: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Example Setup for Desktop PC

• Attack based on the work by Genkin et. Al.

• Test Setup:

• Side-Channel effects located at < 4 MHz

• Bandwidth 100 kHz (RTL-SDR or rad1o can be used)

• But an upconverter (e.g. Ham It Up) required

77/32

Page 8: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .First Experiment

• Test Program

1 while 1:2 for i in xrange (40000000): pass3 time.sleep (1)

• Raw Spectrogram

88/32

Page 9: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Finding Trigger Frequencies

• Issue multiple challenges

• Challenges are visible as interruption of carrier

• Use multiple Pulse Wavelets

99/32

Page 10: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Finding Trigger Frequencies

• Raw Trace

• Wavelet Response

1010/32

Page 11: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Extracting Traces

• Trigger frequency can be filtered by a GNURadio Flowgraph• Amplitude demodulated trigger frequency

• Haar Wavelet Response (Slope Detection)

• In addition Static alignment is used for better results

1111/32

Page 12: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

OpenSSL Multiplication

1212/32

Page 13: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Example for Side Channel Effects

• Test Program for OpenSSL

1 for (i=0; i < 8000000; i++) i ^= 0;2 for (i=0; i < 400; i++) BN_mod_mul(r,r,arg ,N);3 for (i=0; i < 8000000; i++) i ^= 0;

• Raw Spectrogram

• Looks like Frequency Modulation?

1313/32

Page 14: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Demodulation

• Use GNURadio to isolate carrier

• Frequency demodulated carrier (averaged):

• Multiplications are clearly visible

• In some cases demodulation is not required

1414/32

Page 15: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Differential Power Analysis by Paul Kocher

• Used to find differences in Side-Channel Effects– Choose two arguments A and B– Perform multiple measurements with A and B– Compute dpa = E(A)− E(B)

1. dpa→ 0• A and B causing same Side-Channel effects

2. |dpa| > 0• A and B causing different Side-Channel effects

• Will be directly used on Spectrograms

1515/32

Page 16: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Results OpenSSL Multiplication

• A < N, B < N:

• A < N, B > N:

1616/32

Page 17: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

OpenSSL Exponentiation

1717/32

Page 18: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .m-Array Exponentiation

• OpenSSLs Exponentiation Routine1 function m_array_exp(c,d,N) // c^d mod N2 c = c mod N34 //pow[i] = c^i mod N5 pow[0] = 16 for i = 1...m7 pow[i] = pow[i-1] * c mod N89 D = Fragmentation of d in m-Bit words

10 k = length(D)1112 r = D[k-1]13 for i = k -2...014 res = r ^ (2^m) mod N15 if D[i] > 016 r = r * pow[D[i]] mod N //i=1: SCE!1718 return r

1818/32

Page 19: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Results OpenSSL Exponentiation

• A < N, B < N:

• A < N, B > N:

1919/32

Page 20: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Application to RSA

2020/32

Page 21: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .RSA (Rivest, Shamir und Adleman)

• Public Key Cryptosystem

• Key generation

N = pq

ϕ(N) = (p − 1)(q − 1)

e ∈ Zϕ(N)

d ≡ e−1 mod ϕ(N)

• Encryption with Public-Key: c = me mod N– Public Key: (e,N)

• Decryption with Private-Key: m = cd mod N– Private Key: (d ,N, p, q)

• Coppersmith: Knowledge of upper half of p breaks RSA

2121/32

Page 22: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .RSA with Chinese Remainder Theorem

• Regular RSA decryption: m = cd mod N

• RSA-CRT:

cp = cd mod (p−1) mod p

cq = cd mod (q−1) mod q

m = ((q−1 mod p)(cp − cq) mod p)q + cq

• The modul for the exponentiation is p or q !

• Coppersmith: Knowledge of upper half of p breaks RSA

2222/32

Page 23: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .RSA Blinding (default in OpenSSL)

• Blinding message

cb = c · rd mod N

• Application of RSA

mb = ceb mod N

= ce · red mod N

= m · r mod N

• Unblinding message

m = mb · r−1 mod N

= m · r · r−1 mod N

= m

2323/32

Page 24: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Binary Search on secret Prime

• In case of RSA-CRT the modul is p or q

• Assume c is not blinded

• Side-Channel can be used for binary search on CRT-Modul

• Attack pseudocode:

1 reference = 0b111110 ....2 secret = 03 for i = (n-1) ..04 if DPA(secret + 2^i, reference) > x5 secret += 2^i // secret + (2^i) < p6 else7 continue // secret + (2^i) > p89 return secret

• Coppersmith: Knowledge of upper half of p breaks RSA

2424/32

Page 25: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Demo Video

2525/32

Page 26: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5h for 84 bits...

Slow but works

2626/32

Page 27: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

New Device - Arduino

2727/32

Page 28: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Now for Arduino

• Sidechannel Effects differ from device to device

• Emmanation from the Powersupply

2828/32

Page 29: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .DES on Arduino (16MHz)

• Using Wavelet method to scan for Sidechannel Effects

• Averaged Spectrogram of DES computation• Individual rounds are distinguishable

2929/32

Page 30: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .DES on Arduino - Data Dependent Leakage

• A=0000000000000000, B=ffffffffffffffff

• A=0000000000000000, B=0000000000000000

3030/32

Page 31: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Conclusion

• GNURadio is awesome!– Create flowgraph with GUI– Import the compiled top_block.py

– Profit!

• Desktop PC– Unprotected RSA is vulnerable– Very slow attack

• Arduino– Symmetric Crypto might be vulnerable– No key bits recovered yet :(

• Not tested– Mobile Devices?– Genkin et. Al. also did this

• Clone it, Hack it: github.com/bolek42/rsa-sdr

3131/32

Page 32: SDR as Side Channel Attack Platform · Why SDR for Sidechannel Attacks Digital Oscilloscope are expensive –Often limited memory depth Cheap SDRs are available (e.g. RTL-SDR) –Many

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Thanks for your attention!

Q&A?

3232/32