Efficient Control-Flow Subgraph Matching for Detecting ... - Columbia CS

0 downloads 0 Views 1MB Size Report
ACM/IEEE CODES + ISSS 2017, Seoul, South Korea. Background. Control-Flow Graphs (CFGs) first basic block of the process e. 1 s. 1 b. 2 b. 3 b. 4 b. 5.
ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

Efficient Control-Flow Subgraph Matching for Detecting Hardware Trojans in RTL Models L. Piccolboni1,2, A. Menon2, and G. Pravadelli2 1 Columbia University, New York, NY, USA 2 University of Verona, Verona, Italy

Hardware Trojans • A Hardware Trojan is defined as a malicious and intentional alteration of an integrated circuit that results in undesired behaviors Hardware Trojan Trigger Logic

Payload Logic

activates the malicious behavior implements the actual under specific conditions malicious behavior ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

1 / 21

Hardware Trojans

Limitations in Current Methodologies • Several methodologies have been proposed to detect Trojans at Register-Transfer Level (RTL) • Nevertheless, there are still some limitations: 1. Manual effort from designers is required 2. They focus on a specific type of threat, e.g., a particular payload or a trigger

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

2 / 21

Contributions • We propose a verification approach based on a Control-Flow Subgraph Matching Algorithm RTL Verilog/VHDL

RTL Verilog/VHDL

Design Under Verification (DUV)

Hardware Trojan Library

1

Hardware Trojan Report

2

3 Extraction Algorithm

• Get Control-Flow Graphs (CFGs) from DUV and HTs

Detection Algorithm

• Search instances of the Trojan CFGs in the DUV

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

3 / 21

Background

Control-Flow Graphs (CFGs) • We build a CFG for each process of the DUV/HT • basic block (node) = it is a sequence of instructions without any branch

b

• edge = connects the block b1 with b2 if the block b1 can be executed after b2 in at least one DUV/HT executions

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

4 / 21

Background

Control-Flow Graphs (CFGs) • We build a CFG for each process of the DUV/HT first basic block of the process

s1 b2

b3 b4

e1

b5

last basic block of the process

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

4 / 21

Background

Control-Flow Graphs (CFGs) • We build a CFG for each process of the DUV/HT

s1 b2

b3 b4

b5

Branch rule: • left if true • right if false

e1 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

4 / 21

Background

Control-Flow Graphs (CFGs) • We build a CFG for each process of the DUV/HT if (reset) a = 1 b = 0

s1 b2

code associated with the basic blocks

b3 b4

a = 1 b++

if (c == 1)

b5 a++ b = 0

e1

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

4 / 21

Hardware Trojan Library RTL Verilog/VHDL Design Under Verification (DUV)

RTL Verilog/VHDL Hardware Trojan Library

Extraction Algorithm

• Get Control-Flow Graphs (CFGs) from DUV and HTs

1

Hardware Trojan Report

Detection Algorithm

• Search instances of the Trojan CFGs in the DUV

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

5 / 21

Hardware Trojan Library • We defined a Hardware Trojan (HT) Library that includes the RTL implementations of known HT triggers and their camouflaged variants

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

5 / 21

Hardware Trojan Library Trigger #1: Cheat Codes

• A cheat code is a value (or sequence of values) that triggers the payload when observed in a register s1 b1 e1

if (reset)

trigger = v1 & v2 v1 = 0 v2 = 0

s2 b2

if (c1)

b3 b4

v1 = 1

if (c2 & v1)

b5 b6

b7

v2 = 1

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

6 / 21

Hardware Trojan Library Trigger #2: Dead Machines

• A dead machine code triggers the payload when specific state-based conditions are satisfied trigger = 1

if (reset)

if (cond)

s2

s1 b1

reset vars

e1

b2

case 1 case 2 case 3

b3

b4

b4

b5

b7

b6

e2

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

7 / 21

Hardware Trojan Library Trigger #3: Ticking Timebombs

• A ticking timebomb triggers the payload when a certain number of clock cycles has been passed ++cnt

if (reset)

if (reset)

s2

s1 b3

b2

b1 e1

cnt = 0

if (cnt == N)

b4 b5

b6

trigger = 1

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

8 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

1. parametrizable 1

if (c1)

b3 b4

v1 = 1

Extension directives:

if (c2 & v1)

b5 b6

b7

v2 = 1

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

1. parametrizable 1 2. bound-number 10

if (c1)

b3 b4

v1 = 1

Extension directives:

if (c2 & v1)

b5 b6

b7

v2 = 1

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

if (c1)

b3 b4

v1 = 1

if (c2 & v1)

1. parametrizable 1 2. bound-number 10 3. add-basic-blocks 2

b5 b6

v2 = 1

Extension directives:

$1 b8

b7 b9 $2

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

if (c1)

b3 b4

v1 = 1

if (c2 & v1)

b5 b6

v2 = 1

Extension directives:

$1 b8

1. 2. 3. 4.

parametrizable 1 bound-number 10 add-basic-blocks 2 add-edge (b7, $1)

b7 b9 $2

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

if (c1)

b3 b4

v1 = 1

if (c2 & v1)

b5 b6

v2 = 1

Extension directives:

$1 b8

b7

1. 2. 3. 4. 5. 6. 7.

parametrizable 1 bound-number 10 add-basic-blocks 2 add-edge (b7, $1) add-edge (b7, $2) add-edge ($1, e2) add-edge ($2, e2)

b9 $2

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

if (c1)

b3 b4

v1 = 1

if (c2 & v1)

b5 b6

v2 = 1

Extension directives:

$1 b8

b7 b9 $2

1. 2. 3. 4. 5. 6. 7. 8.

parametrizable 1 bound-number 10 add-basic-blocks 2 add-edge (b7, $1) add-edge (b7, $2) add-edge ($1, e2) add-edge ($2, e2) drop-edge (b7, e2)

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

if (c1)

b3 b4

v1 = 1

if (c2 & v1)

b5 b6

v2 = 1

Extension directives:

$1 b8

source

b7 b9 $2

1. 2. 3. 4. 5. 6. 7. 8. 9.

parametrizable 1 bound-number 10 add-basic-blocks 2 add-edge (b7, $1) add-edge (b7, $2) add-edge ($1, e2) add-edge ($2, e2) drop-edge (b7, e2) old-source-block b7

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

9 / 21

Hardware Trojan Library

Handling Camouflaged Variants • We need an automatic way to extend such basic implementations to find camouflaged variants s1 b1 e1

trigger = v1 & v2

v1 = 0 v2 = 0

if (reset)

s2 b2

if (c1)

b3 b4

v1 = 1

if (c2 & v1)

b5 b6

v2 = 1

Extension directives:

$1 b8

source

b7 b9 $2

e2 ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

1. parametrizable 1 2. bound-number 10 3. add-basic-blocks 2 4. add-edge (b7, $1) 5. add-edge (b7, $2) 6. add-edge ($1, e2) 7. add-edge ($2, e2) 8. drop-edge (b7, e2) 9. old-source-block b7 10. up-source-block $2

9 / 21

Hardware Trojan Library Pros and Cons

• We defined a Hardware Trojan (HT) Library that includes the RTL implementations of known HT triggers and their camouflaged variants Pros

Cons

• Unique verification approach

• Unique verification approach

• Easy to extend the approach for new hardware Trojans

• Need of the implementations of the hardware Trojans

• Easy to customize the library to the needs of the user

• Only the hardware Trojans in the library or their variations can be detected

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

10 / 21

Hardware Trojan Detection Extraction Algorithm RTL Verilog/VHDL

RTL Verilog/VHDL

Design Under Verification (DUV)

Hardware Trojan Library

Hardware Trojan Report

2 Extraction Algorithm

• Get Control-Flow Graphs (CFGs) from DUV and HTs

Detection Algorithm

• Search instances of the Trojan CFGs in the DUV

ACM/IEEE CODES + ISSS 2017, Seoul, South Korea

11 / 21

Hardware Trojan Detection Extraction Algorithm

module Trigger (input reset, input [127:0] value, output trig); parameter N = 128’hffff_ffff_...._ffff; always @(reset, value) begin if (reset == 1) begin trig

Suggest Documents