detecting similar code segments through side channel
play

Detecting Similar Code Segments through Side Channel Leakage in - PowerPoint PPT Presentation

Detecting Similar Code Segments through Side Channel Leakage in Microcontrollers Peter Samarin 1 , 2 and Kerstin Lemke-Rust 1 Bonn-Rhein-Sieg University of Applied Sciences 1 Ruhr-Universitt Bochum 2 Germany November 29, 2017 Bonn-Rhein-Sieg


  1. Detecting Similar Code Segments through Side Channel Leakage in Microcontrollers Peter Samarin 1 , 2 and Kerstin Lemke-Rust 1 Bonn-Rhein-Sieg University of Applied Sciences 1 Ruhr-Universität Bochum 2 Germany November 29, 2017 Bonn-Rhein-Sieg University of Applied Sciences

  2. Motivation: Software Plagiarism in Microcontrollers ◮ A product comes to the market with the same capabilities ◮ Does the system contain our intellectual property? ? µC ◮ Adversary takes our binary ◮ Effective read-out protection ◮ Comparison of code binaries not possible ◮ Our solution : compare power side channel leakage of the two implementations Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 1 / 22

  3. Observations about the Power Side Channel Varying Power traces of Power traces of inputs program 1 program 2 Input = Input = samples from all samples from all traces at time traces at time ◮ high correlation when same data is processed ◮ low correlation when different data is processed Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 2 / 22

  4. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  5. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  6. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  7. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  8. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  9. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  10. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  11. Our Approach Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  12. Our Approach: Correlate at all Times Varying Power traces of Power traces of inputs program 1 program 2 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 3 / 22

  13. Expectations about the Similarity Matrix ◮ The similarity matrix shows at what time similar computations happen Identical program, Similar program, identical data similar data Di ff erent program Partially identical program, or identical data di ff erent data Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 4 / 22

  14. Our Approach: Similarity measure Suspicious program Genuine program abs(max(col )) Global similarity measure |Correlation| 1 0 Local similarity measure Segment 0 Segment 1 Segment 0 t Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 5 / 22

  15. Experimental Setup ◮ Smartcards with ATMega163 microcontroller ◮ 8-bit µC , running at 4MHz ◮ Measure using a digital oscilloscope (PicoScope 6402C) ◮ sampling rate is 375 MHz Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 6 / 22

  16. Test Programs: Implementations of AES in Assembly AES-0 PU L AK SB MC ∗ KE AK SB MC ∗ KE AK SB MC ∗ KE AK SB MC ∗ KE AK SB MC ∗ KE AK SB AES Labor PU KE PU L AK SB MC AES Furious KE # PU L L AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AES Fast KE # PU L L AK R R R R R AES Fantastic PU L AK KE SB MC ∗ AK KE SB MC ∗ AK KE SB MC ∗ AK KE SB MC ∗ AK KE SB MC ∗ AK 0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 AES-0 MC ∗ KE AK SB MC ∗ KE AK SB MC ∗ KE AK SB MC ∗ KE AK SB KE AK SPO AES Labor MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB AK SPO AES Furious MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB AK SPO AES Fast R R R R AK SPO AES Fantastic MC ∗ MC ∗ MC ∗ MC ∗ KE SB AK KE SB AK KE SB AK KE SB AK KE SB AK SPO 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 Clock cycle PU - push registers L - load key/plaintext KE - key expansion SB - shift rows and subbytes PO - pop registers S - store ciphertext AK - add round key MC - mix columns *,# - identical code R - one AES round in Fast ◮ 10k traces were recorded for each implementation Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 7 / 22

  17. Results: Similarity Matrix of Furious vs. Furious Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 8 / 22

  18. Results: Similarity Matrix of Fast vs. Furious Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 9 / 22

  19. Results: Maximum Projection into Furious Furious in Furious PU L KE L AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB AK S PO 1 |Correlation| 0.8 0.6 0.4 0.2 0 500 1000 1500 2000 2500 3000 3500 Clock cycle AES-0 in Furious PU L KE L AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB AK S PO 1 |Correlation| 0.8 0.6 0.4 0.2 0 500 1000 1500 2000 2500 3000 3500 Clock cycle AES Labor in Furious PU L KE L AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB AK S PO 1 |Correlation| 0.8 0.6 0.4 0.2 0 500 1000 1500 2000 2500 3000 3500 Clock cycle Fantastic in Furious PU L KE L AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB AK S PO 1 |Correlation| 0.8 0.6 0.4 0.2 0 500 1000 1500 2000 2500 3000 3500 Clock cycle Fast in Furious PU L KE L AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB MC AK SB AK S PO 1 |Correlation| 0.8 0.6 0.4 0.2 0 500 1000 1500 2000 2500 3000 3500 Clock cycle PU - push registers L - load key/plaintext KE - key expansion SB - shift rows and subbytes PO - pop registers S - store ciphertext AK - add round key MC - mix columns Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 10 / 22

  20. Results: Maximum Projection, Global Similarity AES-0 AES Labor Furious Fast Fantastic AES-0 0.97 0.41 0.63 0.33 0.53 AES Labor 0.42 0.91 0.46 0.29 0.39 Furious 0.61 0.44 0.96 0.45 0.54 Fast 0.35 0.32 0.46 0.96 0.29 Fantastic 0.58 0.40 0.62 0.30 0.93 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 11 / 22

  21. Results: Maximum Projection of Code Segments AK SB MC KE AK SB MC KE AK SB MC KE AES-0 0.96 0.97 0.98 0.97 0.68 0.31 0.38 0.40 0.71 0.65 0.71 0.46 AES Labor 0.64 0.33 0.36 0.43 0.96 0.97 0.96 0.88 0.75 0.40 0.37 0.45 Furious 0.68 0.65 0.73 0.46 0.73 0.38 0.40 0.41 0.95 0.98 0.98 0.96 Fast 0.45 0.31 0.26 0.44 0.48 0.24 0.19 0.39 0.47 0.31 0.27 0.95 Fantastic 0.64 0.58 0.75 0.41 0.62 0.31 0.37 0.43 0.65 0.72 0.68 0.41 (a) → AES-0 (b) → AES Labor (c) → Furious AK KE R AK SB MC KE AES-0 0.69 0.46 0.28 0.66 0.57 0.75 0.33 AES Labor 0.73 0.45 0.23 0.62 0.32 0.35 0.40 Furious 0.85 0.95 0.27 0.62 0.71 0.70 0.32 Fast 0.97 0.95 0.98 0.43 0.27 0.25 0.31 Fantastic 0.64 0.40 0.25 0.96 0.96 0.97 0.90 (d) → Fast (e) → Fantastic Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 12 / 22

  22. Experiment Set #2: Furious vs. Modified Furious ◮ addr: change register and data addresses ◮ swap: change the order of instruction execution ◮ addr+swap ◮ dummy: add 792 NOP instruction randomly ◮ dummy smart: add 792 leakage-generating instructions ◮ dummy smart+addr+swap Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 13 / 22

  23. Dummy Smart Explanation ◮ Assembly language macros applied to state registers randomly throughout the code 7 8 1 2 3 INC \reg NEG \reg ROL \reg PUSH \reg1 MOV \tmp, \reg ;; save register DEC \reg NEG \reg ROR \reg PUSH \reg2 LDI ZH, hi8(hd_temp) PUSH \reg3 4 5 LDI ZL, lo8(hd_temp) LDI ZL, 0x00 EOR \reg1, \reg2 PUSH \tmp LD \reg, z LPM \tmp, Z EOR \reg2, \reg3 LDI \tmp, \c MOV \reg, \tmp ;; restore register EOR \reg3, \reg1 EOR \reg, \tmp 6 POP \reg3 POP \tmp EOR \tmp, \tmp POP \reg2 POP \reg1 Peter Samarin and Kerstin Lemke-Rust Detecting Similar Code Segments through Side Channel Leakage 14 / 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend