to gain kernel privileges Writer : MARK SEABORN @GOOGLE Presenter - - PowerPoint PPT Presentation

to gain kernel privileges
SMART_READER_LITE
LIVE PREVIEW

to gain kernel privileges Writer : MARK SEABORN @GOOGLE Presenter - - PowerPoint PPT Presentation

Exploiting the DRAM row hammer bug to gain kernel privileges Writer : MARK SEABORN @GOOGLE Presenter : Jiwon Choi Introduction Exploit ! without exploiting software bug Row hammer repeated accesses DRAMs row DRAM chipset DRAM


slide-1
SLIDE 1

Exploiting the DRAM row hammer bug to gain kernel privileges

Writer : MARK SEABORN @GOOGLE Presenter : Jiwon Choi

slide-2
SLIDE 2

… without exploiting software bug

Exploit !

Introduction

slide-3
SLIDE 3

Row hammer

DRAM chipset

repeated accesses DRAM’s row

slide-4
SLIDE 4

DRAM Structure

DRAM chipset

slide-5
SLIDE 5

DRAM chipset Rank Rank Rank Rank

DRAM Structure

(Diagram from ARMOR project, University of Manchester)

slide-6
SLIDE 6

Rank Bank ex) 4GB memory = 2ranks * 8 banks *8K per row * 32768 rows

DRAM Structure

slide-7
SLIDE 7

01

DRAM ? Dynamic RAM !

slide-8
SLIDE 8

DRAM is really dynamic!

slide-9
SLIDE 9
slide-10
SLIDE 10

X O

slide-11
SLIDE 11

DRAM row buffer

Row buffer

slide-12
SLIDE 12

DRAM row buffer

Row buffer

slide-13
SLIDE 13

Open

  • raise wordlin

line to high voltage Row buffer

slide-14
SLIDE 14

Row buffer Open

  • raise wordline to high voltage
  • Connecting capacitor to bitl

bitlin ine

slide-15
SLIDE 15

Open

  • raise wordline to high voltage
  • Connecting capacitor to bitline

Row buffer

  • Access to row buffer are fast
slide-16
SLIDE 16

Open

  • raise wordline to high voltage
  • Connecting capacitor to bitline

Row buffer

  • Access to row buffer are fast
slide-17
SLIDE 17

Open

  • raise wordline to high voltage
  • Connecting capacitor to bitline
  • DRO (Destructive Read Out)

Row buffer

  • Access to row buffer are fast
slide-18
SLIDE 18

Recharge

  • Copy the row back

Row buffer

slide-19
SLIDE 19
slide-20
SLIDE 20

Cells are capacitor!

  • They leak charge
  • Cells should be periodically refreshed
  • Refresh circuitry perform refresh cycle within

the refresh time interval : 64m 64ms

slide-21
SLIDE 21

02

Introduction to rowhammer problems

slide-22
SLIDE 22

Introduction to rowhammer problems

slide-23
SLIDE 23

This “aggressor” row is repeatedly activated (hammered)

slide-24
SLIDE 24

This “aggressor” row is repeatedly activated (hammered) OPEN (voltage raise)

slide-25
SLIDE 25

This “aggressor” row is repeatedly activated (hammered)

slide-26
SLIDE 26

This “aggressor” row is repeatedly activated (hammered) Result : These “victim” rows get bit flips OPEN (voltage raise)

slide-27
SLIDE 27
  • Randomly distributed
  • Constantly flip when hammered
  • varies by DRAM module
  • % of rows with bad cells : Varies from 30% to 99.9%

Bad Cells

slide-28
SLIDE 28

03

Understand bit flipping

by looking hammering code !

slide-29
SLIDE 29

Bank 0 Bank 7 CPU

Challenge 1. Right way to flip bit. ①? ②? Challenge 2. How to find pair of rows?

slide-30
SLIDE 30

Bank 0 Bank 7 CPU

Challenge 1. Right way to flip bit. ①? ②? Challenge 2. How to find pair of rows?

slide-31
SLIDE 31

Bank 0 Bank 7 CPU

Challenge 1. Right way to flip bit. ①? ②? Challenge 2. How to find pair of rows?

slide-32
SLIDE 32

Bank 0 Bank 7 CPU

Challenge 1. Right way to flip bit. ①? ②? Challenge 2. How to find pair of rows?

slide-33
SLIDE 33

Bank 0 Bank 7 CPU

Challenge 1. Right way to flip bit. ①? ②? Challenge 2. How to find pair of rows?

slide-34
SLIDE 34

Bank 0 Bank 7 CPU

Challenge 1. Right way to flip bit. ①? ②? Challenge 2. How to find pair of rows?

slide-35
SLIDE 35

Bank 0 Bank 7 CPU Random pick = 1/8

Challenge 1. Right way to flip bit. ①? ②? Challenge 2. How to find pair of rows?

slide-36
SLIDE 36

Bank 0 Bank 7 Bit flip code:

  • 1. OPEN – CLOSE rows repeatedly

pick 2 addresses : Same Bank Different Rows (SBDR)

  • 2. CPU cache by clflush
slide-37
SLIDE 37

Bank 0 Bank 7 hammer hammer expect flip expect flip expect flip expect flip Victim Row Bit flip code:

  • 1. OPEN – CLOSE rows repeatedly

pick 2 addresses : Same Bank Different Rows (SBDR)

  • 2. CPU cache by clflush
slide-38
SLIDE 38

04

How to Exploit a bit flip

  • 1. Native Client Sandbox
  • 2. Linux Kernel
slide-39
SLIDE 39

04

How to Exploit a bit flip

  • 1. Native Client Sandbox
  • 2. Linux Kernel
slide-40
SLIDE 40

Native Client Sandbox

✓ Sandbox for running C/C++ “native code” on the web ✓ Used in chrome ✓ Goal : make C/C++ code as safe as javascript ✓ In-process sandbox

  • Can’t call host OS’s syscalls
slide-41
SLIDE 41

Native Client Sandbox

✓ Sandbox for running C/C++ “native code” on the web ✓ Used in chrome ✓ Goal : make C/C++ code as safe as javascript ✓ In-process sandbox

  • Can’t call host OS’s syscalls

Sandbox escape !

slide-42
SLIDE 42

Challenges

  • 1. Mark shellcode as executable
  • 2. Jump to shellcode
slide-43
SLIDE 43

Challenges

  • 1. Mark shellcode as executable
  • 2. Jump to shellcode

This conceals:

}

Allowed by NaCl’s validater

slide-44
SLIDE 44

Challenges

  • 1. Mark shellcode as executable
  • 2. Jump to shellcode

Only allows “jmp *%rax” as part of this safe indirect jump sequence: Sandbox’s dynamic code area Spray 4c 01 f8 ff e0

slide-45
SLIDE 45

04

How to Exploit a bit flip

  • 1. Native Client Sandbox
  • 2. Linux Kernel
slide-46
SLIDE 46
  • 1. Spray most of physical memory with page tables
  • 2. Bit flip!

normal Linux process Kernel privilege escalation

slide-47
SLIDE 47

Linux kernel exploit

slide-48
SLIDE 48

RW = 1 Create shared memory

slide-49
SLIDE 49

RW = 1

slide-50
SLIDE 50

Map it multiple times

  • 1. mmap() data file repeatedly
  • 2. Spray memory page table
slide-51
SLIDE 51
  • 1. mmap() data file repeatedly
  • 2. Spray memory page table
slide-52
SLIDE 52
slide-53
SLIDE 53

Row hammering

slide-54
SLIDE 54
slide-55
SLIDE 55

RW = 1 Got write access to page table! Bit flipped in PTE

slide-56
SLIDE 56

Overwrite entry point of SUID-root executable (e.g. /bin/ping) to shell code Privilege escalation ! Got write access to page table!

slide-57
SLIDE 57

05

Experimental results

slide-58
SLIDE 58
slide-59
SLIDE 59

15/29 Machines were vulnerable…

slide-60
SLIDE 60

06

Rowhammer defenses

slide-61
SLIDE 61

Rowhammer detection

  • Software binary analysis
slide-62
SLIDE 62

Rowhammer detection

  • Software binary analysis

Rowhammer neutralization

  • *G-CATT

✓ Isolate user space / kernel space in physical memory ✓ attacker cannot exploit bit flips in kernel memory

* “CAn’t Touch This: Software-only Mitigation against Rowhammer Attacks targeting Kernel Memory”, F.Brasser et al. (2017.08)

slide-63
SLIDE 63

Rowhammer detection

  • Software binary analysis

Rowhammer neutralization

  • *G-CATT

✓ Isolate user space / kernel space in physical memory ✓ attacker cannot exploit bit flips in kernel memory

Rowhammer elimination

  • TRR (Target Row Refresh) : Identify frequently accessed DRAM addresses
  • tREFI (time of REfresh Interval)
  • ECC memory (Error Correcting Code)

e.g. Intel Skylake, Kaby lake

* “CAn’t Touch This: Software-only Mitigation against Rowhammer Attacks targeting Kernel Memory”, F.Brasser et al. (2017.08)

slide-64
SLIDE 64

Rowhammer detection

  • Software binary analysis

Rowhammer neutralization

  • *G-CATT

✓ Isolate user space / kernel space in physical memory ✓ attacker cannot exploit bit flips in kernel memory

Rowhammer elimination

  • TRR (Target Row Refresh) : Identify frequently accessed DRAM addresses
  • tREFI (time of REfresh Interval)
  • ECC memory (Error Correcting Code)

e.g. Intel Skylake, Kaby lake

* https://www.extremetech.com/extreme/224860-new-paper-alleges-servers-some-ddr4-dram-still-vulnerable-to-critical-rowhammer-attack ** https://arstechnica.com/information-technology/2016/03/once-thought-safe-ddr4-memory-shown-to-be-vulnerable-to-rowhammer/

slide-65
SLIDE 65

07

Conclusion & Recent study

slide-66
SLIDE 66

Rowhammer attack on flash memory

  • IBM

Flipping Bits in Memory Without Accessing Them

  • Yoongu Kim (CMU) el al.

(2014.07) Another Flip in the Wall of Rowhammer Defenses

  • Daniel Gruss et el.

(2017.08) (2017.10) Exploiting the DRAM rowhammer bug to gain kernel privileges

  • Google project zero

(2015.03)

slide-67
SLIDE 67

Rowhammer attack on flash memory

  • IBM

Flipping Bits in Memory Without Accessing Them

  • Yoongu Kim (CMU) el al.

(2014.07) Another Flip in the Wall of Rowhammer Defenses

  • Daniel Gruss et el.

(2017.08) (2017.10) Exploiting the DRAM rowhammer bug to gain kernel privileges

  • Google project zero

(2015.03)

slide-68
SLIDE 68

Rowhammer attack on flash memory

  • IBM

Flipping Bits in Memory Without Accessing Them

  • Yoongu Kim (CMU) el al.

(2014.07) Another Flip in the Wall of Rowhammer Defenses

  • Daniel Gruss et el.

(2017.08) (2017.10) Exploiting the DRAM rowhammer bug to gain kernel privileges

  • Google project zero

(2015.03)

slide-69
SLIDE 69

Rowhammer attack on flash memory

  • IBM

Flipping Bits in Memory Without Accessing Them

  • Yoongu Kim (CMU) el al.

(2014.07) Another Flip in the Wall of Rowhammer Defenses

  • Daniel Gruss et el.

(2017.08) (2017.10) Exploiting the DRAM rowhammer bug to gain kernel privileges

  • Google project zero

(2015.03)

slide-70
SLIDE 70

(2014.07) Another Flip in the Wall of Rowhammer Defenses

  • Daniel Gruss et el.

(2017.08) (2017.10) (2015.03) ▲ Ordinary rowhammer ▲ One-location hammering

slide-71
SLIDE 71

08

Future work

slide-72
SLIDE 72

It might be a good mitigation…

  • Arrange Refresh-only row buffer
slide-73
SLIDE 73
  • Arrange Refresh-only row buffer

Row buffer Refresh-only row buffer

It might be a good mitigation…

slide-74
SLIDE 74
  • Arrange Refresh-only row buffer

Row buffer Refresh-only row buffer Refresh

It might be a good mitigation…

slide-75
SLIDE 75
  • Arrange Refresh-only row buffer

Refresh-only row buffer

It might be a good mitigation…

▲ Ordinary rowhammer ▲ One-location hammering

slide-76
SLIDE 76

Q/A

slide-77
SLIDE 77

THANK

YOU