Intent Semantics in the ABI Sergey Bratus, Julian Bangert Outline - - PowerPoint PPT Presentation

intent semantics in the abi
SMART_READER_LITE
LIVE PREVIEW

Intent Semantics in the ABI Sergey Bratus, Julian Bangert Outline - - PowerPoint PPT Presentation

Intent Semantics in the ABI Sergey Bratus, Julian Bangert Outline From faulty classic policies to a new sweet spot ABI-level objects and security policy ABI-level policy examples Why this works on x86 Future directions


slide-1
SLIDE 1

Intent Semantics in the ABI

Sergey Bratus, Julian Bangert

slide-2
SLIDE 2

Outline

  • From faulty classic policies to a new sweet spot
  • ABI-level objects and security policy
  • ABI-level policy examples
  • Why this works on x86
  • Future directions
slide-3
SLIDE 3

Traditional Security

  • Traditional security models assume:
  • One process does one thing
  • Static bag of permissions for the

entire process

  • Usable at any point, in any order,

any number of times

slide-4
SLIDE 4

If JS is your OS, what is your reference monitor?

  • Is your data in objects you can label?
  • Does it even touch any filesystem?
  • If it is, can you trap on access to it?
  • Does it ever go through a syscall or

VM lookup?

  • For DOM: Is Same Origin even the right

labelling scheme?

Virtual memory Valuable 
 Objects

?

MMU

slide-5
SLIDE 5

A process is a process is a process

  • For a "task", the "bag of permissions" model is
  • adequate. For a "process", it isn't
  • A "process" goes through changes over time
  • Yet in policy we treat it as just a "task", monolithic
  • This is wrong and counter-intuitive
  • What are the "units" or "phases" of a process?
slide-6
SLIDE 6

http://www.tomdalling.com/blog/software-design/solid-class-design-the-liskov-substitution-principle/

slide-7
SLIDE 7

Process phases

  • "Phase" ~ code unit ~ EIP range ~ memory section
slide-8
SLIDE 8

"Some thoughts on security after ten years of qmail", D.J. Bernstein, 2007

  • Used process isolation as security boundaries
  • Split functionality into many per-process pieces
  • Enforced explicit data flow via process isolation
  • Avoided in-process parsing
  • Least privilege was a distraction, but isolation worked

http://cr.yp.to/qmail/qmailsec-20071101.pdf

slide-9
SLIDE 9

Traditional Security vs. Modern Software

  • Software is complicated, integrates many functions
  • "The *** Shopping App Now Backs Up Your Photos"
  • High engineering costs to manually isolate

components/functional units a-la qmail

  • Semantic subdivision occurs at ABI section level
  • Code & data sections reflect different intent
  • Functional units ~ ABI semantic units
slide-10
SLIDE 10

Policy Granularity: ABI is the Sweet Spot

ABI

slide-11
SLIDE 11

Intent-level semantics

  • "The gostak distims the doshes" 

  • - Andrew Ingraham, 1903
  • Non-dictionary words, English grammar
  • Semantics == relationships between terms
  • Relationships between code & data sections

reflect their intent, often uniquely

slide-12
SLIDE 12

Access relationships are key to programmer intent

  • Unit semantics ~ Explicit data flows (cf. qmail)
slide-13
SLIDE 13

Separation of concerns in OS engineering practice

  • Sections describe the intent of code and data
  • Example: Dynamic linker/loader operates on
  • GOT in ELF, function stubs in PLT
  • IAT, import & export data tables in PE
slide-14
SLIDE 14

Enforcing

  • Modern OS loaders discard section information
  • New architecture:
  • 'Unforgetful loader' preserves section identity

after loading

  • Enforcement scheme for intent-level semantics
  • Better tools to capture semantics in ABI
slide-15
SLIDE 15

Motivating Example

slide-16
SLIDE 16

Example policies

  • Web application decompresses a PNG file
  • Mental model

.PNG file Bitmap

libpng

slide-17
SLIDE 17

What attackers see

malicious .PNG Bitmap with leaked data .PNG file private key

libpng w/ bugs

no-longer-private key

slide-18
SLIDE 18

Or

malicious .PNG Bitmap overwrites critical data .PNG file, with exploit

libpng w/ bugs

Authorized keys

slide-19
SLIDE 19

Mapping it into the ABI

malicious .PNG private key

libssl .data

bitmap

libpng .input libpng .output

  • Easy to introduce new sections
  • Each code segment can get

different permissions

  • Only libssl.text can access

libssl.data

  • libpng.text can only access

libpng.input and libpng.output

  • And libpng.input can only be

read by libpng.

slide-20
SLIDE 20

Back to our example

SSL initialization SSL libpng app logic SSL keys Input buffer Output buffer

RW R RW R W RW

slide-21
SLIDE 21

The Implementation

http://upload.wikimedia.org/wikipedia/commons/a/a6/Professor_Lucifer_Butts.gif

slide-22
SLIDE 22

Implementation on X86

  • Prototype on Linux with X86 virtual memory
  • Each state of execution sees a different subset of the

address space

  • Traps handle state transitions by changing CR3
  • Each state has its own page tables that cache part of

the address space, reusing existing TLB invalidation primitives.

  • Use PCID on newer processors to reduce TLB misses
slide-23
SLIDE 23
  • Performance hit still rather bad: 30% on simple

NGINX benchmark isolating all libraries

  • Too many state transitions on the hot path
  • Policy must be adapted to application structure
  • Less overhead (~15%) when running on KVM
  • KVM already incurs performance costs, so we

don't have to suffer them

  • KVM also optimizes virtual memory handling

Prototype:
 Cloud to the rescue!

slide-24
SLIDE 24

Binary Rewriting Tools

  • Policy injection through metadata rewriting:
  • Mithril, currently only implemented for ELF
  • Translates binaries into a canonical form that is less

context-dependent and can be easily modified

  • Tested on the entire Debian x86_64 archive,

producing a bootable system

  • ~25GB of packages
slide-25
SLIDE 25

Future directions

  • Working on enforcing ELFBac-style policies with CFI
  • Implementation to ARM (because phones rule!):
  • Domain Control Register: 16 sub-spaces that can

be disabled/enabled without flushing caches

  • Can handle a sub-lattice of an ELFbac policy 


to reduce supervisor entries.

  • Would have to run all user space under virtualization,

in kernel mode

slide-26
SLIDE 26

Takeaway

  • Per-process bags of permission are no longer a

suitable basis for policy

  • Instead, ABI-level memory objects at process

runtime are the sweet spot for security policy

  • Modern ABIs provide enough granularity to capture

programmers intent w.r.t. code and data units

  • Intent-level semantics compatible with ABI,

standard build/binary tool chains