Protecting Computer Systems through Eli liminating or Analyzing - - PowerPoint PPT Presentation

protecting computer systems
SMART_READER_LITE
LIVE PREVIEW

Protecting Computer Systems through Eli liminating or Analyzing - - PowerPoint PPT Presentation

Protecting Computer Systems through Eli liminating or Analyzing Vulnerabilities Byoungyoung Lee Georgia Institute of Technology 1 Computers are every rywhere 2 Computers are every rywhere Affecting every aspect of our life 2


slide-1
SLIDE 1

Protecting Computer Systems through Eli liminating or Analyzing Vulnerabilities

Byoungyoung Lee Georgia Institute of Technology

1

slide-2
SLIDE 2

Computers are every rywhere

2

slide-3
SLIDE 3

Computers are every rywhere

Affecting every aspect of our life

2

slide-4
SLIDE 4

Vulnerabilities are every rywhere

3

slide-5
SLIDE 5

Vulnerabilities are every rywhere

Human makes a mistake, and computers are made by human.

3

slide-6
SLIDE 6

Vulnerabilities are critical security problems

4

slide-7
SLIDE 7

Vulnerabilities are critical security problems

4

slide-8
SLIDE 8

Commodity computers are complex

Applications Operating system Hardware

5

slide-9
SLIDE 9

Commodity computers are complex

Applications Operating system Hardware

5

slide-10
SLIDE 10

Commodity computers are complex

Applications Operating system Hardware

5

slide-11
SLIDE 11

Commodity computers are complex

Applications Operating system Hardware

5

slide-12
SLIDE 12

Commodity computers are complex

Applications Operating system Hardware 9 million lines of code

5

slide-13
SLIDE 13

Commodity computers are complex

Applications Operating system Hardware 9 million lines of code 9 million lines of code

5

slide-14
SLIDE 14

Many vulnerabilities

Year # of vulnerabilities (CVE) 2012 5,297 2013 5,191 2014 7,946 2015 6,412

National Vulnerability Database, NIST

6

slide-15
SLIDE 15

Thesis focus and approaches

  • Thesis focus
  • Protecting computer systems from vulnerabilities
  • Approaches
  • Comprehensive understanding on both systems and vulnerabilities
  • Design practical security solutions for commodity systems

7

slide-16
SLIDE 16

Attacker’s view on vulnerabilities

Vulnerability Exploitation Compromise

8

slide-17
SLIDE 17

Attacker’s view on vulnerabilities

Vulnerability Exploitation Compromise Offer unexpected actions

8

slide-18
SLIDE 18

Attacker’s view on vulnerabilities

Vulnerability Exploitation Compromise Abuse vulnerabilities Offer unexpected actions

8

slide-19
SLIDE 19

Attacker’s view on vulnerabilities

Vulnerability Exploitation Compromise Abuse vulnerabilities Run malicious actions Offer unexpected actions

8

slide-20
SLIDE 20

Thesis topics

Vulnerability Exploitation Compromise

9

slide-21
SLIDE 21

Thesis topics

Vulnerability Exploitation Compromise

  • 1. Eliminating vulnerabilities
  • DangNull [NDSS 15]: Use-after-free
  • CaVer [Security 15]: Bad-casting

9

slide-22
SLIDE 22

Thesis topics

Vulnerability Exploitation Compromise

  • 1. Eliminating vulnerabilities
  • DangNull [NDSS 15]: Use-after-free
  • CaVer [Security 15]: Bad-casting

9

slide-23
SLIDE 23

Thesis topics

Vulnerability Exploitation Compromise

  • 2. Analyzing vulnerability
  • SideFinder: Timing-channels in hash tables
  • 1. Eliminating vulnerabilities
  • DangNull [NDSS 15]: Use-after-free
  • CaVer [Security 15]: Bad-casting

9

slide-24
SLIDE 24
  • 1. Eliminating vulnerabilities

DangNull [NDSS 15]: Eliminating use-after-free vulnerabilities CaVer [Security 15]: Eliminating bad-casting vulnerabilities

  • 2. Analyzing vulnerabilities

SideFinder: Analyzing timing-channel vulnerabilities

10

slide-25
SLIDE 25

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-26
SLIDE 26

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-27
SLIDE 27

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-28
SLIDE 28

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-29
SLIDE 29

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-30
SLIDE 30

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-31
SLIDE 31

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-32
SLIDE 32

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-33
SLIDE 33

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-34
SLIDE 34

Hacking: the art of f exploitation

Vulnerability Exploitation Compromise

11

slide-35
SLIDE 35

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

slide-36
SLIDE 36

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

slide-37
SLIDE 37

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

slide-38
SLIDE 38

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

slide-39
SLIDE 39

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

slide-40
SLIDE 40

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

slide-41
SLIDE 41

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

Look alike a benign behavior

slide-42
SLIDE 42

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

Look alike a benign behavior

slide-43
SLIDE 43

Difficult to prevent all bad things

12

Control-flow integrity Data-flow integrity

Difficult to know all legitimate control- and data-flows  Look alike a benign behavior

slide-44
SLIDE 44

Eliminating vulnerabilities

Vulnerability Exploitation Compromise

13

slide-45
SLIDE 45

Eliminating vulnerabilities

Vulnerability Exploitation Compromise

13

slide-46
SLIDE 46

Eliminating vulnerabilities

Vulnerability Exploitation Compromise

No way to bypass in the future

13

slide-47
SLIDE 47

Eliminating vulnerabilities

Vulnerability Exploitation Compromise

No way to bypass in the future

13

slide-48
SLIDE 48

Eliminating vulnerabilities

Vulnerability Exploitation Compromise

Transform a program such that a vulnerability never exists. No way to bypass in the future

13

slide-49
SLIDE 49
  • 1. Eliminating vulnerabilities

DangNull [NDSS 15]: Eliminating use-after-free vulnerabilities CaVer [Security 15]: Eliminating bad-casting vulnerabilities

  • 2. Analyzing vulnerabilities

SideFinder: Analyzing timing-channel vulnerabilities

14

slide-50
SLIDE 50

Vulnerabilities in Microsoft products

15

Use-after-free Bad-casting Heap-corruption

Exploitation Trends: From Potential Risk to Actual Risk, Microsoft

slide-51
SLIDE 51

Vulnerabilities in Microsoft products

15

Use-after-free

Exploitation Trends: From Potential Risk to Actual Risk, Microsoft

slide-52
SLIDE 52

Use-after-free

  • Root cause: a dangling pointer
  • A pointer points to a freed memory region
  • Using a dangling pointer leads to undefined program states
  • Easy to achieve arbitrary code executions
  • so called use-after-free

16

slide-53
SLIDE 53

class Doc : public Element { // … Element *child; }; class Body : public Element { // … Element *child; }; Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign();

Understanding use-after-free

17

A simplified use-after-free example from Chromium

slide-54
SLIDE 54

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child Allocate objects

slide-55
SLIDE 55

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child Propagate pointers Allocate objects

slide-56
SLIDE 56

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child Propagate pointers Allocate objects

slide-57
SLIDE 57

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child Propagate pointers Allocate objects

slide-58
SLIDE 58

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child Propagate pointers Allocate objects

slide-59
SLIDE 59

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child

Free an object

Propagate pointers Allocate objects

slide-60
SLIDE 60

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child

Free an object

Propagate pointers Allocate objects

slide-61
SLIDE 61

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child

freed Free an object

Propagate pointers Allocate objects

slide-62
SLIDE 62

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child

freed Free an object

Propagate pointers Allocate objects

slide-63
SLIDE 63

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child

freed Free an object

Propagate pointers Allocate objects

a dangling pointer

slide-64
SLIDE 64

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child

freed

Use a dangling pointer

Free an object

Propagate pointers Allocate objects

a dangling pointer

slide-65
SLIDE 65

Understanding use-after-free (i (in detail)

18

*doc *body Doc Body Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); *child *child

freed

Use a dangling pointer

Free an object

Propagate pointers Allocate objects

a dangling pointer

Attacker controlled

  • bject
slide-66
SLIDE 66

Challenges in identify fying dangling pointers

19

Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign();

slide-67
SLIDE 67

Challenges in identify fying dangling pointers

19

Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign();

slide-68
SLIDE 68

Challenges in identify fying dangling pointers

19

Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); Doc *doc = new Doc(); doc->child = body; Body *body = new Body(); doc->child->getAlign(); delete body;

slide-69
SLIDE 69

Challenges in identify fying dangling pointers

19

Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); Doc *doc = new Doc(); doc->child = body; Body *body = new Body(); doc->child->getAlign(); delete body;

slide-70
SLIDE 70

Challenges in identify fying dangling pointers

19

Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); Doc *doc = new Doc(); doc->child = body; Body *body = new Body(); doc->child->getAlign(); delete body;

Static analysis: inter-procedural and points-to analysis Dynamic analysis: precise pointer semantic tracking

slide-71
SLIDE 71

Challenges in identify fying dangling pointers

19

Doc *doc = new Doc(); Body *body = new Body(); doc->child = body; delete body; doc->child->getAlign(); Doc *doc = new Doc(); doc->child = body; Body *body = new Body(); doc->child->getAlign(); delete body;

Static analysis: inter-procedural and points-to analysis Dynamic analysis: precise pointer semantic tracking Difficult to scale for complex systems

slide-72
SLIDE 72

DangNull

  • DangNull: Eliminating the root cause of use-after-free
  • Design
  • Tracking Object Relationships
  • Nullifying dangling pointers

20

slide-73
SLIDE 73

Tracking object relationships

  • Intercept allocations/deallocations in runtime
  • Maintain Shadow Object Tree
  • Red-Black tree to efficiently keep object layout information
  • Node: (base address, size) pair

21

slide-74
SLIDE 74

Tracking object relationships

  • Intercept allocations/deallocations in runtime
  • Maintain Shadow Object Tree
  • Red-Black tree to efficiently keep object layout information
  • Node: (base address, size) pair

21

Doc *doc = new Doc();

slide-75
SLIDE 75

Tracking object relationships

  • Intercept allocations/deallocations in runtime
  • Maintain Shadow Object Tree
  • Red-Black tree to efficiently keep object layout information
  • Node: (base address, size) pair

21

Doc *doc = new Doc();

slide-76
SLIDE 76

Tracking object relationships

  • Intercept allocations/deallocations in runtime
  • Maintain Shadow Object Tree
  • Red-Black tree to efficiently keep object layout information
  • Node: (base address, size) pair

21

Doc *doc = new Doc();

Insert shadow obj:

  • Base address of allocation
  • Size of Doc
slide-77
SLIDE 77

Tracking object relationships

  • Intercept allocations/deallocations in runtime
  • Maintain Shadow Object Tree
  • Red-Black tree to efficiently keep object layout information
  • Node: (base address, size) pair

21

delete body; Doc *doc = new Doc();

Insert shadow obj:

  • Base address of allocation
  • Size of Doc
slide-78
SLIDE 78

Tracking object relationships

  • Intercept allocations/deallocations in runtime
  • Maintain Shadow Object Tree
  • Red-Black tree to efficiently keep object layout information
  • Node: (base address, size) pair

21

delete body; Doc *doc = new Doc();

Insert shadow obj:

  • Base address of allocation
  • Size of Doc

Remove shadow obj:

  • Using base address (body)
slide-79
SLIDE 79

Tracking object relationships

  • Instrument pointer propagations
  • Maintain backward/forward pointer trees for a shadow obj

22

Shadow obj. of Doc back fwd back fwd Shadow obj. of Body

doc->child = body;

*doc *body Doc Body *child

slide-80
SLIDE 80

Tracking object relationships

  • Instrument pointer propagations
  • Maintain backward/forward pointer trees for a shadow obj

22

Shadow obj. of Doc back fwd back fwd Shadow obj. of Body

doc->child = body; doc->child = body; trace(&doc->child, body);

*doc *body Doc Body *child

slide-81
SLIDE 81

Tracking object relationships

  • Instrument pointer propagations
  • Maintain backward/forward pointer trees for a shadow obj

22

Shadow obj. of Doc back fwd back fwd Shadow obj. of Body

doc->child = body; doc->child = body; trace(&doc->child, body);

*doc *body Doc Body *child

Forward

slide-82
SLIDE 82

Tracking object relationships

  • Instrument pointer propagations
  • Maintain backward/forward pointer trees for a shadow obj

22

Shadow obj. of Doc back fwd back fwd Shadow obj. of Body

doc->child = body; doc->child = body; trace(&doc->child, body);

*doc *body Doc Body *child

Backward Forward

slide-83
SLIDE 83

Tracking object relationships

  • Instrument pointer propagations
  • Maintain backward/forward pointer trees for a shadow obj

22

Shadow obj. of Doc back fwd back fwd Shadow obj. of Body

doc->child = body; doc->child = body; trace(&doc->child, body);

*doc *body Doc Body *child

Backward Forward

slide-84
SLIDE 84

Tracking object relationships

  • Instrument pointer propagations
  • Maintain backward/forward pointer trees for a shadow obj

22

Shadow obj. of Doc back fwd back fwd Shadow obj. of Body

doc->child = body; doc->child = body; trace(&doc->child, body);

*doc *body Doc Body *child

Backward Forward

This is heavily abstracted pointer semantic tracking, but it is enough to identify all dangling pointers

slide-85
SLIDE 85

Nullify fying dangling pointers

  • Nullify all backward pointers once the target object is freed
  • All backward pointers are dangling pointers
  • Dangling pointers have no semantics

23

*doc Freed *body Doc Body *child

slide-86
SLIDE 86

Im Implementation

  • Prototype of DangNull
  • Instrumentation: LLVM pass, +389 LoC
  • Runtime: compiler-rt, +3,955 LoC
  • Target applications
  • SPEC CPU 2006: one extra compiler and linker flag
  • Chromium: +27 LoC to .gyp build configuration file

24

slide-87
SLIDE 87

Evaluation on Chromium

  • Runtime overheads
  • 4.8% and 53.1% overheads in JavaScript and rendering benchmarks,

respectively

  • 7% increased page loading time for Alexa top 100 websites
  • Safely prevented 7 real-world use-after-free exploits in Chrome

25

slide-88
SLIDE 88
  • 1. Eliminating vulnerabilities

DangNull [NDSS 15]: Eliminating use-after-free vulnerabilities CaVer [Security 15]: Eliminating bad-casting vulnerabilities

  • 2. Analyzing vulnerabilities

SideFinder: Analyzing timing-channel vulnerabilties

26

slide-89
SLIDE 89

Vulnerabilities in Microsoft products

27

Use-after-free Bad-casting Heap-corruption

Exploitation Trends: From Potential Risk to Actual Risk, Microsoft

slide-90
SLIDE 90

Type conversions in C++ ++

  • static_cast
  • Compile-time conversions
  • Fast: no extra type verification in run-time
  • dynamic_cast
  • Run-time conversions
  • Requires Runtime Type Information (RTTI)
  • Slow: Extra verification by parsing RTTI
  • Typically prohibited in performance critical applications

28

slide-91
SLIDE 91

Upcasting and Downcasting

  • Upcasting
  • From a derived class to its parent class
  • Downcasting
  • From a parent class to one of its derived classes

29

slide-92
SLIDE 92

Upcasting and Downcasting

  • Upcasting
  • From a derived class to its parent class
  • Downcasting
  • From a parent class to one of its derived classes

29

slide-93
SLIDE 93

Upcasting and Downcasting

  • Upcasting
  • From a derived class to its parent class
  • Downcasting
  • From a parent class to one of its derived classes

29

Element HTMLElement SVGElement

slide-94
SLIDE 94

Upcasting and Downcasting

  • Upcasting
  • From a derived class to its parent class
  • Downcasting
  • From a parent class to one of its derived classes

29

Upcasting

Element HTMLElement SVGElement

slide-95
SLIDE 95

Upcasting and Downcasting

  • Upcasting
  • From a derived class to its parent class
  • Downcasting
  • From a parent class to one of its derived classes

29

Downcasting Upcasting

Element HTMLElement SVGElement

slide-96
SLIDE 96

Upcasting and Downcasting

  • Upcasting
  • From a derived class to its parent class
  • Downcasting
  • From a parent class to one of its derived classes

29

Downcasting Upcasting

Upcasting is always safe, but downcasting is not!

Element HTMLElement SVGElement

slide-97
SLIDE 97

Downcasting is not always safe!

30

class P { virtual ~P() {} int m_P; }; class D: public P { virtual ~D() {} int m_D; };

slide-98
SLIDE 98

Downcasting is not always safe!

30

vftptr for P int m_P class P { virtual ~P() {} int m_P; }; class D: public P { virtual ~D() {} int m_D; }; Access scope of P*

slide-99
SLIDE 99

Downcasting is not always safe!

30

vftptr for P int m_P class P { virtual ~P() {} int m_P; }; class D: public P { virtual ~D() {} int m_D; }; Access scope of P*

slide-100
SLIDE 100

Downcasting is not always safe!

30

vftptr for P int m_P vftptr for D int m_P int m_D class P { virtual ~P() {} int m_P; }; class D: public P { virtual ~D() {} int m_D; }; Access scope of P* Access scope of D*

slide-101
SLIDE 101

Downcasting can be bad ad-casting

31

P *pS = new P(); D *pD = static_cast<D*>(pS); pD->m_D;

vftptr for P int m_P int m_D

slide-102
SLIDE 102

Downcasting can be bad ad-casting

31

P *pS = new P(); D *pD = static_cast<D*>(pS); pD->m_D;

Bad-casting occurs: D is not a sub-object of P  Undefined behavior

D *pD = static_cast<D*>(pS);

vftptr for P int m_P int m_D

slide-103
SLIDE 103

Downcasting can be bad ad-casting

31

P *pS = new P(); D *pD = static_cast<D*>(pS); pD->m_D; pD->m_D;

Memory corruptions vftptr for P int m_P int m_D

slide-104
SLIDE 104

Downcasting can be bad ad-casting

31

P *pS = new P(); D *pD = static_cast<D*>(pS); pD->m_D; pD->m_D;

Memory corruptions vftptr for P int m_P int m_D

&(pD->m_D)

slide-105
SLIDE 105

Downcasting can be bad ad-casting

31

P *pS = new P(); D *pD = static_cast<D*>(pS); pD->m_D; pD->m_D;

Memory corruptions vftptr for P int m_P int m_D

&(pD->m_D)

slide-106
SLIDE 106

Downcasting can be bad ad-casting

31

P *pS = new P(); D *pD = static_cast<D*>(pS); pD->m_D; pD->m_D;

Memory corruptions vftptr for P int m_P int m_D

&(pD->m_D)

slide-107
SLIDE 107

Real-world exploits on bad-casting

  • CVE-2013-0912
  • A bad-casting vulnerability in Chrome
  • Used in 2013 Pwn2Own

32

Element SVGElement HTMLElement HTMLUnknownElement ContainerNode

slide-108
SLIDE 108

Real-world exploits on bad-casting

  • CVE-2013-0912
  • A bad-casting vulnerability in Chrome
  • Used in 2013 Pwn2Own

32

Element SVGElement HTMLElement HTMLUnknownElement ContainerNode

  • 1. Allocated
slide-109
SLIDE 109

Real-world exploits on bad-casting

  • CVE-2013-0912
  • A bad-casting vulnerability in Chrome
  • Used in 2013 Pwn2Own

32

Element SVGElement HTMLElement HTMLUnknownElement ContainerNode

  • 2. Upcasting
  • 1. Allocated
slide-110
SLIDE 110

Real-world exploits on bad-casting

  • CVE-2013-0912
  • A bad-casting vulnerability in Chrome
  • Used in 2013 Pwn2Own

32

Element SVGElement HTMLElement HTMLUnknownElement ContainerNode

  • 2. Upcasting
  • 3. Downcasting
  • 1. Allocated
slide-111
SLIDE 111

Real-world exploits on bad-casting

  • CVE-2013-0912
  • A bad-casting vulnerability in Chrome
  • Used in 2013 Pwn2Own

32

Element SVGElement HTMLElement HTMLUnknownElement ContainerNode

  • 2. Upcasting
  • 3. Downcasting
  • 1. Allocated

96 bytes 160 bytes

slide-112
SLIDE 112

CaVer

  • CaVer: CastVerifier
  • A bad-casting elimination tool
  • Design
  • Tracing runtime type information
  • Verify all casting operations

33

slide-113
SLIDE 113

P *ptr = new P; static_cast<D*>(ptr);

Technical overview

34

slide-114
SLIDE 114

P *ptr = new P; static_cast<D*>(ptr);

Technical overview

34

  • Q. Which class that ptr points to?

 Runtime type tracing

slide-115
SLIDE 115

P *ptr = new P; static_cast<D*>(ptr);

Technical overview

34

  • Q. Which class that ptr points to?

 Runtime type tracing

slide-116
SLIDE 116

P *ptr = new P; static_cast<D*>(ptr);

Technical overview

34

  • Q. Which class that ptr points to?

 Runtime type tracing

  • Q. What are the class relationships b/w P and D?

 THTable

slide-117
SLIDE 117

Type hierarchy table (THTable)

  • A set of all legitimate classes to be converted
  • Class names are hashed for fast comparison
  • Hierarchies are unrolled to avoid recursive traversal

35

hash(“P”) hash(“D”) … … hash(“P”)

THTable (P) THTable (D)

slide-118
SLIDE 118

Type hierarchy table (THTable)

  • A set of all legitimate classes to be converted
  • Class names are hashed for fast comparison
  • Hierarchies are unrolled to avoid recursive traversal

35

hash(“P”) hash(“D”) … … hash(“P”)

THTable (P) THTable (D)

Hashed class names

slide-119
SLIDE 119

Type hierarchy table (THTable)

  • A set of all legitimate classes to be converted
  • Class names are hashed for fast comparison
  • Hierarchies are unrolled to avoid recursive traversal

35

hash(“P”) hash(“D”) … … hash(“P”)

THTable (P) THTable (D)

Unrolled linearly

slide-120
SLIDE 120

Runtime type tracing

36

P *ptr = new P; P *ptr = new P; trace(ptr, &THTable(P));

slide-121
SLIDE 121

Runtime type tracing

36

P *ptr = new P;

Object (P)

ptr P *ptr = new P; trace(ptr, &THTable(P)); hash(“P”) …

THTable (P)

slide-122
SLIDE 122

Runtime type tracing

36

P *ptr = new P;

Object (P)

ptr P *ptr = new P; trace(ptr, &THTable(P)); hash(“P”) …

THTable (P) &THTable(P)

slide-123
SLIDE 123

Runtime type tracing

36

P *ptr = new P;

Object (P)

ptr P *ptr = new P; trace(ptr, &THTable(P)); hash(“P”) …

THTable (P) &THTable(P)

slide-124
SLIDE 124

Runtime type tracing

36

P *ptr = new P;

Object (P)

ptr P *ptr = new P; trace(ptr, &THTable(P)); hash(“P”) …

THTable (P) &THTable(P) Maintain an internal mapping from objects to metadata Heap: Alignment based direct mapping Stack: Per-thread red-black tree Global: Per-process red-black tree

slide-125
SLIDE 125

Runtime type verification

37

static_cast<D*>(ptr);

slide-126
SLIDE 126

Runtime type verification

37

static_cast<D*>(ptr);

slide-127
SLIDE 127

Runtime type verification

37

Object (P)

ptr hash(“P”) …

THTable (P) &THTable(P)

static_cast<D*>(ptr);

slide-128
SLIDE 128

Runtime type verification

37

Object (P)

ptr hash(“P”) …

THTable (P) &THTable(P)

static_cast<D*>(ptr);

  • 1. Locate metadata associated

with the object

slide-129
SLIDE 129

Runtime type verification

37

Object (P)

ptr hash(“P”) …

THTable (P) &THTable(P)

static_cast<D*>(ptr);

  • 2. Locate associated THTable
slide-130
SLIDE 130

Runtime type verification

37

Object (P)

ptr hash(“P”) …

THTable (P) &THTable(P)

static_cast<D*>(ptr);

  • 2. Locate associated THTable
slide-131
SLIDE 131

Runtime type verification

37

Object (P)

ptr hash(“P”) …

THTable (P) &THTable(P)

static_cast<D*>(ptr);

  • 3. Enumerate THTable

and check if hash(“D”) exists.

slide-132
SLIDE 132

Runtime type verification

37

Object (P)

ptr hash(“P”) …

THTable (P) &THTable(P)

static_cast<D*>(ptr);

THTable(P) does not have D  Bad-casting!

slide-133
SLIDE 133

Im Implementation

43

  • Prototype of CaVer
  • Added 3,540 lines of C++ code to LLVM compiler suites
  • Target applications,
  • SPEC CPU 2006: one extra compiler and linker flag
  • Chromium: 21 line changes to build configurations
  • Firefox: 10 line changes to build configurations
slide-134
SLIDE 134

Evaluation on Chromium and Firefox

  • Runtime overheads
  • 7.6% and 64.6% overheads in benchmarks
  • Safely prevented five real-world bad-casting exploits
  • Found 11 new vulnerabilities in Firefox and libstdc++

39

slide-135
SLIDE 135
  • 1. Eliminating vulnerabilities

DangNull [NDSS 15]: Eliminating use-after-free vulnerabilities CaVer [Security 15]: Eliminating bad-casting vulnerabilities

  • 2. Analyzing vulnerabilities

SideFinder: Analyzing timing-channel vulnerabilities

40

slide-136
SLIDE 136

Timing-channel vulnerabilities in hash tables

  • Timing-channel
  • A time taken to perform a certain operation leaks some sensitive information.
  • Hash tables
  • # of buckets are limited  collisions happen at some point
  • Collision resolution methods
  • Deterministic algorithm to decide the next bucket to be used

41

slide-137
SLIDE 137

Security sensitive data in hash tables

  • Address information
  • ASLR protections can be bypassed.
  • Discovered examples
  • PrivateName in WebKit
  • Inode cache in the Linux kernel
  • Filename information
  • Privacy can be breached.
  • Discovered examples
  • Dentry cache in the Linux kernel

42

slide-138
SLIDE 138

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode_hashtable

slide-139
SLIDE 139

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode_hashtable

slide-140
SLIDE 140

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode_hashtable inode_hash(sb, ino1)

slide-141
SLIDE 141

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1)

slide-142
SLIDE 142

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2)

slide-143
SLIDE 143

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2)

slide-144
SLIDE 144

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2) inode2

slide-145
SLIDE 145

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2) inode2

slide-146
SLIDE 146

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2) inode2 …

slide-147
SLIDE 147

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2) inode_hash(sb, inok) inode2 …

slide-148
SLIDE 148

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2) inode_hash(sb, inok) inode2 …

slide-149
SLIDE 149

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 … inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2) inode_hash(sb, inok) inode2 inodek …

slide-150
SLIDE 150

Case study on inode cache

  • inode_hashtable
  • Mapping from an inode number to an inode object
  • Using a linked list to handle collisions
  • inode_hash(sb, ino)
  • A hash function computing a bucket index for inode_hashtable
  • sb: an address of superblock (fixed, hidden security information)
  • ino: an inode number (controllable)

43

#0 bucket #1 bucket #2 bucket #3 bucket inode1 … inode_hashtable inode_hash(sb, ino1) inode_hash(sb, ino2) inode_hash(sb, inok) inode2 inodek …

Execution time differences  Inferring the value of sb

slide-151
SLIDE 151

Motivations

  • Confirming timing-channel vulnerability is difficult
  • No explicit data flows on leaked data
  • Involve multiple paths/runs to trigger an attack
  • Need to find a number of colliding inputs
  • Q. How to confirm the existence of security sensitive timing-channels?

 SideFinder

44

slide-152
SLIDE 152

SideFinder

  • Goal
  • Semi-automatically synthesize attacking inputs of side-channels in hash tables
  • Design
  • Input
  • A signature of a target hash function
  • Workflow
  • 1. Backward slicing
  • Identifying possible execution paths
  • 2. Concolic execution
  • Driving symbolic execution while avoiding path explosions
  • 3. Synthesize
  • At the bucket index computation, querying the solver to obtain multiple colliding inputs

45

slide-153
SLIDE 153

An example of workflow: inode cache

46

inode_hash(sb, ino)

  • 1. Backward slicing
slide-154
SLIDE 154

An example of workflow: inode cache

46

… …

inode_hash(sb, ino)

  • 1. Backward slicing
slide-155
SLIDE 155

An example of workflow: inode cache

46

… …

inode_hash(sb, ino)

  • 1. Backward slicing
slide-156
SLIDE 156

An example of workflow: inode cache

46

… …

inode_hash(sb, ino)

  • 1. Backward slicing
slide-157
SLIDE 157

An example of workflow: inode cache

46

… … …

inode_hash(sb, ino)

reiserfs

z

  • 1. Backward slicing
slide-158
SLIDE 158

An example of workflow: inode cache

46

x

… … …

ext4 inode_hash(sb, ino)

y

ext2 reiserfs

z

  • 1. Backward slicing
slide-159
SLIDE 159

An example of workflow: inode cache

46

x

… … …

ext4 inode_hash(sb, ino)

y

ext2 reiserfs

z

  • 1. Backward slicing
  • 2. Concolic execution
slide-160
SLIDE 160

An example of workflow: inode cache

46

x

… … …

ext4 inode_hash(sb, ino)

y

ext2 reiserfs

z

  • 1. Backward slicing
  • 2. Concolic execution
slide-161
SLIDE 161

An example of workflow: inode cache

46

x

… … …

ext4 inode_hash(sb, ino)

y

ext2 reiserfs

z

  • 1. Backward slicing
  • 2. Concolic execution
slide-162
SLIDE 162

An example of workflow: inode cache

46

x

… … …

ext4 inode_hash(sb, ino)

y

ext2 reiserfs

z

  • 1. Backward slicing
  • 2. Concolic execution
slide-163
SLIDE 163

An example of workflow: inode cache

46

x

… … …

ext4 inode_hash(sb, ino)

y

ext2 reiserfs

z

  • 1. Backward slicing
  • 2. Concolic execution
  • 3. Synthesize
  • find a set of X, which satisfies

inode_hash(sb, ino) == bucket_index

slide-164
SLIDE 164

Im Implementation

  • Backward slicing
  • Based on LLVM
  • Used a dependency analysis
  • Flow-insensitive, context-sensitive, and field-sensitive
  • Concolic execution
  • Based on S2E
  • Added a helper function for memory symbolization
  • Added a special op code to obtain multiple concrete values

47

slide-165
SLIDE 165

Evaluation on inode cache attacks

  • Backward slicing

48

slide-166
SLIDE 166

Evaluation on inode cache attacks

  • Backward slicing

48

# of taint sources SideFinder identified

slide-167
SLIDE 167

Evaluation on inode cache attacks

  • Backward slicing

48

A true interface reaching to inode_hash (i.e., to control an inode number)

slide-168
SLIDE 168

Evaluation on inode cache attacks

  • Backward slicing

48

SideFinder successfully identified all true sources

slide-169
SLIDE 169

Evaluation on inode cache attacks

  • Backward slicing

48

XFS implements its own hash table

slide-170
SLIDE 170

Evaluation on inode cache attacks

  • Concolic execution and synthesizing

49

Complexity: the number of clauses in a bucket expression Efficiency: time taken to synthesize 2,048 colliding inputs

slide-171
SLIDE 171

Thesis contributions

  • Analysis and formalization of emerging vulnerability classes
  • Use-after-free, bad-casting, and timing-side channels
  • Designs and implementations of practical security tools
  • Automated elimination: DangNull and CaVer
  • Analysis assistant: SideFinder
  • New security vulnerabilities
  • 14 previously unknown vulnerabilities in Firefox, stdlibc++, and the Linux

kernel

50

slide-172
SLIDE 172

Conclusion

  • Protect a system by eliminating or analyzing vulnerabilities
  • Eliminating vulnerabilities
  • DangNull: use-after-free vulnerabilities
  • CaVer: bad-casting vulnerabilities
  • Analyzing vulnerabilities
  • SideFinder: timing-channel vulnerabilities in hash tables

51

slide-173
SLIDE 173

Future work

  • Performance optimizations
  • Design efficient data structures for metadata
  • Utilize (or design new) hardware features
  • Eliminating other vulnerability classes
  • Heap overflow: a boundless heap
  • Survive from memory corruptions
  • Utilize existing error handling functions
  • Runtime exception transformation
  • DangNull transforms use-after-free to null-dereference

52

slide-174
SLIDE 174

Research collaborators:

  • Wenke Lee (advisor), Taesoo Kim (advisor), William Harris, Chengyu Song, Yeongjin

Jang, Wei Meng, Kangjie Lu, Changwoo Min, Sanidhya Kashyap (Georgia Institute of Technology)

  • Xinyu Xing (Pennsylvania State University)
  • Long Lu (Stony Brook University)
  • Billy Lau (Google)
  • Tielei Wang (Pangu Team)

Thank you!

53