Secure Programs via Game-based Synthesis Somesh Jha, Tom Reps, and - - PowerPoint PPT Presentation

secure programs via game based synthesis
SMART_READER_LITE
LIVE PREVIEW

Secure Programs via Game-based Synthesis Somesh Jha, Tom Reps, and - - PowerPoint PPT Presentation

Secure Programs via Game-based Synthesis Somesh Jha, Tom Reps, and Bill Harris 1 Tuesday, October 22, 13 One-slide summary Secure programming on a conventional OS is intractable Privilege-aware OSs take secure programming from


slide-1
SLIDE 1

Secure Programs via Game-based Synthesis

Somesh Jha, Tom Reps, and Bill Harris

1 Tuesday, October 22, 13
slide-2
SLIDE 2

One-slide summary

  • Secure programming on a conventional OS is

intractable

  • Privilege-aware OS’s take secure programming

from intractable to challenging

  • Our program rewriter takes secure programming

from challenging to simple

2 Tuesday, October 22, 13
slide-3
SLIDE 3
  • 1. Motivation, problem statement

Outline

  • 1. Motivation, problem statement
  • 2. Previous work: Capsicum [CAV ’12, Oakland ’13]
  • 3. Ongoing work: HiStar
  • 4. Open challenges
3 Tuesday, October 22, 13
slide-4
SLIDE 4
  • 1. Motivation, problem statement

Outline

3 Tuesday, October 22, 13
slide-5
SLIDE 5

Secure Programming is Intractable

  • 81 exploits in CVE since Sept. 2013
  • Many exploit a software bug

to carry out undesirable system operations

  • 2013-5751: exploit SAP NetWeaver

to traverse a directory

  • 2013-5979: exploit bad filename handling in

Xibo to read arbitrary files

  • 2013-5725: exploit ByWord

to overwrite files

4 Tuesday, October 22, 13
slide-6
SLIDE 6

How to Carry Out an Exploit

software vulnerability + OS privilege = security exploit

5 Tuesday, October 22, 13
slide-7
SLIDE 7

software vulnerability + OS privilege = security exploit

6

The Conventional-OS Solution

Tuesday, October 22, 13
slide-8
SLIDE 8

software vulnerability + OS privilege = security exploit

6

The Conventional-OS Solution

Tuesday, October 22, 13
slide-9
SLIDE 9

software vulnerability + OS privilege = security exploit

6

The Conventional-OS Solution

Tuesday, October 22, 13
slide-10
SLIDE 10

Solution

software vulnerability + OS privilege = security exploit

7

The Program-Verification

Tuesday, October 22, 13
slide-11
SLIDE 11

Solution

software vulnerability + OS privilege = security exploit

7

The Program-Verification

Tuesday, October 22, 13
slide-12
SLIDE 12

Solution

software vulnerability + OS privilege = security exploit

7

The Program-Verification

Tuesday, October 22, 13
slide-13
SLIDE 13

Priv.-aware OS

  • Introduce explicit privileges over all system objects,

primitives that update privileges

  • Programs call primitives to manage privilege
8 Tuesday, October 22, 13
slide-14
SLIDE 14

Solution

+ OS privilege = security exploit

9

Priv.-aware OS The

software vulnerability

Tuesday, October 22, 13
slide-15
SLIDE 15

Solution

+ OS privilege = security exploit

( )

9

Priv.-aware OS The

+ primitives software vulnerability monitor

Tuesday, October 22, 13
slide-16
SLIDE 16

Solution

+ OS privilege = security exploit

( )

9

Priv.-aware OS The

+ primitives software vulnerability monitor

Tuesday, October 22, 13
slide-17
SLIDE 17

[Watson ’10]

  • Privilege: ambient authority (Amb)

to open descriptors to system objects

  • Primitives: program calls cap_enter()

to manage Amb

10

The Capsicum Priv.-aware OS

Tuesday, October 22, 13
slide-18
SLIDE 18 11

’s Amb Rules of Capsicum

Tuesday, October 22, 13
slide-19
SLIDE 19
  • 1. When a process is created,

it has the Amb value of its parent

11

’s Amb Rules of Capsicum

Tuesday, October 22, 13
slide-20
SLIDE 20
  • 1. When a process is created,

it has the Amb value of its parent

  • 2. After a process calls cap_enter(),

it does not have Amb

11

’s Amb Rules of Capsicum

Tuesday, October 22, 13
slide-21
SLIDE 21
  • 1. When a process is created,

it has the Amb value of its parent

  • 2. After a process calls cap_enter(),

it does not have Amb

  • 3. If a process does not have Amb,

then it can never obtain Amb

11

’s Amb Rules of Capsicum

Tuesday, October 22, 13
slide-22
SLIDE 22

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); }

12

gzip

L1: compress(in, out);

Tuesday, October 22, 13
slide-23
SLIDE 23

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); }

12

gzip

L1: compress(in, out);

Tuesday, October 22, 13
slide-24
SLIDE 24

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); }

12

gzip

http://evil.com L1: compress(in, out);

Tuesday, October 22, 13
slide-25
SLIDE 25

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); }

12

gzip

http://evil.com L1: compress(in, out); /usr/local

Tuesday, October 22, 13
slide-26
SLIDE 26

A simple policy

13
  • When gzip calls open2() at L0,

it should

  • When gzip calls compress() at L1,

it should not

gzip

able to open descriptors be able to open descriptors

Tuesday, October 22, 13
slide-27
SLIDE 27

A simple policy

13

with AMB

  • When gzip calls open2() at L0,

it should

  • When gzip calls compress() at L1,

it should not

gzip

have AMB have AMB

Tuesday, October 22, 13
slide-28
SLIDE 28

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

14

gzip with AMB

Tuesday, October 22, 13
slide-29
SLIDE 29

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

14

gzip with AMB

Tuesday, October 22, 13
slide-30
SLIDE 30

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

14

gzip

L0: AMB L1: no AMB

with AMB

Tuesday, October 22, 13
slide-31
SLIDE 31

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

14

gzip

L0: AMB L1: no AMB cap_enter()

with AMB

Tuesday, October 22, 13
slide-32
SLIDE 32

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

14

gzip

L0: AMB L1: no AMB cap_enter()

? ?

with AMB

Tuesday, October 22, 13
slide-33
SLIDE 33

Programming Challenges

  • 1. Amb policies are not explicit
  • 2. cap_enter primitive has subtle temporal effects
15

Capsicum

Tuesday, October 22, 13
slide-34
SLIDE 34

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

L0: AMB L1: no AMB

Tuesday, October 22, 13
slide-35
SLIDE 35

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

L0: AMB L1: no AMB

cap_enter();

Tuesday, October 22, 13
slide-36
SLIDE 36

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } AMB

L0: AMB L1: no AMB

cap_enter();

Tuesday, October 22, 13
slide-37
SLIDE 37

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } AMB

L0: AMB L1: no AMB

cap_enter();

Tuesday, October 22, 13
slide-38
SLIDE 38

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } AMB

L0: AMB L1: no AMB

cap_enter();

Tuesday, October 22, 13
slide-39
SLIDE 39

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } no AMB

L0: AMB L1: no AMB

cap_enter();

Tuesday, October 22, 13
slide-40
SLIDE 40

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } no AMB

L0: AMB L1: no AMB

cap_enter();

Tuesday, October 22, 13
slide-41
SLIDE 41

Programming Challenges

16

gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } no AMB

L0: AMB L1: no AMB

cap_enter();

Tuesday, October 22, 13
slide-42
SLIDE 42
  • 1. When a process is created,

it has the AMB value of its parent

Rules of Capsicum’s Amb

  • 2. After a process calls cap_enter(),

it never has AMB

  • 3. If a process does not have Amb,

then it can never obtain Amb

17 Tuesday, October 22, 13
slide-43
SLIDE 43
  • 1. When a process is created,

it has the AMB value of its parent

Rules of Capsicum’s Amb

17 Tuesday, October 22, 13
slide-44
SLIDE 44

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

L0: AMB L1: no AMB cap_enter();

Tuesday, October 22, 13
slide-45
SLIDE 45

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

L0: AMB L1: no AMB cap_enter(); sync_fork(); sync_join();

Tuesday, October 22, 13
slide-46
SLIDE 46

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

AMB

L0: AMB L1: no AMB cap_enter(); sync_fork(); sync_join();

Tuesday, October 22, 13
slide-47
SLIDE 47

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

AMB

L0: AMB L1: no AMB cap_enter(); sync_fork(); sync_join();

Tuesday, October 22, 13
slide-48
SLIDE 48

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

AMB

L0: AMB L1: no AMB cap_enter(); sync_fork(); sync_join();

Tuesday, October 22, 13
slide-49
SLIDE 49

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

no AMB

L0: AMB L1: no AMB cap_enter(); sync_fork(); sync_join();

Tuesday, October 22, 13
slide-50
SLIDE 50

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

AMB

L0: AMB L1: no AMB cap_enter(); sync_fork(); sync_join();

Tuesday, October 22, 13
slide-51
SLIDE 51

Instrumenting gzip

18

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

AMB

L0: AMB L1: no AMB cap_enter(); sync_fork(); sync_join();

Tuesday, October 22, 13
slide-52
SLIDE 52

Capsicum Challenges Not Appearing in This Talk

  • Program can construct capability from

each UNIX descriptor

  • Capability has a vector of 63 access rights

(~1 for every system call on a descriptor)

  • Programs can assume new capabilities via a

Remote Procedure Call (RPC)

19 Tuesday, October 22, 13
slide-53
SLIDE 53

Instrumenting Programs

  • 1. Programmer writes an explicit Amb policy
  • 2. CapWeave instruments program to invoke

primitives so that it satisfies the policy

20

with CapWeave

Tuesday, October 22, 13
slide-54
SLIDE 54 21

with CapWeave gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

L0: AMB L1: no AMB

Tuesday, October 22, 13
slide-55
SLIDE 55 21

with CapWeave gzip

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

Policy

Cur(p) => (pc[L0](p) => AMB(p) & (pc[L1](p) => !AMB(p))

Tuesday, October 22, 13
slide-56
SLIDE 56

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

22

Policy

Cur(p) => (pc[L0](p) => AMB(p) & (pc[L1](p) => !AMB(p))

Tuesday, October 22, 13
slide-57
SLIDE 57 main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } 22 Policy Cur(p) => (pc[L0](p) => AMB(p) & (pc[L1](p) => !AMB(p)) Tuesday, October 22, 13
slide-58
SLIDE 58 main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } 22

CapWeave

Policy Cur(p) => (pc[L0](p) => AMB(p) & (pc[L1](p) => !AMB(p)) Tuesday, October 22, 13
slide-59
SLIDE 59 main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); } 22

CapWeave

Instrumented Program

void main() { L0: open2(...); sync_fork(); cap_enter(); L1: compress(); sync_join(); } Policy Cur(p) => (pc[L0](p) => AMB(p) & (pc[L1](p) => !AMB(p)) Tuesday, October 22, 13
slide-60
SLIDE 60

The Next 700 Policy Weavers

Analogous challenges with Decentralized Information Flow Control (DIFC)

  • Asbestos [Efstathopoulos ‘05]
  • HiStar [Zeldovich ’06]
  • Flume [Krohn ‘07]
23 Tuesday, October 22, 13
slide-61
SLIDE 61 gzip() { file_nms = parse_cl(); ... }

CapWeave

gzip() { file_nms = parse_cl(); sync_fork(); cap_enter(); ... } Policy Cur(p) => (pc[L0](p) => AMB(p)) & (pc[L1](p) => !AMB(p)) 24 Tuesday, October 22, 13
slide-62
SLIDE 62 gzip() { file_nms = parse_cl(); ... }

CapWeave

gzip() { file_nms = parse_cl(); sync_fork(); cap_enter(); ... } Policy Cur(p) => (pc[L0](p) => AMB(p)) & (pc[L1](p) => !AMB(p))

Programmer

Weaver Generator

24 Tuesday, October 22, 13
slide-63
SLIDE 63 gzip() { file_nms = parse_cl(); ... }

CapWeave

gzip() { file_nms = parse_cl(); sync_fork(); cap_enter(); ... } Policy Cur(p) => (pc[L0](p) => AMB(p)) & (pc[L1](p) => !AMB(p))

Programmer

cap_enter: Amb’(p) := Amb(p) & ...

Weaver Generator

Capsicum Designer

24 Tuesday, October 22, 13
slide-64
SLIDE 64

Weaver Generator

25 Tuesday, October 22, 13
slide-65
SLIDE 65 create_cat(&c): Flows’(p, q) := Flows(p, q) || ...

Weaver Generator

HiStar Designer

25 Tuesday, October 22, 13
slide-66
SLIDE 66

HiWeave

create_cat(&c): Flows’(p, q) := Flows(p, q) || ...

Weaver Generator

HiStar Designer

25 Tuesday, October 22, 13
slide-67
SLIDE 67 wrapper() { exec(...); ... }

HiWeave

Policy forall w, s. Flows(w, s) => ...

Programmer

create_cat(&c): Flows’(p, q) := Flows(p, q) || ...

Weaver Generator

HiStar Designer

25 Tuesday, October 22, 13
slide-68
SLIDE 68 wrapper() { exec(...); ... }

HiWeave

scanner() { create_cat(&c); exec(...); ... } Policy forall w, s. Flows(w, s) => ...

Programmer

create_cat(&c): Flows’(p, q) := Flows(p, q) || ...

Weaver Generator

HiStar Designer

25 Tuesday, October 22, 13
slide-69
SLIDE 69
  • 2. Previous work: Capsicum

Outline

  • 1. Motivation, problem statement
  • 2. Previous work: Capsicum
  • 3. Ongoing work: HiStar
  • 4. Open challenges
26 Tuesday, October 22, 13
slide-70
SLIDE 70
  • 2. Previous work: Capsicum

Outline

26 Tuesday, October 22, 13
slide-71
SLIDE 71

CapWeave Algorithm

27 Tuesday, October 22, 13
slide-72
SLIDE 72

CapWeave Algorithm

Inputs: Program P , Amb Policy Q

27 Tuesday, October 22, 13
slide-73
SLIDE 73

CapWeave Algorithm

Inputs: Program P , Amb Policy Q Output: Instrumentation of P that always satisfies Q

27 Tuesday, October 22, 13
slide-74
SLIDE 74

CapWeave Algorithm

Inputs: Program P , Amb Policy Q Output: Instrumentation of P that always satisfies Q

  • 1. Build finite IP# ⊇ instrumented runs that violate Q
27 Tuesday, October 22, 13
slide-75
SLIDE 75
  • 1. Building IP#: Inputs
28

Program Amb Policy

main() { file_nms = parse_cl(); for (f in file_nms): L0: (in, out) = open2(f); L1: compress(in, out); }

L0: Amb L1: no Amb

Tuesday, October 22, 13
slide-76
SLIDE 76 29 parse_cl cap_enter noop L0:open2() L0:open2() L1:compress() noop sync_fork() sync_join() noop cap_enter() noop noop L1:compress() noop L1:compress() cap_enter() L0:open2() L1:compress() noop
  • 1. Building IP#: Output
Tuesday, October 22, 13
slide-77
SLIDE 77 29 parse_cl cap_enter noop L0:open2() L0:open2() L1:compress() noop sync_fork() sync_join() noop cap_enter() noop noop L1:compress() noop L1:compress() cap_enter() L0:open2() L1:compress() noop
  • 1. Building IP#: Output

L1: no Amb

Tuesday, October 22, 13
slide-78
SLIDE 78
  • 1. Building IP#: Output
30 parse_cl cap_enter noop L0:open2() L0:open2() L1:compress() noop sync_fork() sync_join() noop cap_enter() noop L1:compress() noop L1:compress() cap_enter() L0:open2() L1:compress() noop noop Tuesday, October 22, 13
slide-79
SLIDE 79
  • 1. Building IP#: Output
30 parse_cl cap_enter noop L0:open2() L0:open2() L1:compress() noop sync_fork() sync_join() noop cap_enter() noop L1:compress() noop L1:compress() cap_enter() L0:open2() L1:compress() noop

L0: Amb

noop Tuesday, October 22, 13
slide-80
SLIDE 80

Building IP#

Basic idea: construct IP# as a forward exploration

  • f an abstract state space
31 Tuesday, October 22, 13
slide-81
SLIDE 81

1(a). IP#: Define Abstract State-space

Q

32 Tuesday, October 22, 13
slide-82
SLIDE 82

1(a). IP#: Define Abstract State-space

Q Q#

32 Tuesday, October 22, 13
slide-83
SLIDE 83

1(a). IP#: Define Abstract State-space

Q Q#

𝛽

32 Tuesday, October 22, 13
slide-84
SLIDE 84

1(a). IP#: Define Abstract State-space

Q Q#

𝛽

32 Tuesday, October 22, 13
slide-85
SLIDE 85

Q Q#

𝛽

33

1(b). IP#: Define Abstract Transformers

Tuesday, October 22, 13
slide-86
SLIDE 86

Q Q#

𝛽

33

1(b). IP#: Define Abstract Transformers

𝜐[cap_enter]

Tuesday, October 22, 13
slide-87
SLIDE 87

Q Q#

𝛽

33

1(b). IP#: Define Abstract Transformers

𝜐[cap_enter]# 𝜐[cap_enter]

Tuesday, October 22, 13
slide-88
SLIDE 88

1(c). Explore Abstract State Space

34

Q Q#

Tuesday, October 22, 13
slide-89
SLIDE 89

𝛽

1(c). Explore Abstract State Space

init L0

34

Q Q#

Tuesday, October 22, 13
slide-90
SLIDE 90

𝛽

1(c). Explore Abstract State Space

init parse_cl ... cap_enter ... noop 𝜐[parse_cl]# L0 L0’ .. 𝜐[noop]# ... 𝜐[cap_enter]#

34

Q Q#

Tuesday, October 22, 13
slide-91
SLIDE 91 35

𝜐[parse_cl]#

Tuesday, October 22, 13
slide-92
SLIDE 92 35 𝜐[parse_cl]# Tuesday, October 22, 13
slide-93
SLIDE 93 35 parse_cl cap_enter noop L0:open2() L0:open2() L1:compress() noop sync_fork() sync_join() noop cap_enter() noop noop L1:compress() noop L1:compress() cap_enter() L0:open2() L1:compress() noop Tuesday, October 22, 13
slide-94
SLIDE 94

State-Structure Exploration

If a concrete state is a logical structure, ...

Q

36 Tuesday, October 22, 13
slide-95
SLIDE 95

State-Structure Exploration

If a concrete state is a logical structure, ...

Q

36

D A A C B B

≡{ }

Tuesday, October 22, 13
slide-96
SLIDE 96

State-Structure Exploration

37

properties are FOL formulas, ...

∀p. A(p) ⇒ ((B(p) ⇒ C(p)) ⋀ (D(p) ⇒ ¬C(p)))

Tuesday, October 22, 13
slide-97
SLIDE 97

State-Structure Exploration

...and semantics is given as predicate updates, ... 𝜐[action] ≡ A’(x) = A(x) ⋁ ∃ y. C(y) ⋀ B(q, p) B’(x, y) = B(x, y) ⋁ (C(x) ⋀ D(y)) C’(x) = ... D’(x) = ...

38 Tuesday, October 22, 13
slide-98
SLIDE 98

State-Structure Exploration

Q

...then abstract space and transformers can be generated automatically [Sagiv ’99]

39 Tuesday, October 22, 13
slide-99
SLIDE 99

State-Structure Exploration

𝛽

𝜐[action]

𝛽

𝜐[action]#

Q Q#

...then abstract space and transformers can be generated automatically [Sagiv ’99]

39 Tuesday, October 22, 13
slide-100
SLIDE 100

Capsicum Semantics

D A A C B B

𝜐[action] ≡ 1. 2. Q ≡

40

A’(x) = A(x) ⋁ ∃ y. C(y) ⋀ B(q, p) B’(x, y) = B(x, y) ⋁ (C(x) ⋀ D(y)) C’(x) = ... D’(x) = ...

Tuesday, October 22, 13
slide-101
SLIDE 101

Capsicum State as Structure

41 Tuesday, October 22, 13
slide-102
SLIDE 102

Capsicum State as Structure

41 Tuesday, October 22, 13
slide-103
SLIDE 103

Capsicum State as Structure

Cur

41 Tuesday, October 22, 13
slide-104
SLIDE 104

Capsicum State as Structure

Cur L1

41 Tuesday, October 22, 13
slide-105
SLIDE 105

Capsicum State as Structure

Cur Amb Amb L1

41 Tuesday, October 22, 13
slide-106
SLIDE 106

Capsicum State as Structure

Cur Parent Amb Amb L1

41 Tuesday, October 22, 13
slide-107
SLIDE 107

Capsicum State as Structure

Cur Parent Amb Amb L1

41

∀ p. Cur(p) ⋀ L1(p) ⇒ ¬ Amb(p)

Tuesday, October 22, 13
slide-108
SLIDE 108

Capsicum State as Structure

Cur Parent Amb Amb L1

41

∀ p. Cur(p) ⋀ L1(p) ⇒ ¬ Amb(p)

Tuesday, October 22, 13
slide-109
SLIDE 109

Capsicum State as Structure

Cur Parent Amb Amb L1

42

∀ p. Cur(p) ⋀ L1(p) ⇒ ¬ Amb(p)

Tuesday, October 22, 13
slide-110
SLIDE 110

Capsicum State as Structure

Cur Parent Amb L1

42

∀ p. Cur(p) ⋀ L1(p) ⇒ ¬ Amb(p)

Tuesday, October 22, 13
slide-111
SLIDE 111

Capsicum State as Structure

Cur Parent Amb L1

42

∀ p. Cur(p) ⋀ L1(p) ⇒ ¬ Amb(p)

Tuesday, October 22, 13
slide-112
SLIDE 112 43

Capsicum Structure Transformers

Action sync_fork()

Tuesday, October 22, 13
slide-113
SLIDE 113 43

Capsicum Structure Transformers

Amb Cur Action sync_fork()

Tuesday, October 22, 13
slide-114
SLIDE 114 43

Fresh

Capsicum Structure Transformers

Amb Cur Action sync_fork()

Tuesday, October 22, 13
slide-115
SLIDE 115 43

Amb Fresh

Capsicum Structure Transformers

Amb Cur Action sync_fork()

Tuesday, October 22, 13
slide-116
SLIDE 116 43

Cur Parent Amb Fresh

Capsicum Structure Transformers

Amb Action sync_fork()

Tuesday, October 22, 13
slide-117
SLIDE 117 43

Cur Parent Amb Fresh

Capsicum Structure Transformers

Amb Action Structure Transformer sync_fork()

Tuesday, October 22, 13
slide-118
SLIDE 118

Intro Fresh Amb’(p) := Amb(p) ⋁ ( Fresh(p) ⋀ ∃ q. Cur(q) ⋀ Amb(q))

43

Cur Parent Amb Fresh

Capsicum Structure Transformers

Amb Action Structure Transformer sync_fork()

Tuesday, October 22, 13
slide-119
SLIDE 119 44

Action Structure Transformer Cur Parent Amb Fresh

Capsicum Structure Transformers

Amb

Tuesday, October 22, 13
slide-120
SLIDE 120 44

cap_enter() Action Structure Transformer Cur Parent Amb Fresh

Capsicum Structure Transformers

Amb

Tuesday, October 22, 13
slide-121
SLIDE 121 44

cap_enter() Action Structure Transformer Cur Parent Fresh

Capsicum Structure Transformers

Amb

Tuesday, October 22, 13
slide-122
SLIDE 122 44

cap_enter() Amb’(p) := Amb(p) ⋀ ¬Cur(p) Action Structure Transformer Cur Parent Fresh

Capsicum Structure Transformers

Amb

Tuesday, October 22, 13
slide-123
SLIDE 123

Building IP#: Summary

  • If semantics is given as

transforms of logical structures, we can generate an approximation of runs that cause a violation

  • Capsicum semantics can be modeled as

structure transforms

45 Tuesday, October 22, 13
slide-124
SLIDE 124

CapWeave Algorithm

Inputs: Program P , Amb Policy Q Output: Instrumentation of P that always satisfies Q

  • 1. Build finite IP# ⊇ instrumented runs that violate Q
46 Tuesday, October 22, 13
slide-125
SLIDE 125
  • 2. From IP#, build safety game G

won by violations of Q

CapWeave Algorithm

Inputs: Program P , Amb Policy Q Output: Instrumentation of P that always satisfies Q

  • 1. Build finite IP# ⊇ instrumented runs that violate Q
46 Tuesday, October 22, 13
slide-126
SLIDE 126

Two-Player Safety Games

  • In an Attacker state,

the Attacker chooses the next input

  • In a Defender state,

the Defender chooses the next input

  • Attacker wants to reach an accepting state
47 Tuesday, October 22, 13
slide-127
SLIDE 127 48 a x y b b d y z w c y y c d x d y b d x Tuesday, October 22, 13
slide-128
SLIDE 128 48 a x y b b d y z w c y y c d x d y b d x Tuesday, October 22, 13
slide-129
SLIDE 129

Instrumentation as a Game

49

Capsicum Instrumentation Two-player Games Program instructions Attacker actions Capsicum primitives Defender actions Policy violations Attacker wins Satisfying instrumentation Winning Defender strategy

Tuesday, October 22, 13
slide-130
SLIDE 130 50 parse_cl cap_enter noop L0:open2() L0:open2() L1:compress() noop sync_fork() sync_join() noop cap_enter() noop noop L1:compress() noop L1:compress() cap_enter() L0:open2() L1:compress() noop

gzip IP#

Tuesday, October 22, 13
slide-131
SLIDE 131 51 parse_cl cap_enter noop L0:open2() L0:open2() L1:compress() noop sync_fork() sync_join() noop cap_enter() noop noop L1:compress() noop L1:compress() cap_enter() L0:open2() L1:compress() noop

gzip Safety Game

Tuesday, October 22, 13
slide-132
SLIDE 132 51 parse_cl noop L0:open2() sync_fork() sync_join() noop cap_enter() L1:compress() L1:compress()

gzip Safety Game

Tuesday, October 22, 13
slide-133
SLIDE 133

CapWeave Algorithm

Inputs: Program P , Amb Policy Q Output: Instrumentation of P that always satisfies Q

  • 1. Build finite IP# ⊇ instrumented runs that violate Q
  • 2. From IP#, build safety game G

won by violations of Q

52 Tuesday, October 22, 13
slide-134
SLIDE 134

CapWeave Algorithm

Inputs: Program P , Amb Policy Q Output: Instrumentation of P that always satisfies Q

  • 1. Build finite IP# ⊇ instrumented runs that violate Q
  • 2. From IP#, build safety game G

won by violations of Q

  • 3. From winning strategy for G,

generate primitive controller for P

52 Tuesday, October 22, 13
slide-135
SLIDE 135

CapWeave Performance

53

Name Program kLoC Policy LoC Weaving Time

bzip2-1.0.6 8 70 4m57s gzip-1.2.4 9 68 3m26s php-cgi-5.3.2 852 114 46m36s tar-1.25 108 49 0m08s tcpdump-4.1.1 87 52 0m09s wget-1.12 64 35 0m10s

Tuesday, October 22, 13
slide-136
SLIDE 136

Performance on Included Tests

54

Name Base Time Hand Overhd capweave Overhd Diff. Overhd (%)

bzip2-1.0.6 0.593s 0.909 1.099 20.90 gzip-1.2.4 0.036s 1.111 1.278 15.03 php-cgi-5.3.2 0.289s 1.170 1.938 65.64 tar-1.25 0.156s 13.301 21.917 64.78 tcpdump-4.1.1 1.328s 0.981 1.224 24.77 wget-1.12 4.539s 1.906 1.106 0.91

Tuesday, October 22, 13
slide-137
SLIDE 137

Outline

  • 1. Motivation, problem statement
  • 2. Previous work: Capsicum
  • 3. Ongoing work: HiStar
  • 4. Open challenges
55
  • 3. Ongoing work: HiStar
Tuesday, October 22, 13
slide-138
SLIDE 138

Outline

55
  • 3. Ongoing work: HiStar
Tuesday, October 22, 13
slide-139
SLIDE 139

The HiStar Priv-aware OS [Zeldovich ’06]

  • Privilege: OS allows flow between processes
  • Primitives: system calls update labels,

which define allowed flows

  • Very powerful: mutually untrusting login (?!)
56 Tuesday, October 22, 13
slide-140
SLIDE 140

Sandboxing a Virus Scanner

launcher() { exec(“/bin/scanner”); } wrapper() { child = sync_fork(&launcher); while (true) { read(child, buf); sanitize(buf); write(netd, buf); } }

57 Tuesday, October 22, 13
slide-141
SLIDE 141

A Flow Policy for a Virus Scanner

  • Information should never transitively flow

from the scanner to the network, unless it goes through the wrapper

  • Information should always flow from the

scanner to the wrapper

  • Information should always flow from the

wrapper to the network

58 Tuesday, October 22, 13
slide-142
SLIDE 142

Rules for HiStar’s Flow

  • A process’s label maps each category

to low or high

  • If process p calls create_cat, then each

process is low in c, and p can declassify c

  • Each process may raise its level at each

category

  • Each process may relinquish declassification
59 Tuesday, October 22, 13
slide-143
SLIDE 143

Rules for HiStar’s Flow

Information can flow from p to q if for each category:

  • The level of p is lower than the level of q at c, or
  • p can declassify c
60 Tuesday, October 22, 13
slide-144
SLIDE 144

Sandboxing a Virus Scanner

61

launcher() { exec(“/bin/scanner”); } wrapper() { child = sync_fork(&launcher); while (true) { read(child, buf); sanitize(buf); write(netd, buf); } }

Tuesday, October 22, 13
slide-145
SLIDE 145

Sandboxing a Virus Scanner

61

launcher() { exec(“/bin/scanner”); } wrapper() { child = sync_fork(&launcher); while (true) { read(child, buf); sanitize(buf); write(netd, buf); } } create_cat(&x); raise(x);

Tuesday, October 22, 13
slide-146
SLIDE 146

Sandboxing a Virus Scanner

61

launcher() { exec(“/bin/scanner”); } wrapper() { child = sync_fork(&launcher); while (true) { read(child, buf); sanitize(buf); write(netd, buf); } } drop_declass(x); create_cat(&x); raise(x);

Tuesday, October 22, 13
slide-147
SLIDE 147

HiStar Challenges Not Appearing in This Talk

  • There are actually four levels
  • Each process has to manage its clearance
  • Processes can create labeled closures

(calling a closure implicitly performs two label operations and three ordering checks)

62 Tuesday, October 22, 13
slide-148
SLIDE 148

Weave Algorithm

Inputs: Program P , Policy Q Output: Instrumentation of P that satisfies Q

  • 1. Build IP# ⊇ instrumented runs that violate Q

(using semantics)

  • 2. From IP#, build safety game G

won by violations of Q

  • 3. From winning strategy for G,

generate primitive controller for P

63

Amb Capsicum

Cap

Tuesday, October 22, 13
slide-149
SLIDE 149

Weave Algorithm

Inputs: Program P , Policy Q Output: Instrumentation of P that satisfies Q

  • 1. Build IP# ⊇ instrumented runs that violate Q

(using semantics)

  • 2. From IP#, build safety game G

won by violations of Q

  • 3. From winning strategy for G,

generate primitive controller for P

63

Amb Capsicum

Cap

Tuesday, October 22, 13
slide-150
SLIDE 150

Weave Algorithm

Inputs: Program P , Policy Q Output: Instrumentation of P that satisfies Q

  • 1. Build IP# ⊇ instrumented runs that violate Q

(using semantics)

  • 2. From IP#, build safety game G

won by violations of Q

  • 3. From winning strategy for G,

generate primitive controller for P

63

HiStar Flow

Hi

Tuesday, October 22, 13
slide-151
SLIDE 151

Semantics

D A A C B B

𝜐[action] ≡ 1. 2. Q ≡

64

A’(x) = A(x) ⋁ ∃ y. C(y) ⋀ B(q, p) B’(x, y) = B(x, y) ⋁ (C(x) ⋀ D(y)) C’(x) = ... D’(x) = ...

Capsicum

Tuesday, October 22, 13
slide-152
SLIDE 152

Semantics

D A A C B B

𝜐[action] ≡ 1. 2. Q ≡

64

A’(x) = A(x) ⋁ ∃ y. C(y) ⋀ B(q, p) B’(x, y) = B(x, y) ⋁ (C(x) ⋀ D(y)) C’(x) = ... D’(x) = ...

HiStar

Tuesday, October 22, 13
slide-153
SLIDE 153

HiStar State as Structure

65 Tuesday, October 22, 13
slide-154
SLIDE 154

HiStar State as Structure

65

Cur

Tuesday, October 22, 13
slide-155
SLIDE 155

HiStar State as Structure

Label Label Label

65

Cur

Tuesday, October 22, 13
slide-156
SLIDE 156

HiStar State as Structure

Label Label Label

65

x Cur

Tuesday, October 22, 13
slide-157
SLIDE 157

HiStar State as Structure

Label Label Label High Low Low

65

x Cur

Tuesday, October 22, 13
slide-158
SLIDE 158

HiStar State as Structure

Label Label Label High Low Low Flows Flows Flows

65

x Cur

Tuesday, October 22, 13
slide-159
SLIDE 159

HiStar State as Structure

Label Label Label High Low Low Flows Flows Flows

65

Scan Wrap Netd x Cur

Tuesday, October 22, 13
slide-160
SLIDE 160

HiStar State as Structure

Label Label Label ∀ w, s, n. Wrap(w) ⋀ Scan(s) ⋀ Netd(n) ⇒ Flows(s, w) ⋀ Flows(w, n) High Low Low Flows Flows Flows

65

Scan Wrap Netd x Cur

Tuesday, October 22, 13
slide-161
SLIDE 161

HiStar State as Structure

Label Label Label ∀ w, s, n. Wrap(w) ⋀ Scan(s) ⋀ Netd(n) ⇒ Flows(s, w) ⋀ Flows(w, n) High Low Low Flows Flows Flows

65

Scan Wrap Netd

x Cur

Tuesday, October 22, 13
slide-162
SLIDE 162

HiStar State as Structure

66

Label Label Label High Low Low Flows Flows Flows Scan Wrap Netd Decl ∀ w, s, n. Wrap(w) ⋀ Scan(s) ⋀ Netd(n) ⇒ Flows(s, w) ⋀ Flows(w, n) x Cur

Tuesday, October 22, 13
slide-163
SLIDE 163

HiStar State as Structure

66

Label Label Label High Low Low Flows Flows Flows Scan Wrap Netd Decl ∀ w, s, n. Wrap(w) ⋀ Scan(s) ⋀ Netd(n) ⇒ Flows(s, w) ⋀ Flows(w, n) x Cur

Tuesday, October 22, 13
slide-164
SLIDE 164

HiStar State as Structure

66

Label Label Label High Low Low Flows Flows Flows Scan Wrap Netd Decl

∀ w, s, n. Wrap(w) ⋀ Scan(s) ⋀ Netd(n) ⇒ Flows(s, w) ⋀ Flows(w, n) x Cur

Tuesday, October 22, 13
slide-165
SLIDE 165

HiStar State Transformers

create_cat(&x) Action

67 Tuesday, October 22, 13
slide-166
SLIDE 166

Label Cur

HiStar State Transformers

create_cat(&x) Action

67

Flows

Tuesday, October 22, 13
slide-167
SLIDE 167

Label Cur

HiStar State Transformers

create_cat(&x) Action

67

Fresh Flows

Tuesday, October 22, 13
slide-168
SLIDE 168

Label Cur

HiStar State Transformers

create_cat(&x) Action Decl

67

Fresh Low x Flows

Tuesday, October 22, 13
slide-169
SLIDE 169

Label Cur

HiStar State Transformers

Intro Fresh Decl’(p, c) := Decl(p, c) ⋁ (Cur(p) ⋀ Fresh(c)) Structure Transform create_cat(&x) Action Decl

67

Fresh Low x Flows

Tuesday, October 22, 13
slide-170
SLIDE 170

HiStar State Transformers

raise(&x) Action

68

Label Cur Decl Fresh Low x Flows

Tuesday, October 22, 13
slide-171
SLIDE 171

HiStar State Transformers

raise(&x) Action

68

High Label Cur Decl Fresh x Flows

Tuesday, October 22, 13
slide-172
SLIDE 172

HiStar State Transformers

Intro Fresh High’(l, c) := High(l, c) ⋁ ∃ p. Cur(p) & Label(p, l) & x(c) Structure Transform raise(&x) Action

68

High Label Cur Decl Fresh x Flows

Tuesday, October 22, 13
slide-173
SLIDE 173

Summary: HiStar Semantics

  • We can define the HiStar semantics as FOL

predicate transforms and automatically generate a weaver for HiStar

  • FOL predicate transforms can describe

capability and DIFC semantics

69 Tuesday, October 22, 13
slide-174
SLIDE 174

Scanner Game

noop sync_fork noop create_cat(&c)

70

exec noop drop_decl(c) raise(c) exec ... noop sync_fork sync_fork

Tuesday, October 22, 13
slide-175
SLIDE 175

Scanner Game

create_cat(&c)

70

drop_decl(c) raise(c) exec ... sync_fork

Tuesday, October 22, 13
slide-176
SLIDE 176

HiWeave 𝛽 Performance

Generates code for clamwrap in < 3 mins

71 Tuesday, October 22, 13
slide-177
SLIDE 177 scanner() { sync_fork(); ... }

HiWeave

scanner() { create_cat(&c); sync_fork(); ... } Policy forall w, s, n. Wrap(w) && ...

Programmer

create_cat(&c): Decl’(p, c) := Decl(p, c) || ...

Weaver Generator

HiStar Designer

72 Tuesday, October 22, 13
slide-178
SLIDE 178

Outline

  • 1. Motivation, problem statement
  • 2. Previous work: Capsicum
  • 3. Ongoing work: HiStar
  • 4. Open challenges
73 Tuesday, October 22, 13
slide-179
SLIDE 179

Open Challenges

  • Automating abstraction refinement
  • Automating error diagnosis
  • Compositional synthesis
  • Optimizing generated code
  • Designing a policy logic
74 Tuesday, October 22, 13
slide-180
SLIDE 180

Automating Abstraction Refinement

  • Picking the right abstraction predicates

requires a lot of design effort

  • Can we refine the abstraction predicates

via counter-strategies?

75 Tuesday, October 22, 13
slide-181
SLIDE 181

Automating Error Diagnosis

  • When weaver fails, it has a counter-strategy
  • How can we simplify these when

presenting them to the user?

76 Tuesday, October 22, 13
slide-182
SLIDE 182

Compositional Synthesis

  • Real programs are structured

as a composition of processes

  • Policies are expressed naturally as

conjunction of local, global policies

  • Can we adapt compositional verification?

[Long, ’89]

77 Tuesday, October 22, 13
slide-183
SLIDE 183

HiStar Logger

Logger Local (security) policy: only Logger should be able to modify log log.txt

78 Tuesday, October 22, 13
slide-184
SLIDE 184

HiStar Logger

Logger Global (functionality) policy: under certain conditions, Logger will append log on behalf of Environment Environment log.txt

79 Tuesday, October 22, 13
slide-185
SLIDE 185

Optimizing Generated Code

  • Mean-payoff games present an appealing

cost model, but have high complexity in general

  • Can we apply any domain specific
  • ptimizations?
80 Tuesday, October 22, 13
slide-186
SLIDE 186

Designing a Policy Logic

  • The weaver generator allows a policy writer

to declare policies purely over privileges

  • What logic over privileges is easiest for a

policy writer to understand?

  • How do we evaluate value added?
81 Tuesday, October 22, 13
slide-187
SLIDE 187

TVLA

Our Collaborators

82

Capsicum-dev MIT

  • LL
Jeffrey Seibert Michael Zhivich Pawel Jakub Dawidek Khilan Gudka Ben Laurie Peter Neumann

HiStar

Nickolai Zeldovich Mooly Sagiv Tuesday, October 22, 13
slide-188
SLIDE 188 scanner() { sync_fork(); ... }

HiWeave

scanner() { create_cat(&c); sync_fork(); ... } Policy forall w, s, n. Wrap(w) && ... create_cat(&c): Decl’(p, c) := Decl(p, c) || ...

Weaver Generator

83

Questions?

Tuesday, October 22, 13
slide-189
SLIDE 189

Extra Slides

84 Tuesday, October 22, 13
slide-190
SLIDE 190

Three-valued logic

  • Values: true, false, and unknown
  • true & unknown = unknown
  • false & unknown = false
85 Tuesday, October 22, 13
slide-191
SLIDE 191

Three-valued Structures

Cur Parent Parent Cur Amb Cur Parent Amb Amb Cur Parent Parent Amb Amb ...

86 Tuesday, October 22, 13
slide-192
SLIDE 192

Abstraction Function

Cur Parent Parent Amb Amb alpha_{Cur} Cur Parent Amb

87 Tuesday, October 22, 13
slide-193
SLIDE 193

Abstraction Function

Cur Parent Parent Amb alpha_{Cur} Cur Parent Amb?

88 Tuesday, October 22, 13
slide-194
SLIDE 194

Abstract Fork (def)

Action Semantics fork() Intro Fresh Amb(p) := Amb(p) || (Fresh(p) & E q. Cur(q) & Amb(q)) Cur Parent Amb Parent Amb Cur Fresh Amb Amb

89 Tuesday, October 22, 13
slide-195
SLIDE 195

Abstract Fork (definite)

Action Semantics fork() Intro Fresh Amb(p) := Amb(p) || (Fresh(p) & E q. Cur(q) & Amb(q)) Parent Amb Cur Fresh Parent Amb Cur Parent Fresh Amb Amb

90 Tuesday, October 22, 13