ROP Gadget Prevalence and Survival under Compiler-based Binary - - PowerPoint PPT Presentation

rop gadget prevalence and survival under compiler based
SMART_READER_LITE
LIVE PREVIEW

ROP Gadget Prevalence and Survival under Compiler-based Binary - - PowerPoint PPT Presentation

Background Evaluation Conclusion ROP Gadget Prevalence and Survival under Compiler-based Binary Diversification Schemes Joel Coffman Daniel M. Kelly Christopher C. Wellons Andrew S. Gearhart Johns Hopkins University Applied Physics


slide-1
SLIDE 1

Background Evaluation Conclusion

ROP Gadget Prevalence and Survival under Compiler-based Binary Diversification Schemes

Joel Coffman Daniel M. Kelly Christopher C. Wellons Andrew S. Gearhart

Johns Hopkins University Applied Physics Laboratory

2nd International Workshop on Software Protection

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 1 / 22

slide-2
SLIDE 2

Background Evaluation Conclusion Software Diversity

Cybersecurity

Current Landscape

Compromise once, compromise everywhere

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 2 / 22

slide-3
SLIDE 3

Background Evaluation Conclusion Software Diversity

Cybersecurity

Current Landscape

Compromise once, compromise everywhere

◮ Systems are homogeneous and share vulnerabilities

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 2 / 22

slide-4
SLIDE 4

Background Evaluation Conclusion Software Diversity

Cybersecurity

Current Landscape

Compromise once, compromise everywhere

◮ Systems are homogeneous and share vulnerabilities ◮ Single exploit reused to compromise all systems

◮ e.g., Morris, Nimda, Conficker, and Heartbleed

Exploit

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 2 / 22

slide-5
SLIDE 5

Background Evaluation Conclusion Software Diversity

Cybersecurity

Current Landscape

Compromise once, compromise everywhere

◮ Systems are homogeneous and share vulnerabilities ◮ Single exploit reused to compromise all systems

◮ e.g., Morris, Nimda, Conficker, and Heartbleed

Exploit

Exploit Exploit

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 2 / 22

slide-6
SLIDE 6

Background Evaluation Conclusion Software Diversity

Cybersecurity (continued)

Diversity

Software diversity breaks the assumption of consistency in

  • perational environments

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 3 / 22

slide-7
SLIDE 7

Background Evaluation Conclusion Software Diversity

Cybersecurity (continued)

Diversity

Software diversity breaks the assumption of consistency in

  • perational environments

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 3 / 22

slide-8
SLIDE 8

Background Evaluation Conclusion Software Diversity

Cybersecurity (continued)

Diversity

Software diversity breaks the assumption of consistency in

  • perational environments

Exploit

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 3 / 22

slide-9
SLIDE 9

Background Evaluation Conclusion Software Diversity

Cybersecurity (continued)

Diversity

Software diversity breaks the assumption of consistency in

  • perational environments

Exploit

Exploit Exploit

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 3 / 22

slide-10
SLIDE 10

Background Evaluation Conclusion Software Diversity

Cybersecurity (continued)

Diversity

Software diversity breaks the assumption of consistency in

  • perational environments

◮ Increases attacker cost by reducing exploit reuse

Exploit

Exploit Exploit

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 3 / 22

slide-11
SLIDE 11

Background Evaluation Conclusion Software Diversity

Software Diversity

Opportunities

Techniques exist to introduce diversity throughout the software development process

◮ Design diversity ◮ N-version programming ◮ Diversifying compilers ◮ Instruction set architecture

(ISA) randomization

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 4 / 22

slide-12
SLIDE 12

Background Evaluation Conclusion Software Diversity

Software Diversity

Opportunities

Techniques exist to introduce diversity throughout the software development process

◮ Design diversity ◮ N-version programming ◮ Diversifying compilers ◮ Instruction set architecture

(ISA) randomization Our focus: diversifying compilers

◮ Allows transformation and optimization using existing tools ◮ Several open source projects exist

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 4 / 22

slide-13
SLIDE 13

Background Evaluation Conclusion Software Diversity

Reducing Exploit Reuse

Code reuse attacks are increasingly common

◮ Response to preventing execution of code in data segments ◮ Return-oriented programming (ROP) is a class of code

reuse attacks

← Increasing Address

pop %rdx ret mov %rsi, %rdx ret pop %rdx ret add %rsi, %rdx ret . . . mov %rsi, %rdx ret SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 5 / 22

slide-14
SLIDE 14

Background Evaluation Conclusion Software Diversity

Prior Work

Little work evaluates the effectiveness of the proposed techniques

◮ Many security evaluations are based on logical arguments

  • r concrete attacks

The study of how diversity affects the adversary’s effort is in its infancy. [. . . ] Numerous papers have been published on how to perform sound performance evaluations; [. . . ] a similar effort should be undertaken with respect to efficacy metrics for diversified software. [Larsen et al., 2014]

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 6 / 22

slide-15
SLIDE 15

Background Evaluation Conclusion Software Diversity

Prior Work (continued)

Few studies consider how diversity interferes with exploit reuse

◮ Testing against concrete attacks does not demonstrate

effectiveness against alternative tactics

◮ e.g., the transition from code injection to code reuse attacks

◮ Attack-specific analyses should consider an attacker’s

learning

◮ e.g., invariance among diversified variants SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 7 / 22

slide-16
SLIDE 16

Background Evaluation Conclusion Software Diversity

Prior Work (continued)

Few studies consider how diversity interferes with exploit reuse

◮ Testing against concrete attacks does not demonstrate

effectiveness against alternative tactics

◮ e.g., the transition from code injection to code reuse attacks

◮ Attack-specific analyses should consider an attacker’s

learning

◮ e.g., invariance among diversified variants

Today Software Monoculture Tomorrow Diversified Software

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 7 / 22

slide-17
SLIDE 17

Background Evaluation Conclusion Software Diversity

Gadget Survival

Figure: Gadget locations in two variants (red, blue) of dirname with common gadgets circled in green.

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 8 / 22

slide-18
SLIDE 18

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Outline

Background Evaluation Diversity Techniques Data Sets Gadget Counting Gadget Survival Conclusion

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 9 / 22

slide-19
SLIDE 19

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Diversity Techniques

Techniques implemented by the multicompiler [Homescu et al., 2013] and Obfuscator-LLVM [Junod et al., 2015] NOP insertion Changes address of ROP gadgets Instruction substitution Replaces instructions with arithmetic identities

◮ e.g., b + c = b − (−c) = −(−b + (−c))

Schedule randomization Reorders independent instructions Bogus control flow Inserts a basic block with an opaque predicate to hinder reverse engineering Control flow flattening Obfuscates the control flow graph via indirect jumps using “jump tables” Function shuffling Reorders functions in the executable

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 10 / 22

slide-20
SLIDE 20

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Data Sets

GNU core utilities

◮ 103 different binaries (≈ 60 KLOC)

◮ Many binaries limits the impact of outliers on analysis

◮ Open source for reproducibility and amenable to

compiler-based diversity schemes

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 11 / 22

slide-21
SLIDE 21

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Data Sets

GNU core utilities

◮ 103 different binaries (≈ 60 KLOC)

◮ Many binaries limits the impact of outliers on analysis

◮ Open source for reproducibility and amenable to

compiler-based diversity schemes

Variants

◮ Generate 100 unique variants for each diversity technique ◮ Select 4000 unique combinations from the

100

k

  • possibilities

◮ 4000 ≈

max

k∈{2,...,16}

100 k

  • SPRO ’16

ROP Gadgets under Binary Diversity Schemes Coffman et al. 11 / 22

slide-22
SLIDE 22

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Metrics

Statically identify all gadgets in binaries

◮ Disassemble a sliding window of 25 bytes looking for a valid

sequence that terminates in a return instruction

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 12 / 22

slide-23
SLIDE 23

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Metrics

Statically identify all gadgets in binaries

◮ Disassemble a sliding window of 25 bytes looking for a valid

sequence that terminates in a return instruction Survivor [Homescu et al., 2013] Identical gadgets have the same sequence of bytes and same offset in binary

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 12 / 22

slide-24
SLIDE 24

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Metrics

Statically identify all gadgets in binaries

◮ Disassemble a sliding window of 25 bytes looking for a valid

sequence that terminates in a return instruction Survivor [Homescu et al., 2013] Identical gadgets have the same sequence of bytes and same offset in binary Bag of Gadgets Identical gadgets have the same sequence of bytes

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 12 / 22

slide-25
SLIDE 25

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Metrics

Statically identify all gadgets in binaries

◮ Disassemble a sliding window of 25 bytes looking for a valid

sequence that terminates in a return instruction Survivor [Homescu et al., 2013] Identical gadgets have the same sequence of bytes and same offset in binary

◮ Represents no prior knowledge available to

attacker Bag of Gadgets Identical gadgets have the same sequence of bytes

◮ Represents attacker with knowledge of

application but not the specific variant

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 12 / 22

slide-26
SLIDE 26

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Number of Gadgets

Most diversity techniques increase the number of gadgets

◮ Modifying binary introduces (different) gadgets not present

in original

Figure: Kernel density estimate of the probability density function of the change in the number of gadgets

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 13 / 22

slide-27
SLIDE 27

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Gadget Survival (Survivor)

1–8% of gadgets are common among variants

◮ Population size has little impact on survival rate

Figure: Median gadget survival across the GNU core utilities

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 14 / 22

slide-28
SLIDE 28

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Gadget Survival (Bag of Gadgets)

Significantly worse performance than the Survivor metric

◮ Risk if information disclosure vulnerabilities exist

Figure: Median gadget survival across the GNU core utilities

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 15 / 22

slide-29
SLIDE 29

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Gadgets Remaining

Very few gadgets are common to all variants

◮ Many attacks require only a few gadgets (≈ 10–20 [Pappas

et al., 2012])

500 1000 1500 2000 2500 3000 Gadgets 5 10 15 20 25 30 Frequency

Histogram of Gadgets

Figure: Histogram of the raw number of gadgets in the GNU core utilities

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 16 / 22

slide-30
SLIDE 30

Background Evaluation Conclusion Diversity Techniques Data Sets Gadget Counting Gadget Survival

Gadget Locations

Is it possible to identify surviving gadgets a priori?

Figure: Location distribution of gadgets that survive diversification

Most surviving gadgets appear at the start of the binary

◮ Fewer opportunities for diversification

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 17 / 22

slide-31
SLIDE 31

Background Evaluation Conclusion Future Work

Outline

Background Evaluation Conclusion Future Work

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 18 / 22

slide-32
SLIDE 32

Background Evaluation Conclusion Future Work

Conclusions

Empirical evaluation of the effectiveness of existing software diversity techniques

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 19 / 22

slide-33
SLIDE 33

Background Evaluation Conclusion Future Work

Conclusions

Empirical evaluation of the effectiveness of existing software diversity techniques Survivor The number of ROP gadgets surviving diversification is close to the threshold required for a successful attack

◮ The number of surviving gadgets is essentially

constant across the GNU core utilities

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 19 / 22

slide-34
SLIDE 34

Background Evaluation Conclusion Future Work

Conclusions

Empirical evaluation of the effectiveness of existing software diversity techniques Survivor The number of ROP gadgets surviving diversification is close to the threshold required for a successful attack

◮ The number of surviving gadgets is essentially

constant across the GNU core utilities Bag of Gadgets Minimal effort expected to adapt an existing exploit to a different variant

◮ Challenge only for attackers without access to

target variant

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 19 / 22

slide-35
SLIDE 35

Background Evaluation Conclusion Future Work

Ideal Diversity Schemes

What defines a “good” diversity scheme?

◮ Resistance to attacks on a single variant ◮ Reducing exploit reuse among diversified variants

◮ Diversity improves the security of the population

◮ Resistance to reverse engineering for vulnerability detection

and detection of the diversity details

◮ Obfuscation is a related area of study (as is anti-attribution) ◮ Diversity schemes ideally follow Kerckhoffs’s Principle SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 20 / 22

slide-36
SLIDE 36

Background Evaluation Conclusion Future Work

Future Work

Open research questions

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 21 / 22

slide-37
SLIDE 37

Background Evaluation Conclusion Future Work

Future Work

Open research questions

◮ Theoretical bounds on the effectiveness of diversity

techniques

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 21 / 22

slide-38
SLIDE 38

Background Evaluation Conclusion Future Work

Future Work

Open research questions

◮ Theoretical bounds on the effectiveness of diversity

techniques

◮ Interaction among techniques being composed

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 21 / 22

slide-39
SLIDE 39

Background Evaluation Conclusion Future Work

Future Work

Open research questions

◮ Theoretical bounds on the effectiveness of diversity

techniques

◮ Interaction among techniques being composed ◮ Feasibility of identifying surviving gadgets without analyzing

the entire population

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 21 / 22

slide-40
SLIDE 40

Background Evaluation Conclusion Future Work

Future Work

Open research questions

◮ Theoretical bounds on the effectiveness of diversity

techniques

◮ Interaction among techniques being composed ◮ Feasibility of identifying surviving gadgets without analyzing

the entire population

◮ New metrics that quantify the security impact of diversity

techniques

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 21 / 22

slide-41
SLIDE 41

Background Evaluation Conclusion Future Work

Questions?

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 22 / 22

slide-42
SLIDE 42

References Glossary Glossary

Appendix

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 1 / 4

slide-43
SLIDE 43

References Glossary Glossary

References I

[Homescu et al., 2013] Homescu, A., Neisius, S., Larsen, P ., Brunthaler, S., and Franz, M. (2013). Profile-guided Automated Software Diversity. In Proceedings of the 2013 IEEE/ACM International Symposium on Code Generation and Optimization (CGO), CGO ’13, pages 1–11. [Junod et al., 2015] Junod, P ., Rinaldini, J., Wehrli, J., and Michielin, J. (2015). Obfuscator-LLVM: Software Protection for the Masses. In Proceedings of the 1st International Workshop on Software Protection, SPRO ’15, pages 3–9. [Larsen et al., 2014] Larsen, P ., Homescu, A., Brunthaler, S., and Franz, M. (2014). SoK: Automated Software Diversity. In 2014 IEEE Symposium on Security and Privacy, pages 276–291.

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 2 / 4

slide-44
SLIDE 44

References Glossary Glossary

References II

[Pappas et al., 2012] Pappas, V., Polychronakis, M., and Keromytis,

  • A. D. (2012). Smashing the Gadgets: Hindering Return-Oriented

Programming Using In-place Code Randomization. In 2012 IEEE Symposium on Security and Privacy, pages 601–615.

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 3 / 4

slide-45
SLIDE 45

References Glossary Glossary

Glossary I

ISA instruction set architecture. 11, 12 KLOC thousands of lines of code. 20, 21 ROP return-oriented programming. 13, 19, 32–34

SPRO ’16 ROP Gadgets under Binary Diversity Schemes Coffman et al. 4 / 4