POKING HOLES IN INFORMATION HIDING Angelos Oikonomopoulos Elias - - PowerPoint PPT Presentation

poking holes in information hiding
SMART_READER_LITE
LIVE PREVIEW

POKING HOLES IN INFORMATION HIDING Angelos Oikonomopoulos Elias - - PowerPoint PPT Presentation

POKING HOLES IN INFORMATION HIDING Angelos Oikonomopoulos Elias Athanasopoulos Herbert Bos Cristiano Giuffrida Vrije Universiteit Amsterdam Teaser Break ideal information hiding in seconds Few probes, typically no crashes


slide-1
SLIDE 1

POKING HOLES IN INFORMATION HIDING

Angelos Oikonomopoulos Elias Athanasopoulos Herbert Bos Cristiano Giuffrida

Vrije Universiteit Amsterdam

slide-2
SLIDE 2

Teaser

  • Break ideal information hiding in seconds
  • Few probes, typically no crashes
  • Primitives pervasive in server programs
slide-3
SLIDE 3

ASLR today

  • No longer a strong defense by itself
  • Plays a pivotal role in powerful new defenses:

– Shadow stacks – Secure heap allocators – CPI (OSDI ’14) – StackArmor (NDSS ’15) – ASLR‐guard (CCS ’15) – SafeStack (clang/llvm) – …

slide-4
SLIDE 4

ASLR 2001 2004 32‐bit ASLR bypass Fine‐grained ASLR 2006 2013 JIT ROP Pointer‐free Information hiding 2014 2015 Huge hidden area bypass Thread spraying 2016

slide-5
SLIDE 5

Ideal information hiding

  • The hidden area:

– Has no pointers in memory referring to it – Is as small as possible – Does not grow during the execution

slide-6
SLIDE 6

Ideal information hiding

  • The hidden area:

– Has no pointers in memory referring to it – Is as small as possible – Does not grow during the execution

Threat model: arbitrary RW is okay!

slide-7
SLIDE 7
slide-8
SLIDE 8

Let’s have a look

at a Linux (PIE)

Address Space

slide-9
SLIDE 9

code PC stack SP heap

Holes

mmap

slide-10
SLIDE 10

code PC stack SP heap

Holes

mmap

Hidden area

slide-11
SLIDE 11

code PC stack SP heap mmap

A B C

slide-12
SLIDE 12

Let’s not look for the hidden area

but for the holes!

slide-13
SLIDE 13

Even if we remove all pointers

There is one “pointer” left: Then:

– Leak size of the largest hole  Infer hidden area location – Not stored in user memory  Can’t leak directly – However, we can side‐channel the kernel to spill the beans!

the size of the hole itself.

slide-14
SLIDE 14

So look for the holes

  • Intuition:

– repeatedly allocate large chunks of memory of size L until we find the “right size”

Succeeds! Sizeof(Hole) ≥ L

slide-15
SLIDE 15

So look for the holes

  • Intuition:

– repeatedly allocate large chunks of memory of size L until we find the “right size”

Too large, alloc fails! Sizeof(Hole) < L

slide-16
SLIDE 16

So look for the holes

  • Intuition:

– repeatedly allocate large chunks of memory of size L until we find the “right size”

Succeeds! Sizeof(Hole) ≥ L

slide-17
SLIDE 17

So look for the holes

  • Intuition:

– repeatedly allocate large chunks of memory of size L until we find the “right size”

Too large, alloc fails! Sizeof(Hole) < L

slide-18
SLIDE 18

So look for the holes

  • Intuition:

– repeatedly allocate large chunks of memory of size L until we find the “right size”

Nailed it!

Binary search

slide-19
SLIDE 19

Ephemeral Allocation Primitive

  • For each probe (i.e., server request):
  • Strategy: allocation+deallocation, repeat

ptr = malloc(size);

...

free(ptr); reply(result);

slide-20
SLIDE 20

Ephemeral Allocation Primitive

  • Say:

–Single hidden area is in A (*) –Hidden area splits A in two –L is the largest hole in AS –We can find L via binary search

L S H

* See paper for generalization

slide-21
SLIDE 21

Of course we still miss 1 bit of entropy

don’t know if large hole is above or below area

S L L S

slide-22
SLIDE 22

Would be great

if we could solve this

slide-23
SLIDE 23

Persistent Allocation Primitive

  • For each request:
  • Pure persistent primitives rare
  • But we can often turn ephemeral

into persistent

– Keep the connection open – Do not complete the req‐reply ptr = malloc(size);

...

reply(result);

slide-24
SLIDE 24

Ephemeral + persistent yields final bit

  • 1. Determine L using ephemeral (binary search)
  • 2. Allocate L using persistent (removing L from AS)
  • 3. Reliably read memory at:

and find either hidden area or 0s:

hole_bottom_addr + L

L S S L

slide-25
SLIDE 25

So we need

  • A way to effect large allocations repeatedly
  • A way to detect whether they failed

Note: we want to attack info hiding

 Assume arbitrary read/write primitives

slide-26
SLIDE 26

Here is what we do

  • A way to effect large allocations repeatedly
  • A way to detect whether they failed
  • When server is in quiescent state

– Taint all memory – See which bytes end up in allocation size

slide-27
SLIDE 27

Here is what we do

  • A way to effect large allocations repeatedly
  • A way to detect whether they failed

Options

  • Direct observation (most common)

– E.g., HTTP 200 vs. 500

  • Fault side channels

– E.g., HTTP 200 vs. crash

  • Timing side channels

– E.g., VMA cache hit vs. miss

slide-28
SLIDE 28

Examples

  • Nginx

– Failed allocation: Connection close.

  • Lighttpd

– We crash both when

  • allocation fails (too large) and
  • succeeds (but allocation > than physical memory)

– But in former case: crash immediately – In latter case, many page faults, takes a long time

slide-29
SLIDE 29

Discovered primitives

Program # Ephemeral Persistent Crash‐ free bind 2 ✔ ✔ ✔ lighttpd 3 ✔ ✔ ✘ mysql 3 ✔ ✔ ✔ nginx 5 ✔ ✔ ✔

slide-30
SLIDE 30

How fast is it?

  • Pretty fast

– Allocations/deallocations are cheap – End‐to‐end attack is O( log[ sizeof(AS) ] ) – 37 probes in the worst case on nginx – Crash‐free, completes in a few seconds

  • Existing memory scanning primitives

– Remote side channels, CROP, etc. – End‐to‐end attack is O( sizeof(AS) ) – 2^35 probes in the worst case

slide-31
SLIDE 31

Memory overcommit:

  • OS should allow (virtual) allocations beyond

available physical memory

– Common in server settings – Required by some applications:

  • Reddis, Hadoop, virtualization, etc.
  • However, even when disabled:

– Allocation oracles still possible – But attacker has to bypass overcommit restrictions

Assumption

slide-32
SLIDE 32

Mitigations

  • strict overcommit

+ reduces attack surface ‐ compatibility issues

  • RLIMIT_AS

+ stops attacks ‐ requires per‐application policies

  • APM

+ preserves compatibility ‐ probabilistic

slide-33
SLIDE 33

Conclusion

  • Allocation oracles, new primitives against ASLR:

– Efficient – Layout‐agnostic – Pervasive

  • Can bypass all information hiding‐based defenses
  • Even ideal information hiding is insufficient
  • Time for better (meta)data protection techniques
  • More info: https://www.vusec.net/nowhere‐to‐hide

Vrije Universiteit Amsterdam