Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer...

321
www.iaik.tugraz.at Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK, Graz University of Technology April 28, 2016 1

Transcript of Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer...

Page 1: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Side-Channel Attacksand the case of RowhammerDaniel GrussIAIK, Graz University of Technology

April 28, 2016

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20161

Page 2: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

1. Caches

2. Cache attacks

3. Cache Template Attacks

4. Rowhammer

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20162

Page 3: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

1. Caches

2. Cache attacks

3. Cache Template Attacks

4. Rowhammer

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20163

Page 4: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

CPU Caches

CPU speed increases

Latency of DRAM is too high

Problem: DRAM is a bottle neck

Solution: Caches - fast/small memory buffers

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20164

Page 5: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

CPU Caches

CPU speed increases

Latency of DRAM is too high

Problem: DRAM is a bottle neck

Solution: Caches - fast/small memory buffers

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20164

Page 6: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Memory accesses are cached

Every memory reference goes through the cache

Transparent to OS and programs

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20165

Page 7: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Memory Access Latency

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20166

Page 8: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Memory Access Latency

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20167

Page 9: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 10: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 11: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Tag Data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 12: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Tag Data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 13: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Tag Datab bits

2b bytes

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 14: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Tag Datab bits

2b bytes

n bits

Cache Index

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 15: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Tag Datab bits

2b bytes

n bits

Cache Index

2n cache lines

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 16: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Tag Datab bits

2b bytes

n bits

Cache Index

2n cache linesf

=?

Tag

Hit/Miss

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 17: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Directly mapped cacheMemory Address Cache

Tag Datab bits

2b bytes

n bits

Cache Index

2n cache linesf

=?

Tag

Hit/Miss

Problem: working on congruent addressesDaniel Gruss, IAIK, Graz University of TechnologyApril 28, 20168

Page 18: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

2-way set associativityMemory Address Cache

Tag Datab bitsn bits

Cache Index

2n cache linesf

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20169

Page 19: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

2-way set associativityMemory Address Cache

Tag Datab bitsn bits

Cache Index

f 2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20169

Page 20: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

2-way set associativityMemory Address Cache

Tag Datab bitsn bits

Cache Index

f 2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20169

Page 21: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

2-way set associativityMemory Address Cache

Tag Datab bitsn bits

Cache Index

f 2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 20169

Page 22: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

2-way set associativityMemory Address Cache

Tag Datab bitsn bits

Cache Index

f 2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

→ replacement policy is importantDaniel Gruss, IAIK, Graz University of TechnologyApril 28, 20169

Page 23: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Caches and Addresses

Often use physical addresses

Virtual-to-physical translation necessary

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201610

Page 24: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

TLB and Paging

Paging: memory translated page-wise from virtual to physical

TLB (translation lookaside buffer) caches virtual to physical mapping

TLB has some latency

Worst case for Cache: mapping not in TLB, need to load mapping fromRAM

Solution: Use virtual addresses instead of physical addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201611

Page 25: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

TLB and Paging

Paging: memory translated page-wise from virtual to physical

TLB (translation lookaside buffer) caches virtual to physical mapping

TLB has some latency

Worst case for Cache: mapping not in TLB, need to load mapping fromRAM

Solution: Use virtual addresses instead of physical addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201611

Page 26: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache indexing methods

VIVT: Virtually indexed, virtually tagged

PIPT: Physically indexed, physically tagged

PIVT: Physically indexed, virtually tagged

VIPT: Virtually indexed, physically tagged

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201612

Page 27: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

VIVTVirtual Address Cache

Tag Datab bitsn bits

Cache Index

VPN

f 2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

FastVirtual Tag is not unique (Context switches)Shared memory more than once in cache

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201613

Page 28: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

VIVTVirtual Address Cache

Tag Datab bitsn bits

Cache Index

VPN

f 2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

FastVirtual Tag is not unique (Context switches)Shared memory more than once in cache

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201613

Page 29: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

PIPTVirtual Address Cache

Tag Datab bitsn bits

Cache Index

TLB

b bitsn bits

f

2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

Slow (TLB lookup for index)

Shared memory only once in cache!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201614

Page 30: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

PIPTVirtual Address Cache

Tag Datab bitsn bits

Cache Index

TLB

b bitsn bits

f

2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

DataSlow (TLB lookup for index)

Shared memory only once in cache!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201614

Page 31: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

(PIVT)Virtual Address Cache

Tag Datab bitsn bits

Cache Index

TLB

b bitsn bits

f

2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

Slow (TLB lookup for index)Virtual Tag is not unique (Context switches)Shared memory more than once in cache

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201615

Page 32: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

(PIVT)Virtual Address Cache

Tag Datab bitsn bits

Cache Index

TLB

b bitsn bits

f

2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

Slow (TLB lookup for index)Virtual Tag is not unique (Context switches)Shared memory more than once in cache

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201615

Page 33: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

VIPTVirtual Address Cache

Tag Datab bitsn bitsVPN

Cache Index

TLB

PPN

f

2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

Fast4 KiB pages: last 12 bits of VA and PA are equalUsing more bits has disadvantages (like VIVT)

→ Cache size ≤ # ways · page size

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201616

Page 34: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

VIPTVirtual Address Cache

Tag Datab bitsn bitsVPN

Cache Index

TLB

PPN

f

2n cache sets

Way 2 Tag Way 2 DataWay 1 Tag Way 1 Data

=?

=?Tag

Data

Fast4 KiB pages: last 12 bits of VA and PA are equalUsing more bits has disadvantages (like VIVT)

→ Cache size ≤ # ways · page size

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201616

Page 35: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Remarks

L1 caches: VIVT or VIPT

L2/L3 caches: PIPT

→ shared memory is shared in cache!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201617

Page 36: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Remarks

L1 caches: VIVT or VIPT

L2/L3 caches: PIPT

→ shared memory is shared in cache!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201617

Page 37: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Caches today

core 0

L1

L2

core 1

L1

L2

core 2

L1

L2

core 3

L1

L2 ring bus

LLCslice 0

LLCslice 1

LLCslice 2

LLCslice 3

L1 and L2 are private

last-level cache:

divided in slicesshared across coresinclusive

→ shared memoryshared is in cache,across cores!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201618

Page 38: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache mapping

slice 0 slice 1 slice 2 slice 3

H

2

offsetsettagphysical address

30

061735

11

line

Function H that maps slicesis undocumented

Reverse-engineered by[Hund et al., 2013,Maurice et al., 2015a,Inci et al., 2015,Yarom et al., 2015]

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201619

Page 39: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Unprivileged cache maintainance

User programs can optimize cache usage:

prefetch: suggest CPU to load data into cache

clflush: throw out data from from all caches

... based on virtual addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201620

Page 40: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

1. Caches

2. Cache attacks

3. Cache Template Attacks

4. Rowhammer

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201621

Page 41: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache attacks

cache-based keylogging

crypto key recovery

various implementations (AES, RSA, ECC, ...)up to 97% of RSA key bits recovered after 1 encryption

cross-VM, cross-core, even cross-CPU

any architecture (Intel, AMD, ARM)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201622

Page 42: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cross-core attacks?

exploiting the inclusive property

last-level cache is a superset of L1 and L2

data evicted from last-level cache→ evicted from L1 and L2

a core can evict lines in the private L1 cache of another core

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201623

Page 43: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cross-core attacks?

exploiting the inclusive property

last-level cache is a superset of L1 and L2

data evicted from last-level cache→ evicted from L1 and L2

a core can evict lines in the private L1 cache of another core

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201623

Page 44: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cross-core attacks?

exploiting the inclusive property

last-level cache is a superset of L1 and L2

data evicted from last-level cache→ evicted from L1 and L2

a core can evict lines in the private L1 cache of another core

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201623

Page 45: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cross-core attacks?

exploiting the inclusive property

last-level cache is a superset of L1 and L2

data evicted from last-level cache→ evicted from L1 and L2

a core can evict lines in the private L1 cache of another core

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201623

Page 46: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Access-driven attacks

Attacker monitors its own activity to determine cache lines or setsaccessed by victim.

Prime+Probe[Percival, 2005]

[Liu et al., 2015]

[Maurice et al., 2015b]

Flush+Reload[Gullasch et al., 2011]

[Yarom and Falkner, 2014]

[Gruss et al., 2015b]

Same techniques for covert and side channelsDaniel Gruss, IAIK, Graz University of TechnologyApril 28, 201624

Page 47: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Flush+ReloadAttacker

address space Cache Victimaddress space

step 0: attacker maps shared library→ shared memory, shared in cache

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201625

Page 48: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Flush+ReloadAttacker

address space Cache Victimaddress space

step 0: attacker maps shared library→ shared memory, shared in cache

cached cached

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201625

Page 49: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Flush+ReloadAttacker

address space Cache Victimaddress space

step 0: attacker maps shared library→ shared memory, shared in cachestep 1: attacker flushes the shared line

flushes

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201625

Page 50: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Flush+ReloadAttacker

address space Cache Victimaddress space

step 0: attacker maps shared library→ shared memory, shared in cachestep 1: attacker flushes the shared linestep 2: victim loads data while performing encryption

loads data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201625

Page 51: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Flush+ReloadAttacker

address space Cache Victimaddress space

step 0: attacker maps shared library→ shared memory, shared in cachestep 1: attacker flushes the shared linestep 2: victim loads data while performing encryptionstep 3: attacker reloads data→ fast access if the victim loaded the line

reloads data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201625

Page 52: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 53: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 54: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 55: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryption

loads data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 56: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryption

loads data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 57: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryption

loads data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 58: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryption

loads data

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 59: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryption

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 60: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryptionstep 2: attacker probes data to determine if the set was accessed

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 61: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryptionstep 2: attacker probes data to determine if the set was accessed

fast access

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 62: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Prime+ProbeAttacker

address space Cache Victimaddress space

step 0: attacker fills the cache (prime)step 1: victim evicts cache lines while performing encryptionstep 2: attacker probes data to determine if the set was accessed

slow access

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201626

Page 63: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

1. Caches

2. Cache attacks

3. Cache Template Attacks

4. Rowhammer

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201627

Page 64: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Can we spy on gedit?

gedit source code tells us gedit_window_get_active_view(); is usedwhen a key is pressed, etc.

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201628

Page 65: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Can we spy on gedit?objdump -S /usr/bin/gedit

0000000000449ab0 <gedit_window_get_active_view>:

449ab0: 53 : push %rbx

449ab1: 48 89 fb : mov %rdi,%rbx

449ab4: e8 87 df ff ff : callq 447a40 <gedit_window_get_type>

449ab9: 48 85 db : test %rbx,%rbx

449abc: 74 1c : je 449ada <gedit_window_get_active_view+0x2a>

449abe: 48 8b 13 : mov (%rbx),%rdx

449ac1: 48 85 d2 : test %rdx,%rdx

449ac4: 74 05 : je 449acb <gedit_window_get_active_view+0x1b>

Round 449ab0 up to be cache-line-aligned: 449ac0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201629

Page 66: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Can we spy on gedit?objdump -S /usr/bin/gedit

0000000000449ab0 <gedit_window_get_active_view>:

449ab0: 53 : push %rbx

449ab1: 48 89 fb : mov %rdi,%rbx

449ab4: e8 87 df ff ff : callq 447a40 <gedit_window_get_type>

449ab9: 48 85 db : test %rbx,%rbx

449abc: 74 1c : je 449ada <gedit_window_get_active_view+0x2a>

449abe: 48 8b 13 : mov (%rbx),%rdx

449ac1: 48 85 d2 : test %rdx,%rdx

449ac4: 74 05 : je 449acb <gedit_window_get_active_view+0x1b>

Round 449ab0 up to be cache-line-aligned: 449ac0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201629

Page 67: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Can we spy on gedit?objdump -S /usr/bin/gedit

0000000000449ab0 <gedit_window_get_active_view>:

449ab0: 53 : push %rbx

449ab1: 48 89 fb : mov %rdi,%rbx

449ab4: e8 87 df ff ff : callq 447a40 <gedit_window_get_type>

449ab9: 48 85 db : test %rbx,%rbx

449abc: 74 1c : je 449ada <gedit_window_get_active_view+0x2a>

449abe: 48 8b 13 : mov (%rbx),%rdx

449ac1: 48 85 d2 : test %rdx,%rdx

449ac4: 74 05 : je 449acb <gedit_window_get_active_view+0x1b>

Round 449ab0 up to be cache-line-aligned: 449ac0Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201629

Page 68: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Where are my functions!?

449ac0 is a virtual address! What now?

Where in the binary is this function?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201630

Page 69: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Where are my functions!?

readelf -a /usr/bin/gedit

Program Headers:

Type Offset VirtAddr PhysAddr

FileSiz MemSiz Flags Align

...

LOAD 0x000000 0x400000 0x400000

0x089314 0x089314 R E 200000

...

0x400000-0x489314 is 0x0-0x89314 in the binary→ we attack 0x49ac0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201631

Page 70: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Where are my functions!?

readelf -a /usr/bin/gedit

Program Headers:

Type Offset VirtAddr PhysAddr

FileSiz MemSiz Flags Align

...

LOAD 0x000000 0x400000 0x400000

0x089314 0x089314 R E 200000

...

0x400000-0x489314 is 0x0-0x89314 in the binary→ we attack 0x49ac0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201631

Page 71: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Where are my functions!?

readelf -a /usr/bin/gedit

Program Headers:

Type Offset VirtAddr PhysAddr

FileSiz MemSiz Flags Align

...

LOAD 0x000000 0x400000 0x400000

0x089314 0x089314 R E 200000

...

0x400000-0x489314 is 0x0-0x89314 in the binary

→ we attack 0x49ac0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201631

Page 72: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Where are my functions!?

readelf -a /usr/bin/gedit

Program Headers:

Type Offset VirtAddr PhysAddr

FileSiz MemSiz Flags Align

...

LOAD 0x000000 0x400000 0x400000

0x089314 0x089314 R E 200000

...

0x400000-0x489314 is 0x0-0x89314 in the binary→ we attack 0x49ac0Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201631

Page 73: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 74: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 75: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 76: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 77: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 78: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 79: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 80: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 81: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 82: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 83: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 84: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 85: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 86: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 87: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 88: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 89: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 90: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 91: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 92: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 93: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 94: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 95: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 96: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 97: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 98: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 99: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 100: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 101: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 102: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 103: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 104: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 105: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 106: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 107: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 108: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 109: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 110: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 111: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 112: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 113: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 114: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 115: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 116: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 117: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 118: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 119: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 120: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 121: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 122: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 123: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 124: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

A cache-based keystroke logger?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201632

Page 125: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Challenges

How to locate key-dependent memory accesses?

It’s complicated:

Large binaries and libraries (third-party code)Many libraries (gedit: 60MB)Closed-source / unknown binariesSelf-compiled binaries

Difficult to find all exploitable addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201633

Page 126: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Challenges

How to locate key-dependent memory accesses?

It’s complicated:

Large binaries and libraries (third-party code)Many libraries (gedit: 60MB)Closed-source / unknown binariesSelf-compiled binaries

Difficult to find all exploitable addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201633

Page 127: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Challenges

How to locate key-dependent memory accesses?

It’s complicated:

Large binaries and libraries (third-party code)Many libraries (gedit: 60MB)Closed-source / unknown binariesSelf-compiled binaries

Difficult to find all exploitable addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201633

Page 128: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Lessons learnt

Staring at objdump’s for weeks will give you headache

Automate everything right from the start

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201634

Page 129: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Lessons learnt

Staring at objdump’s for weeks will give you headache

Automate everything right from the start

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201634

Page 130: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks

Automatically find any secret-dependent cache access

Can be used for attacks and to improve software

Examples:

Cache-based keyloggerAutomatic attacks on crypto algorithms

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201635

Page 131: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks

Automatically find any secret-dependent cache access

Can be used for attacks and to improve software

Examples:

Cache-based keyloggerAutomatic attacks on crypto algorithms

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201635

Page 132: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks

Profiling Phase

Preprocessing step to find exploitable addresses automatically

w.r.t. “events” (keystrokes, encryptions, ...)called “Cache Template”

Exploitation Phase

Monitor exploitable addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201636

Page 133: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks

Profiling Phase

Preprocessing step to find exploitable addresses automatically

w.r.t. “events” (keystrokes, encryptions, ...)called “Cache Template”

Exploitation Phase

Monitor exploitable addresses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201636

Page 134: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Shared 0x0

Shared 0x0

Cache is emptyDaniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 135: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

AShared 0x0

Shared 0x0

Attacker triggers an event

Shared 0x0

Shared 0x0

Shared 0x0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 136: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Shared 0x0

Shared 0x0

Attacker checks one address for cache hits (“Reload”)

Shared 0x0

Shared 0x0

Shared 0x0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 137: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Shared 0x0

Shared 0x0

Update cache hit ratio (per event and address)

Shared 0x0

Shared 0x0

Shared 0x0

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 138: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Shared 0x0

Shared 0x0

Attacker flushes shared memory

Shared 0x0

Shared 0x0

Shared 0x0

flush

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 139: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Shared 0x0

Shared 0x0

Repeat for higher accuracy

A

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 140: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Shared 0x0

Shared 0x0

Repeat for all events

B

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 141: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Shared 0x0

Shared 0x0

Repeat for all events

C

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 142: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Continue with next address

A

Shared 0x40

Shared 0x40

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 143: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase

Attacker address space

Cache

Victim address space

Continue with next address

A

Shared 0x80

Shared 0x80

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201637

Page 144: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 145: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 146: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 147: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 148: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 149: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 150: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 151: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 152: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 153: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 154: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 155: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 156: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 157: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 158: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 159: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 160: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 161: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 162: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 163: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 164: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 165: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 166: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 167: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 168: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 169: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 170: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 171: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 172: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 173: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 174: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 175: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 176: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 177: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 178: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 179: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 180: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 181: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 182: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 183: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 184: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 185: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 186: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 187: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 188: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 189: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 190: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 191: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 192: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 193: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 194: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling a Single Event

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201638

Page 195: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase: 1 Event, 1 Address

AD

DR

ES

S

KEYn

0x7c800

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201639

Page 196: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase: 1 Event, 1 Address

AD

DR

ES

S

KEYn

0x7c800

Example: Cache Hit Ratio for (0x7c800, n): 200 / 200

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201639

Page 197: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase: All Events, 1 Address

AD

DR

ES

S

KEYg h i j k l m n o p q r s t u v w x y z

0x7c800

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201640

Page 198: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase: All Events, 1 Address

AD

DR

ES

S

KEYg h i j k l m n o p q r s t u v w x y z

0x7c800

Example: Cache Hit Ratio for (0x7c800, u): 13 / 200

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201640

Page 199: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase: All Events, 1 Address

AD

DR

ES

S

KEYg h i j k l m n o p q r s t u v w x y z

0x7c800

Distinguish n from other keys by monitoring 0x7c800

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201640

Page 200: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Profiling Phase: All Events, All Addresses

AD

DR

ES

S

KEYg h i j k l m n o p q r s t u v w x y z

0x7c6800x7c6c00x7c7000x7c7400x7c7800x7c7c00x7c8000x7c8400x7c8800x7c8c00x7c9000x7c9400x7c9800x7c9c00x7ca000x7cb800x7cc400x7cc800x7ccc00x7cd00

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201641

Page 201: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Exploitation Phase

Monitor addresses from Cache Template

Report to log file / attacker

Manual analysis of log file

Find password in keypress log, etc.

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201642

Page 202: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Exploitation Phase

Monitor addresses from Cache Template

Report to log file / attacker

Manual analysis of log file

Find password in keypress log, etc.

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201642

Page 203: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Exploitation Phase

Monitor addresses from Cache Template

Report to log file / attacker

Manual analysis of log file

Find password in keypress log, etc.

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201642

Page 204: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Example Attack: Keylogging

Linux with GTK: monitorkeystrokes of specific keys

Detect groups of keys

Some keys distinct

AD

DR

ES

S

KEYg h i j k l m n o p q r s t u v w x y z

0x7c6800x7c6c00x7c7000x7c7400x7c7800x7c7c00x7c8000x7c8400x7c8800x7c8c00x7c9000x7c9400x7c9800x7c9c00x7ca000x7cb800x7cc400x7cc800x7ccc00x7cd00

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201643

Page 205: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Example Attack: AES T-Tables

AES T-Table implementation from OpenSSL 1.0.2

Known-plaintext attack

Events: encryption with only one fixed key byte

Profile each event

Exploitation phase: an auto-generated first-round attack

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201644

Page 206: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Example Attack: AES T-Tables

AES T-Table implementation from OpenSSL 1.0.2

Known-plaintext attack

Events: encryption with only one fixed key byte

Profile each event

Exploitation phase: an auto-generated first-round attack

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201644

Page 207: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Example Attack: AES T-Tables

AES T-Table implementation from OpenSSL 1.0.2

Known-plaintext attack

Events: encryption with only one fixed key byte

Profile each event

Exploitation phase: an auto-generated first-round attack

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201644

Page 208: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Example Attack: AES T-Tables Template

k0 = 0x00 k0 = 0x55

(transposed)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201645

Page 209: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks: How hard is it?

We let students attack different programs

Leakage typically found within 30 minutes

Wide range of programs

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201646

Page 210: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks: Example Applications

Keystrokes in nano, quasselclient, xterm, Pidgin, gksu, Firefox, GNUEmacs (on OSX), mousepad, user32.dll on WindowsKeystrokes specifically in the password field in KeePassXFont rendering in libharfbuzz (used by many Linux applications)Action buttons in VLC (play, mute, ...)Receiving characters in netcatDistinguishing keygroups in gksuMonitoring checkbox clicking in gksu

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201647

Page 211: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks: Conclusion

Technique to find any cache side-channel leakage

Works on Intel, ARM, and some AMD

Works even with unknown binaries

Large scale automated cache attacks possible!

But: still requires shared memory

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201648

Page 212: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks: Conclusion

Technique to find any cache side-channel leakage

Works on Intel, ARM, and some AMD

Works even with unknown binaries

Large scale automated cache attacks possible!

But: still requires shared memory

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201648

Page 213: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks: Conclusion

Technique to find any cache side-channel leakage

Works on Intel, ARM, and some AMD

Works even with unknown binaries

Large scale automated cache attacks possible!

But: still requires shared memory

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201648

Page 214: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Template Attacks: Conclusion

Technique to find any cache side-channel leakage

Works on Intel, ARM, and some AMD

Works even with unknown binaries

Large scale automated cache attacks possible!

But: still requires shared memory

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201648

Page 215: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

What about Prime+Probe?

Good: no shared memory

Bad: much more difficult due to noise

→ Let’s do something more fun with Prime+Probe!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201649

Page 216: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

What about Prime+Probe?

Good: no shared memory

Bad: much more difficult due to noise

→ Let’s do something more fun with Prime+Probe!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201649

Page 217: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

What about Prime+Probe?

Good: no shared memory

Bad: much more difficult due to noise

→ Let’s do something more fun with Prime+Probe!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201649

Page 218: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

1. Caches

2. Cache attacks

3. Cache Template Attacks

4. Rowhammer

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201650

Page 219: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

DRAM organization example

channel 0

channel 1

back of DIMM: rank 1

front of DIMM:rank 0

chip

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201651

Page 220: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

DRAM organization example

channel 0

channel 1

back of DIMM: rank 1

front of DIMM:rank 0

chip

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201651

Page 221: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

DRAM organization example

channel 0

channel 1

back of DIMM: rank 1

front of DIMM:rank 0

chip

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201651

Page 222: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

DRAM organization example

channel 0

channel 1

back of DIMM: rank 1

front of DIMM:rank 0

chip

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201651

Page 223: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

DRAM organization example

chipbank 0

row 0row 1row 2. . .

row 32767

row buffer

bits in cells in rows

access: activate row,copy to row buffer

cells leak→ refreshnecessary

cells leak faster uponproximate accesses

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201652

Page 224: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer“It’s like breaking into an apartment by repeatedly slamming a neighbor’s door untilthe vibrations open the door you were after” – Motherboard Vice

DRAM bank

1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1

. . .

1 1 1 1 1 1 1 1 1 1 1 1 1 1

row buffer

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201653

Page 225: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer“It’s like breaking into an apartment by repeatedly slamming a neighbor’s door untilthe vibrations open the door you were after” – Motherboard Vice

DRAM bank

1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1

. . .

1 1 1 1 1 1 1 1 1 1 1 1 1 1

row buffer

activate

row buffer

copy

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201653

Page 226: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer“It’s like breaking into an apartment by repeatedly slamming a neighbor’s door untilthe vibrations open the door you were after” – Motherboard Vice

DRAM bank

1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1

. . .

1 1 1 1 1 1 1 1 1 1 1 1 1 1

row buffer

activate

row buffer

copy

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201653

Page 227: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer“It’s like breaking into an apartment by repeatedly slamming a neighbor’s door untilthe vibrations open the door you were after” – Motherboard Vice

DRAM bank

1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1

. . .

1 1 1 1 1 1 1 1 1 1 1 1 1 1

row buffer

activate

row buffer

copy

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201653

Page 228: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer“It’s like breaking into an apartment by repeatedly slamming a neighbor’s door untilthe vibrations open the door you were after” – Motherboard Vice

DRAM bank

1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1

. . .

1 1 1 1 1 1 1 1 1 1 1 1 1 1

row buffer

activate

row buffer

copy

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201653

Page 229: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer“It’s like breaking into an apartment by repeatedly slamming a neighbor’s door untilthe vibrations open the door you were after” – Motherboard Vice

DRAM bank

1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1 1 1 1 1. . .

1 1 1 1 1 1 1 1 1 1 1 1 1 1

row bufferrow buffer

1 0 1 1 1 1 1 0 1 0 1 1 1 1

bit flips in row 2!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201653

Page 230: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Impact of the CPU cache

CPUcore

CPUcache

DRAM

only non-cached accesses reach DRAM

original attacks use clflush instruction

→ flush line from cache

→ next access will be served from DRAM

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201654

Page 231: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer

Rowhammer: DRAM bug that causes bit flips [Kim et al., 2014]

Bug used in security exploits [Seaborn, 2015]

Need non-cached accesses to reach DRAM

Very similar to Flush+Reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201655

Page 232: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 233: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

clflush

clflush

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 234: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

clflush

clflush

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 235: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 236: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 237: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

reload

reload

reload

reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 238: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

clflush

clflush

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 239: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

reload

reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 240: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

clflush

clflush

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 241: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

reload

reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 242: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

clflush

clflush

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 243: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

reload

reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 244: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

clflush

clflush

wait for it. . .

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 245: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer (with clflush)

DRAM bank

cache set 2

cache set 1

reload

reload

bit flip!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201656

Page 246: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush?

Idea: use Prime+Probe for Rowhammer instead of Flush+Reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201657

Page 247: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 248: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

load

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 249: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

load

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 250: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

load

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 251: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

load

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 252: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

load

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 253: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

load

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 254: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1lo

ad

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 255: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

load

load

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 256: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

reload

reload

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 257: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

repeat!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 258: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

reload

reload

wait for it. . .

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 259: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

DRAM bank

cache set 2

cache set 1

bit flip!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201658

Page 260: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

Challenges:

1. How to get accurate timing (in JS)?

2. How to get physical addresses (in JS)?

3. Which physical addresses to access?

4. In which order to access them?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201659

Page 261: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

Challenges:

1. How to get accurate timing (in JS)?→ easy

2. How to get physical addresses (in JS)?→ easy

3. Which physical addresses to access? → already solved

4. In which order to access them? → details today!

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201659

Page 262: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Accurate timing in JS (easy)

native code: rdtsc

JavaScript: window.performance.now()

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201660

Page 263: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Physical addresses in JS (easy)

fixed map between physical addresses and DRAM

we reverse-engineered it [Pessl et al., 2015]

OS optimization: use 2MB pages

last 21 bits equal for physical address, virtual address, JS arrayindex [Gruss et al., 2015a]

several DRAM rows per 2MB page

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201661

Page 264: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Which addresses to access? (already solved)

use eviction→ congruent addresses

slice mapping is known [Maurice et al., 2015a]

Remaining challenge: “in which order to access them?”

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201662

Page 265: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Which addresses to access? (already solved)

use eviction→ congruent addresses

slice mapping is known [Maurice et al., 2015a]

Remaining challenge: “in which order to access them?”

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201662

Page 266: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 267: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 268: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 269: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4

load

9

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 270: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 49

load

10

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 271: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910

load

11

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 272: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 11load

12

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 273: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 11 12

load

13

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 274: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 11 1213

load

14

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 275: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 11 1213 14

load

15

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 276: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on older CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 11 1213 1415

load

16

LRU replacement policy: oldest entry first

timestamps for every cache line

access updates timestamp

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201663

Page 277: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 278: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4

load

9

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 279: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 49

load

10

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 280: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910

load

11

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 281: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 11

load

12

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 282: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 1112

load

13

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 283: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 1112 13

load

14

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 284: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 1112 1314load

15

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 285: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 1112 1314 15load

16

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 286: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 1112 1314 1516

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 287: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Replacement policy on recent CPUs

“LRU eviction” memory accesses

cache set 2 5 8 1 7 6 3 4910 1112 1314 1516

no LRU replacement

only 75% success rate on Haswell

more accesses→ higher success rate, but too slow

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201664

Page 288: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy (the beginning)A

ddre

ss

a1

a2

a3

a4

a5

a6

a7

a8

a9

Time

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201665

Page 289: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy (new representation)

Represent accesses as a sequence of numbers:

1, 2, 1, 2, 2, 3, 2, 3, 3, 4, 3, 4, ...

can be a long sequence

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201666

Page 290: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy properties

all addresses are congruent

→ indistinguishable in terms of the eviction strategy

2, 5, 4, 6, 3, 1, 2, 5, 6, 4, 1, 3, ... all equivalent!→ 1, 2, 3, 4, 5, 6

adding more different addresses can increase eviction rate

multiple accesses to one address can increase the eviction rate

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201667

Page 291: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy properties

all addresses are congruent

→ indistinguishable in terms of the eviction strategy

2, 5, 4, 6, 3, 1, 2, 5, 6, 4, 1, 3, ... all equivalent!→ 1, 2, 3, 4, 5, 6

adding more different addresses can increase eviction rate

multiple accesses to one address can increase the eviction rate

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201667

Page 292: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy properties

all addresses are congruent

→ indistinguishable in terms of the eviction strategy

2, 5, 4, 6, 3, 1, 2, 5, 6, 4, 1, 3, ... all equivalent!→ 1, 2, 3, 4, 5, 6

adding more different addresses can increase eviction rate

multiple accesses to one address can increase the eviction rate

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201667

Page 293: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy properties (2)

multiple accesses, low number of different addresses

→ sequences often have repeating sub-sequences

idea: repetative sequences can be compressed to loops oversub-sequences

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201668

Page 294: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy properties (2)

multiple accesses, low number of different addresses

→ sequences often have repeating sub-sequences

idea: repetative sequences can be compressed to loops oversub-sequences

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201668

Page 295: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy (compression)

for (s = 0; s <= S-D; s += L)

for (c = 0; c <= C; c += 1)

for (d = 0; d <= D; d += 1)

*a[s+d];

D: different addresses per inner access loopC: number of repetitions of the inner access loopS: total number of different addresses (=set size)L: overlap parameter for the inner access loops (=step size)

Write eviction strategies as: P-C-D-L-S

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201669

Page 296: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy (compression)

for (s = 0; s <= S-D; s += L)

for (c = 0; c <= C; c += 1)

for (d = 0; d <= D; d += 1)

*a[s+d];

D: different addresses per inner access loopC: number of repetitions of the inner access loopS: total number of different addresses (=set size)L: overlap parameter for the inner access loops (=step size)

Write eviction strategies as: P-C-D-L-S

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201669

Page 297: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy (compression)

for (s = 0; s <= S-D; s += L)

for (c = 0; c <= C; c += 1)

for (d = 0; d <= D; d += 1)

*a[s+d];

D: different addresses per inner access loopC: number of repetitions of the inner access loopS: total number of different addresses (=set size)L: overlap parameter for the inner access loops (=step size)

Write eviction strategies as: P-C-D-L-S

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201669

Page 298: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy example

for (s = 0; s <= S-D; s += L)

for (c = 0; c < C; c += 1)

for (d = 0; d < D; d += 1)

*a[s+d];

P-1-1-1-4P-2-2-1-4

We evaluated more than 10000 strategies...

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201670

Page 299: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy example

for (s = 0; s <= S-D; s += L)

for (c = 0; c < C; c += 1)

for (d = 0; d < D; d += 1)

*a[s+d];

P-1-1-1-4P-2-2-1-4

We evaluated more than 10000 strategies...

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201670

Page 300: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy example

for (s = 0; s <= S-D; s += L)

for (c = 0; c < C; c += 1)

for (d = 0; d < D; d += 1)

*a[s+d];

P-1-1-1-4→ 1, 2, 3, 4

P-2-2-1-4→ 1, 2, 1, 2, 2, 3, 2, 3, 3, 4, 3, 4

We evaluated more than 10000 strategies...

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201670

Page 301: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategy example

for (s = 0; s <= S-D; s += L)

for (c = 0; c < C; c += 1)

for (d = 0; d < D; d += 1)

*a[s+d];

P-1-1-1-4→ 1, 2, 3, 4

P-2-2-1-4→ 1, 2, 1, 2, 2, 3, 2, 3, 3, 4, 3, 4

We evaluated more than 10000 strategies...

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201670

Page 302: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (simple example)

Which one has the better eviction rate?

P-1-1-1-17 (as used in previous work)

P-1-1-1-20

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201671

Page 303: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (simple example)

Which one has the better eviction rate?

P-1-1-1-17 (as used in previous work)

→ Average eviction rate: 74.46%→ Not high enough for Rowhammer!

P-1-1-1-20

→ Average eviction rate: 99.82%→ High enough for Rowhammer!

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201671

Page 304: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (simple example)

Which one is faster?

P-1-1-1-17 (as used in previous work)

P-1-1-1-20 (=20 accesses)

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201672

Page 305: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (simple example)

Which one is faster?

P-1-1-1-17 (as used in previous work)

→ Average execution time: 307 ns→ Fast enough for Rowhammer!

P-1-1-1-20 (=20 accesses)

→ Average execution time: 934 ns→ Not fast enough for Rowhammer!

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201672

Page 306: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (another example)

Which one has the better eviction rate?

P-1-1-1-17 (=17 accesses)

→ Average eviction rate: 74.46%

P-2-1-1-17 (=34 accesses)

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201673

Page 307: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (another example)

Which one has the better eviction rate?

P-1-1-1-17 (=17 accesses)

→ Average eviction rate: 74.46%

P-2-1-1-17 (=34 accesses)

→ Average eviction rate: 99.86%→ High enough for Rowhammer!

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201673

Page 308: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (another example)

Which one is faster?

P-1-1-1-17 (=17 accesses)

→ Average execution time: 307 ns

P-2-1-1-17 (=34 accesses)

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201674

Page 309: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (another example)

Which one is faster?

P-1-1-1-17 (=17 accesses)

→ Average execution time: 307 ns

P-2-1-1-17 (=34 accesses)

→ Average execution time: 191 ns→ Fast enough for Rowhammer!

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201674

Page 310: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (another example)

Which one has the better eviction rate?

P-2-1-1-17 (=34 accesses)

→ Average eviction rate: 99.86%→ Average execution time: 191 ns

P-2-2-1-17 (=64 accesses)

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201675

Page 311: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache eviction strategies (another example)

Which one has the better eviction rate?

P-2-1-1-17 (=34 accesses)

→ Average eviction rate: 99.86%→ Average execution time: 191 ns

P-2-2-1-17 (=64 accesses)

→ Average eviction rate: 99.98%→ Average execution time: 180 ns

(executed in a loop, on Haswell, 16-way cache)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201675

Page 312: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

Challenges:

1. How to get accurate timing (in JS)?→ easy

2. How to get physical addresses (in JS)?→ easy

3. Which physical addresses to access? → solved

4. In which order to access them?

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201676

Page 313: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Rowhammer without clflush

Challenges:

1. How to get accurate timing (in JS)?→ easy

2. How to get physical addresses (in JS)?→ easy

3. Which physical addresses to access? → solved

4. In which order to access them? → solved

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201676

Page 314: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Evaluation on Haswell

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70100

102

104

106

Refresh interval in µs (BIOS configuration)

Bit

flips

clflush Evict (Native) Evict (JavaScript)

Figure: Number of bit flips within 15 minutes. [Gruss et al., 2016]

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201677

Page 315: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Conclusions

cache eviction good enough to replace clflush

independent of programming language and available instructions

hardware-fault attack induced in JavaScript

→ remote attacks through websites are possible

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201678

Page 316: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

At least on this laptop (default settings)

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201679

Page 317: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

Cache Side-Channel Attacksand the case of RowhammerDaniel GrussIAIK, Graz University of Technology

April 28, 2016

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201680

Page 318: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

[Gruss et al., 2015a] Gruss, D., Bidner, D., and Mangard, S. (2015a).

Practical Memory Deduplication Attacks in Sandboxed JavaScript.

In Proceedings of the 20th European Symposium on Research in Computer Security (ESORICS’15).

[Gruss et al., 2016] Gruss, D., Maurice, C., and Mangard, S. (2016).

Rowhammer.js: A Remote Software-Induced Fault Attack in JavaScript.

In DIMVA’16.

[Gruss et al., 2015b] Gruss, D., Spreitzer, R., and Mangard, S. (2015b).

Cache Template Attacks: Automating Attacks on Inclusive Last-Level Caches.

In USENIX Security Symposium (USENIX Security’15).

[Gullasch et al., 2011] Gullasch, D., Bangerter, E., and Krenn, S. (2011).

Cache Games – Bringing Access-Based Cache Attacks on AES to Practice.

In IEEE Symposium on Security and Privacy (S&P’11).

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201681

Page 319: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

[Hund et al., 2013] Hund, R., Willems, C., and Holz, T. (2013).

Practical Timing Side Channel Attacks against Kernel Space ASLR.

In IEEE Symposium on Security and Privacy – S&P, pages 191–205. IEEE.

[Inci et al., 2015] Inci, M. S., Gulmezoglu, B., Irazoqui, G., Eisenbarth, T., and Sunar, B. (2015).

Seriously, get off my cloud! Cross-VM RSA Key Recovery in a Public Cloud.

Cryptology ePrint Archive, Report 2015/898.

[Kim et al., 2014] Kim, Y., Daly, R., Kim, J., Fallin, C., Lee, J. H., Lee, D., Wilkerson, C., Lai, K., and Mutlu, O. (2014).

Flipping bits in memory without accessing them: An experimental study of DRAM disturbance errors.

In ACM/IEEE International Symposium on Computer Architecture (ISCA’14).

[Liu et al., 2015] Liu, F., Yarom, Y., Ge, Q., Heiser, G., and Lee, R. B. (2015).

Last-Level Cache Side-Channel Attacks are Practical.

In IEEE Symposium on Security and Privacy (S&P’15).

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201682

Page 320: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

[Maurice et al., 2015a] Maurice, C., Le Scouarnec, N., Neumann, C., Heen, O., and Francillon, A. (2015a).

Reverse Engineering Intel Last-Level Cache Complex Addressing Using Performance Counters.

In International Symposium on Research in Attacks, Intrusions and Defenses (RAID).

[Maurice et al., 2015b] Maurice, C., Neumann, C., Heen, O., and Francillon, A. (2015b).

C5: Cross-Cores Cache Covert Channel.

In International Conference on Detection of Intrusions and Malware, and Vulnerability Assessment (DIMVA’15).

[Percival, 2005] Percival, C. (2005).

Cache Missing for Fun and Profit.

URL: http://daemonology.net/hyperthreading-considered-harmful/.

[Pessl et al., 2015] Pessl, P., Gruss, D., Maurice, C., Schwarz, M., and Mangard, S. (2015).

Reverse Engineering Intel DRAM Addressing and Exploitation.

arXiv:1511.08756.

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201683

Page 321: Cache Side-Channel Attacks and the case of … Cache Side-Channel Attacks and the case of Rowhammer Daniel Gruss IAIK, Graz University of Technology April 28, 2016 Daniel Gruss, IAIK,

www.iaik.tugraz.at

[Seaborn, 2015] Seaborn, M. (2015).

Exploiting the DRAM rowhammer bug to gain kernel privileges.

http://googleprojectzero.blogspot.com/2015/03/exploiting-dram-rowhammer-bug-to-gain.html.

[Yarom and Falkner, 2014] Yarom, Y. and Falkner, K. (2014).

FLUSH+RELOAD: A High Resolution, Low Noise, L3 Cache Side-Channel Attack.

In USENIX Security Symposium (USENIX Security’14).

[Yarom et al., 2015] Yarom, Y., Ge, Q., Liu, F., Lee, R. B., and Heiser, G. (2015).

Mapping the Intel Last-Level Cache.

Cryptology ePrint Archive, Report 2015/905.

Daniel Gruss, IAIK, Graz University of TechnologyApril 28, 201684