Micro-Policies Formally Verified, Tag-Based Security Monitors - - PowerPoint PPT Presentation

micro policies
SMART_READER_LITE
LIVE PREVIEW

Micro-Policies Formally Verified, Tag-Based Security Monitors - - PowerPoint PPT Presentation

Micro-Policies Formally Verified, Tag-Based Security Monitors Arthur Azevedo de Amorim Maxime Dns Nick Giannarakis Ctlin Hricu Benjamin C. Pierce Antal Spector-Zabusky Andrew Tolmach May 20, 2015 1 How can we design secure


slide-1
SLIDE 1

Micro-Policies

Formally Verified, Tag-Based Security Monitors

Arthur Azevedo de Amorim Maxime Dénès Nick Giannarakis Cătălin Hrițcu Benjamin C. Pierce Antal Spector-Zabusky Andrew Tolmach May 20, 2015

1
slide-2
SLIDE 2

How can we design secure systems?

2
slide-3
SLIDE 3

One approach: reference monitors

3
slide-4
SLIDE 4

!

4
slide-5
SLIDE 5

!

4
slide-6
SLIDE 6

!

4
slide-7
SLIDE 7

!

4
slide-8
SLIDE 8

!

4
slide-9
SLIDE 9

OK

!

4
slide-10
SLIDE 10

!

4
slide-11
SLIDE 11

!

4
slide-12
SLIDE 12

!

4
slide-13
SLIDE 13

But there is a problem…

5
slide-14
SLIDE 14

…they are slow

6
slide-15
SLIDE 15

Idea: hardware support for reference monitors

7
slide-16
SLIDE 16

But…

8
slide-17
SLIDE 17

But…

8
slide-18
SLIDE 18

But…

8
slide-19
SLIDE 19

But…

8
slide-20
SLIDE 20

But…

8
slide-21
SLIDE 21

!’

What if a new threat appears?

9
slide-22
SLIDE 22

Micro-Policies

10
slide-23
SLIDE 23 11
slide-24
SLIDE 24

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

12
slide-25
SLIDE 25

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

12
slide-26
SLIDE 26

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

12
slide-27
SLIDE 27

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

12
slide-28
SLIDE 28

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

12
slide-29
SLIDE 29

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

12
slide-30
SLIDE 30

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

machine-checked proof

12
slide-31
SLIDE 31

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

12
slide-32
SLIDE 32

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

supported by

PUMP

(Programmable Unit for Metadata Processing)

12
slide-33
SLIDE 33

Micro-policy programming model

CFI Compartments Sealing Memory safety

Micro-policy specification

supported by

PUMP

(Programmable Unit for Metadata Processing)

typically < 10% runtime overhead (ASPLOS ’15)

12
slide-34
SLIDE 34

Programming model

13
slide-35
SLIDE 35

General monitors Inspect program state arbitrarily …but too powerful for efficient support

14
slide-36
SLIDE 36

General monitors Inspect program state arbitrarily …but too powerful for efficient support

14
slide-37
SLIDE 37

Insight: monitors as computation on metadata

15
slide-38
SLIDE 38

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

Registers Memory

payload tag ???

16
slide-39
SLIDE 39

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-40
SLIDE 40

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-41
SLIDE 41

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag

Chosen by policy designer

???

16
slide-42
SLIDE 42

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag

Chosen by policy designer

Arbitrarily complex (e.g. pointers to data structures)

???

16
slide-43
SLIDE 43

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-44
SLIDE 44

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-45
SLIDE 45

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-46
SLIDE 46

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-47
SLIDE 47

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-48
SLIDE 48

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-49
SLIDE 49

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-50
SLIDE 50

r0 r1 r2 r3 r4 r5 r6 r7 42 add r1 r2 r3 add r3 r3 r3 nop bnz r4 ff32 pc

payload tag ???

16
slide-51
SLIDE 51

Is it flexible?

17
slide-52
SLIDE 52

Control-flow integrity Compartmentalization

(à la Wahbe et al.’s SFI)

Heap memory safety Dynamic sealing

18
slide-53
SLIDE 53

Example: CFI

19
slide-54
SLIDE 54

1729 Data add r1 r2 r3 Code bnz r3 8 Code jump r4 Code bnz r5 8 Code sub r1 r2 r1 Code add r3 r4 r4 Code {InstTag = Data} → {Inst = Store, Mem = Code} →

20
slide-55
SLIDE 55

1729 Data add r1 r2 r3 Code bnz r3 8 Code jump r4 Code bnz r5 8 Code sub r1 r2 r1 Code add r3 r4 r4 Code {InstTag = Data} → {Inst = Store, Mem = Code} →

20
slide-56
SLIDE 56

1729 Data add r1 r2 r3 Code bnz r3 8 Code jump r4 Code bnz r5 8 Code sub r1 r2 r1 Code add r3 r4 r4 Code

1 2 4 3 5 6

pc 1 CFG {Pc = 4, InstTag = Code 5} → OK {Pc = 1, InstTag = Code 5} →

20
slide-57
SLIDE 57

1729 Data add r1 r2 r3 Code 1 bnz r3 8 Code 2 jump r4 Code 3 bnz r5 8 Code 4 sub r1 r2 r1 Code 5 add r3 r4 r4 Code 6

1 2 4 3 5 6

pc 1 {Pc = 4, InstTag = Code 5} → OK {Pc = 1, InstTag = Code 5} →

20
slide-58
SLIDE 58

1729 Data add r1 r2 r3 Code 1 bnz r3 8 Code 2 jump r4 Code 3 bnz r5 8 Code 4 sub r1 r2 r1 Code 5 add r3 r4 r4 Code 6

1 2 4 3 5 6

pc 1 Previous instruction id {Pc = 4, InstTag = Code 5} → OK {Pc = 1, InstTag = Code 5} →

20
slide-59
SLIDE 59

1729 Data add r1 r2 r3 Code 1 bnz r3 8 Code 2 jump r4 Code 3 bnz r5 8 Code 4 sub r1 r2 r1 Code 5 add r3 r4 r4 Code 6

1 2 4 3 5 6

pc 1 {Pc = 4, InstTag = Code 5} → OK {Pc = 1, InstTag = Code 5} →

20
slide-60
SLIDE 60

Is it secure?

21
slide-61
SLIDE 61

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-62
SLIDE 62

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Mathematical definitions… …and proofs about them

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-63
SLIDE 63

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-64
SLIDE 64

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-65
SLIDE 65

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor …parameterized by user-defined tags and policy

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-66
SLIDE 66

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

High-level description, abstract away low-level details

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-67
SLIDE 67

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

machine-checked proof

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-68
SLIDE 68

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

machine-checked proof

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-69
SLIDE 69

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine refined by

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-70
SLIDE 70

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

refined by Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-71
SLIDE 71

Inductive nat := | O : nat | S : nat → nat. Fixpoint add n m := match n with | O ⇒ m | S n ⇒ S (add n m) end. Lemma addn0 : ∀ n, add n O = n.

  • Proof. (* ... *) Qed.

Micro-policy programming model

Model of simplified RISC processor

Inductive cfi_tag := | Data : cfi_tag | Code : id → cfi_tag. Variable cfg : id → id → bool. Definition cfi_monitor tags := match pc_tag tags, ci_tag tags with | n, Code m ⇒ if cfg n m then Some m else None | _, _ ⇒ None end.

Micro-policy specification

Threat model Attacker controls input, but has no physical access Not modeled DMA, virtual memory, timing, …

Higher-level abstract machine

Inductive value := | Int : int → value | Ptr : region → int → value. Definition add v1 v2 := match v1, v2 with | Int n, Int m ⇒ Some (Int (n + m)) | Ptr r off, Int n | Int n, Ptr r off ⇒ Some (Ptr r (off + n)) | _, _ ⇒ None end.

Memory-safe abstract machine Memory safety

Abadi et al.’s CFI property

CFI

22
slide-72
SLIDE 72

Takeaway

Expressive, high-level policies for security of low-level code

(with reasonable overheads)

23
slide-73
SLIDE 73

Takeaway

Expressive, high-level policies for security of low-level code

(with reasonable overheads)

23
slide-74
SLIDE 74

What Else?

In the paper

  • Detailed description of micro-policies and programming

model

  • Discussion of formal proofs
  • Model of the PUMP hardware extension, where policy is

implemented by machine code and cache

  • Monitor self protection

http://github.com/micro-policies/micro-policies-coq

24
slide-75
SLIDE 75

What’s Next?

More policies

Stack protection Operating system Full abstraction

Composition

Combine policies and their guarantees

Improve guarantees

Scale up to real ISA Verify implementations

Thank you!

25
slide-76
SLIDE 76

Is it fast?

26
slide-77
SLIDE 77

Meet the PUMP

(Programmable Unit for Metadata Processing)

27
slide-78
SLIDE 78
  • utput_tags handler() {

input_tags it = fetch(); /* compute... */ return ot; }

Software implementation, hardware cache

28
slide-79
SLIDE 79

Credits

Images borrowed from thenounproject.com

  • Snail by Irene
  • Chip by Arthur Shlain
29