safecracker: leaking secrets through compressed...

89
Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020 Safecracker: Leaking Secrets through Compressed Caches

Upload: others

Post on 20-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Po-An Tsai, Andres Sanchez,

Christopher Fletcher, and Daniel Sanchez

ASPLOS 2020

Safecracker: Leaking Secrets through Compressed Caches

Page 2: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Page 3: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Page 4: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Page 5: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Attacker Victim

Page 6: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Attacker Victimencrypt 0x01…

1 Attacker sends encryption

request to victim

Page 7: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Attacker Victimencrypt 0x01…

1 Attacker sends encryption

request to victim

Secret key

Attacker-controlled input

0x01020304050607 0x012 Victim stores input next to key

Page 8: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Attacker Victimencrypt 0x01…

1 Attacker sends encryption

request to victim

Secret key

Attacker-controlled input

0x01020304050607 0x012 Victim stores input next to key

7B cache line

Cache compresses line

Page 9: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Attacker Victimencrypt 0x01…

1 Attacker sends encryption

request to victim

Secret key

Attacker-controlled input

0x01020304050607 0x012 Victim stores input next to key

7B cache line

Cache compresses line

3 Attacker measures line’s

compressed size, infers

0x01 is in the secret data

Page 10: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Attacker Victimencrypt 0x01…

1 Attacker sends encryption

request to victim

Secret key

Attacker-controlled input

0x01020304050607 0x012 Victim stores input next to key

7B cache line

Cache compresses line

3 Attacker measures line’s

compressed size, infers

0x01 is in the secret data

Compromises secret key in ~10ms

Page 11: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Executive Summary2

First security analysis of cache compression

Compressibility of a cache line reveals info about its data

Attacker can exploit data colocation to leak secrets

Attacker Victimencrypt 0x01…

1 Attacker sends encryption

request to victim

Secret key

Attacker-controlled input

0x01020304050607 0x012 Victim stores input next to key

7B cache line

Cache compresses line

3 Attacker measures line’s

compressed size, infers

0x01 is in the secret data

Compromises secret key in ~10ms

Leaks large fraction of victim memory

when combined latent memory safety vulnerabilities

Page 12: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Kiriansky et. al, MICRO’18

Page 13: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Speculation-based cache side channel attacks (e.g., Spectre)

Kiriansky et. al, MICRO’18

Page 14: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Speculation-based cache side channel attacks (e.g., Spectre)

Presence of a line and its

address (location in cache)

Kiriansky et. al, MICRO’18

Page 15: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Speculation-based cache side channel attacks (e.g., Spectre)

Speculatively executed

instructions

Presence of a line and its

address (location in cache)

Kiriansky et. al, MICRO’18

Page 16: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Speculation-based cache side channel attacks (e.g., Spectre)

Speculatively executed

instructions

Timing difference to infer

a line’s presence

Presence of a line and its

address (location in cache)

Kiriansky et. al, MICRO’18

Page 17: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Compressed cache attacks

Speculation-based cache side channel attacks (e.g., Spectre)

Speculatively executed

instructions

Timing difference to infer

a line’s presence

Presence of a line and its

address (location in cache)

Kiriansky et. al, MICRO’18

Page 18: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Compressed cache attacks

Compressibility of secret

(and data in same line)

Speculation-based cache side channel attacks (e.g., Spectre)

Speculatively executed

instructions

Timing difference to infer

a line’s presence

Presence of a line and its

address (location in cache)

Kiriansky et. al, MICRO’18

Page 19: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Compressed cache attacks

Writing secret data

(or data in same line)

Compressibility of secret

(and data in same line)

Speculation-based cache side channel attacks (e.g., Spectre)

Speculatively executed

instructions

Timing difference to infer

a line’s presence

Presence of a line and its

address (location in cache)

Kiriansky et. al, MICRO’18

Page 20: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Compressed cache attacks

Writing secret data

(or data in same line)

Timing difference to infer

a line’s compressibility

Compressibility of secret

(and data in same line)

Speculation-based cache side channel attacks (e.g., Spectre)

Speculatively executed

instructions

Timing difference to infer

a line’s presence

Presence of a line and its

address (location in cache)

Kiriansky et. al, MICRO’18

Page 21: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Speculation-Based vs. Compressed Cache

Side-Channel Attacks 3

Victim’s

protection

domain

Secret Transmitter

Attacker’s

protection

domain

SecretReceiver

Side

channel

Compressed cache attacks

Writing secret data

(or data in same line)

Timing difference to infer

a line’s compressibility

Compressibility of secret

(and data in same line)

Speculation-based cache side channel attacks (e.g., Spectre)

Speculatively executed

instructions

Timing difference to infer

a line’s presence

Presence of a line and its

address (location in cache)

Compressed cache attacks leak data without relying on speculation

Kiriansky et. al, MICRO’18

Page 22: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Outline4

Background on cache compression

Pack+Probe: Measuring cache line compressibility

Safecracker: Exploiting data colocation to leak secrets

Potential defenses

Page 23: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Tradeoffs5

Higher effective capacity Higher hit rate

Somewhat higher hit latency

Page 24: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Tradeoffs5

Higher effective capacity Higher hit rate

Somewhat higher hit latency

Highly beneficial for large caches (e.g., LLC)L3

Cache

Page 25: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Tradeoffs5

Higher effective capacity Higher hit rate

Somewhat higher hit latency

Highly beneficial for large caches (e.g., LLC)

Intense research activity over past 15 yearsL3

Cache

Page 26: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Tradeoffs5

Higher effective capacity Higher hit rate

Somewhat higher hit latency

Highly beneficial for large caches (e.g., LLC)

Intense research activity over past 15 yearsL3

Cache

Page 27: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Tradeoffs5

Higher effective capacity Higher hit rate

Somewhat higher hit latency

Highly beneficial for large caches (e.g., LLC)

Intense research activity over past 15 yearsL3

Cache

All focus on performance, not security

Page 28: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Ingredients6

Page 29: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Ingredients6

Architecture: How to locate and manage variable-

sized compressed blocks?

Page 30: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Ingredients6

Architecture: How to locate and manage variable-

sized compressed blocks?

Algorithm: How to compress each cache block?

Page 31: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Ingredients6

Architecture: How to locate and manage variable-

sized compressed blocks?

Algorithm: How to compress each cache block?

We focus attacks on a commonly used baseline:

VSC compressed cache architecture

BDI compression algorithm

Page 32: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Cache Compression Ingredients6

Architecture: How to locate and manage variable-

sized compressed blocks?

Algorithm: How to compress each cache block?

We focus attacks on a commonly used baseline:

VSC compressed cache architecture

BDI compression algorithm

Attacks apply to other architectures & algorithms

Leads to different characteristics about leaked data

Page 33: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]7

Conventional caches can only manage fixed-size blocks

Tag0 Tag1 Data0 Data12-way set-associative cache

64 bytes

Page 34: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]8

VSC divides data array into small segments and lets

compressed lines take a variable number of segments

Tag0 Tag1 Data array

128 bytes8 bytes

Page 35: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]8

VSC divides data array into small segments and lets

compressed lines take a variable number of segments

Tag0 Tag1 Data array

128 bytes8 bytes

Page 36: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]8

VSC divides data array into small segments and lets

compressed lines take a variable number of segments

Tag0 Tag1 Data array

128 bytes8 bytes

Page 37: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]8

VSC divides data array into small segments and lets

compressed lines take a variable number of segments

VSC increases tags relative to uncompressed caches

to track more compressed lines per set

Tag0 Tag1 Data array

128 bytes8 bytes

Page 38: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]8

VSC divides data array into small segments and lets

compressed lines take a variable number of segments

VSC increases tags relative to uncompressed caches

to track more compressed lines per set

Tag0 Tag1 Data array

128 bytes8 bytes

Tag2 Tag3

Page 39: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]8

VSC divides data array into small segments and lets

compressed lines take a variable number of segments

VSC increases tags relative to uncompressed caches

to track more compressed lines per set

Tag0 Tag1 Data array

128 bytes8 bytes

Tag2 Tag3

Page 40: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

VSC [Alameldeen and Wood ISCA‘04]8

VSC divides data array into small segments and lets

compressed lines take a variable number of segments

VSC increases tags relative to uncompressed caches

to track more compressed lines per set

Tag0 Tag1 Data array

128 bytes8 bytes

Tag2 Tag3

Page 41: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

BDI [Pekhimenko et al. PACT‘12]9

Base-Delta-Immediate (BDI) compresses lines with similar values by using a

common base + small deltas

Page 42: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

BDI [Pekhimenko et al. PACT‘12]9

Base-Delta-Immediate (BDI) compresses lines with similar values by using a

common base + small deltas

BDI supports multiple formats with different base sizes

(2, 4, 8 bytes) and delta sizes (1, 2, 4 bytes)

Page 43: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

BDI [Pekhimenko et al. PACT‘12]9

Base-Delta-Immediate (BDI) compresses lines with similar values by using a

common base + small deltas

BDI supports multiple formats with different base sizes

(2, 4, 8 bytes) and delta sizes (1, 2, 4 bytes)

Reasonable compression ratio, simple implementation

Page 44: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility10

Threat model:

Attacker and victim run in different protection domains

(processes, VMs, etc.)

Attacker and victim share compressed cache

Attacker knows compressed cache architecture &

algorithm used

Attacker knows set of victim’s target line

(can use standard techniques to find it)

Core Core

L2 L2

Compressed LLC

Main Memory

Page 45: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility10

Threat model:

Attacker and victim run in different protection domains

(processes, VMs, etc.)

Attacker and victim share compressed cache

Attacker knows compressed cache architecture &

algorithm used

Attacker knows set of victim’s target line

(can use standard techniques to find it)

Goal: Find compressed size of target line

Core Core

L2 L2

Compressed LLC

Main Memory

Page 46: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility11

Attacker packs target set with lines of known sizes, leaving S free segments and at least one free tag

Page 47: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility11

Attacker packs target set with lines of known sizes, leaving S free segments and at least one free tag

Tag0 Tag1 Data arrayTag2 Tag3

Page 48: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility11

Attacker packs target set with lines of known sizes, leaving S free segments and at least one free tag

Tag0 Tag1 Data arrayTag2 Tag3

S=4

Page 49: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility11

Attacker packs target set with lines of known sizes, leaving S free segments and at least one free tag

After victim accesses target set, attacker probes all lines used to pack target set

All hits Victim line ≤ S segments

Any miss Victim line > S segments

Tag0 Tag1 Data arrayTag2 Tag3

S=4

Page 50: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility11

Attacker packs target set with lines of known sizes, leaving S free segments and at least one free tag

After victim accesses target set, attacker probes all lines used to pack target set

All hits Victim line ≤ S segments

Any miss Victim line > S segments

Tag0 Tag1 Data arrayTag2 Tag3

Tag0 Tag1 Data arrayTag2 Tag3

S=4

Page 51: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility11

Attacker packs target set with lines of known sizes, leaving S free segments and at least one free tag

After victim accesses target set, attacker probes all lines used to pack target set

All hits Victim line ≤ S segments

Any miss Victim line > S segments

Tag0 Tag1 Data arrayTag2 Tag3

Tag0 Tag1 Data arrayTag2 Tag3

S=4

Miss Victim > 4

segments

Page 52: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Pack+Probe: Measuring Compressibility11

Attacker packs target set with lines of known sizes, leaving S free segments and at least one free tag

After victim accesses target set, attacker probes all lines used to pack target set

All hits Victim line ≤ S segments

Any miss Victim line > S segments

By doing a binary search over S, one can find exact size in

log2(MaxSegmentsPerCacheLine) measurements

Tag0 Tag1 Data arrayTag2 Tag3

Tag0 Tag1 Data arrayTag2 Tag3

S=4

Miss Victim > 4

segments

Page 53: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker: Exploiting Data Colocation to Leak Secrets12

Threat model:

Attacker and victim run in different domains,share compressed cache (as in Pack+Probe)

Attacker can get victim to collocate attacker-controlled datanear victim’s own secret data

Goal: Leak victim’s data

Core Core

L2 L2

Compressed LLC

Main Memory

encrypt 0x01…

Pack+Probe

Page 54: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker: Exploiting Data Colocation to Leak Secrets12

Threat model:

Attacker and victim run in different domains,share compressed cache (as in Pack+Probe)

Attacker can get victim to collocate attacker-controlled datanear victim’s own secret data

Goal: Leak victim’s data

Multiple colocation vectors:

Victim itself colocates (contiguous allocation, stack spills, etc.)

Memory safety violations (buffer overflows, heap spraying, etc.)

Core Core

L2 L2

Compressed LLC

Main Memory

encrypt 0x01…

Pack+Probe

Page 55: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker: Exploiting Data Colocation to Leak Secrets12

Threat model:

Attacker and victim run in different domains,share compressed cache (as in Pack+Probe)

Attacker can get victim to collocate attacker-controlled datanear victim’s own secret data

Goal: Leak victim’s data

Multiple colocation vectors:

Victim itself colocates (contiguous allocation, stack spills, etc.)

Memory safety violations (buffer overflows, heap spraying, etc.)

Safecracker changes attacker-controlled data to reveal

nearby secret data through changes in compressibility

Search strategy depends on compression algorithm

Core Core

L2 L2

Compressed LLC

Main Memory

encrypt 0x01…

Pack+Probe

Page 56: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI13

Starting from largest delta, sweep high-order bytes until target line

decreases in size

Page 57: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI13

Starting from largest delta, sweep high-order bytes until target line

decreases in size

… 0x000000000x00000000 0x0F00BA20 32B

Compressed

sizeSecret data

Attacker-controlled input

Page 58: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI13

Starting from largest delta, sweep high-order bytes until target line

decreases in size

… 0x000000000x00000000 0x0F00BA20

… 0x000100000x00010000 0x0F00BA20 32B

32B

Compressed

sizeSecret data

Attacker-controlled input

Page 59: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI13

Starting from largest delta, sweep high-order bytes until target line

decreases in size

… 0x000000000x00000000 0x0F00BA20

… 0x000100000x00010000 0x0F00BA20 32B

32B

Compressed

size

… 0x0F0000000x0F000000 0x0F00BA20

Secret data

Attacker-controlled input

Page 60: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI13

Starting from largest delta, sweep high-order bytes until target line

decreases in size

… 0x000000000x00000000 0x0F00BA20

… 0x000100000x00010000 0x0F00BA20 32B

32B

Compressed

size

… 0x0F0000000x0F000000 0x0F00BA20

20B !0x0F000000 0000 0000 0000 0000 0000 0000 0000 BA20

4B base 2B deltas

Secret data

Attacker-controlled input

Page 61: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI 14

Continue sweeping lower-order bytes until recovering all bytes

Page 62: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI 14

Continue sweeping lower-order bytes until recovering all bytes

Secret data

Attacker-controlled input… 0x0F0001000x0F000100 0x0F00BA20 20B

Compressed

size

Page 63: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI 14

Continue sweeping lower-order bytes until recovering all bytes

Secret data

Attacker-controlled input… 0x0F0001000x0F000100 0x0F00BA20

… 0x0F00BA000x0F00BA00 0x0F00BA20 12B

20B

Compressed

size

Page 64: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI 14

Continue sweeping lower-order bytes until recovering all bytes

Secret data

Attacker-controlled input… 0x0F0001000x0F000100 0x0F00BA20

… 0x0F00BA000x0F00BA00 0x0F00BA20 12B

20B

Compressed

size

… 0x0F00BA200x0F00BA20 0x0F00BA20 8B

Page 65: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker on BDI 14

Continue sweeping lower-order bytes until recovering all bytes

BDI allows recovering up to 8 bytes this way

Secret data

Attacker-controlled input… 0x0F0001000x0F000100 0x0F00BA20

… 0x0F00BA000x0F00BA00 0x0F00BA20 12B

20B

Compressed

size

… 0x0F00BA200x0F00BA20 0x0F00BA20 8B

Secret Size Compression Format Sequence Attempts

2B NoComp→B2D1→B8D0 O(28)

4B NoComp→B4D2→B4D1→B8D0 O(216)

8B NoComp→B8D4→B8D2→B8D1→B8D0 O(232)

Page 66: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Buffer overflows let Safecracker control where attacker-

controlled data is located

Makes search more efficient

Can leak data far away from buffer

Enhancing Safecracker w/ buffer overflows15

Page 67: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Buffer overflows let Safecracker control where attacker-

controlled data is located

Makes search more efficient

Can leak data far away from buffer

With BDI, can leak 1/8th of victim’s memory!

Other compression algorithms (e.g., RLE) allow more leakage

Enhancing Safecracker w/ buffer overflows15

Page 68: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker Evaluation16

Microarchitectural simulation using zsim

Multicore system modeled after SkylakeCore Core

L2 L2

Compressed LLC

Main Memory

8MB VSC with 64-byte lines,

2x tag array, 32 tags/set

BDI compression

Page 69: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker Evaluation16

Microarchitectural simulation using zsim

Multicore system modeled after Skylake

Two Proof-of-Concept (PoC) workloads:

Login server that colocates key and attacker data

Server with buffer overflow + key elsewhere in stack

Core Core

L2 L2

Compressed LLC

Main Memory

8MB VSC with 64-byte lines,

2x tag array, 32 tags/set

BDI compression

Page 70: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker steals secrets quickly17

PoC 1: Fixed colocation

Page 71: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker steals secrets quickly17

PoC 1: Fixed colocation

Leaks 4B in under 100ms, 6B in 200ms

(comparable to time spent finding target set)

Page 72: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker steals secrets quickly17

PoC 1: Fixed colocation

Leaks 4B in under 100ms, 6B in 200ms

(comparable to time spent finding target set)

8B would take much longer (~90 hours)

Page 73: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker steals secrets quickly17

PoC 1: Fixed colocation

Leaks 4B in under 100ms, 6B in 200ms

(comparable to time spent finding target set)

8B would take much longer (~90 hours)

PoC 2: Buffer overflow

Page 74: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Safecracker steals secrets quickly17

PoC 1: Fixed colocation

Leaks 4B in under 100ms, 6B in 200ms

(comparable to time spent finding target set)

8B would take much longer (~90 hours)

PoC 2: Buffer overflow

Leaks 8B in ~10ms

Attack time grows linearly with leaked bytes

Page 75: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Generalizing attacks to other compressed caches18

Most compressed cache architectures allow conflicts among a small set of

lines Pack+Probe still applies

Page 76: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Generalizing attacks to other compressed caches18

Most compressed cache architectures allow conflicts among a small set of

lines Pack+Probe still applies

See paper for more discussions

Page 77: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Generalizing attacks to other compressed caches18

Most compressed cache architectures allow conflicts among a small set of

lines Pack+Probe still applies

See paper for more discussions

Compressibility always leaks information about data

More info the better the compression algorithm is

Page 78: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Generalizing attacks to other compressed caches18

Most compressed cache architectures allow conflicts among a small set of

lines Pack+Probe still applies

See paper for more discussions

Compressibility always leaks information about data

More info the better the compression algorithm is

Adaptive compression algorithms use shared state

Page 79: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Generalizing attacks to other compressed caches18

Most compressed cache architectures allow conflicts among a small set of

lines Pack+Probe still applies

See paper for more discussions

Compressibility always leaks information about data

More info the better the compression algorithm is

Adaptive compression algorithms use shared state

additional attack vector

Page 80: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Defense against cache compression attacks19

Page 81: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Defense against cache compression attacks19

Cache partitioning for isolation

Prevents attacks without software changes

Invasive: must partition both tag and data arrays

Page 82: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Defense against cache compression attacks19

Cache partitioning for isolation

Prevents attacks without software changes

Invasive: must partition both tag and data arrays

Performance distribution of 25 mixes of 4 SPEC CPU2006 apps, using no and

static partitioning:

Page 83: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Defense against cache compression attacks19

Cache partitioning for isolation

Prevents attacks without software changes

Invasive: must partition both tag and data arrays

Performance distribution of 25 mixes of 4 SPEC CPU2006 apps, using no and

static partitioning: Partitioning increases fragmentation in

VSC, reduces effective compression ratio

Page 84: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

See paper for more!20

Other possible defenses for compressed cache attacks

Examples of vulnerable apps due to colocation with attacker-controlled data

Discussion on generalizing attacks to other compressed caches

Artifact description

Page 85: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Conclusions21

Compressed caches introduce new side channel & attacks

Page 86: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Conclusions21

Compressed caches introduce new side channel & attacks

Pack+Probe exploits compressed cache architectures to observe compressibility of

victim’s lines

Page 87: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Conclusions21

Compressed caches introduce new side channel & attacks

Pack+Probe exploits compressed cache architectures to observe compressibility of victim’s lines

Safecracker exploits compression algorithms + colocation of attacker-controlled & secret data to leak data quickly

Can leak a large fraction of program data

Potentially as damaging as speculation-based attacks

Page 88: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

Conclusions21

Compressed caches introduce new side channel & attacks

Pack+Probe exploits compressed cache architectures to observe compressibility of victim’s lines

Safecracker exploits compression algorithms + colocation of attacker-controlled & secret data to leak data quickly

Can leak a large fraction of program data

Potentially as damaging as speculation-based attacks

Defenses have drawbacks

Motivates future work on efficient defenses

Page 89: Safecracker: Leaking Secrets through Compressed Cachespeople.csail.mit.edu/sanchez/papers/2020... · Po-An Tsai, Andres Sanchez, Christopher Fletcher, and Daniel Sanchez ASPLOS 2020

THANK YOU FOR WATCHING!

SHARE YOUR QUESTIONS/COMMENTS WITH US!22

Attacker Victimencrypt 0x01…

1 Attacker sends encryption

request to victim

Secret key

Attacker-controlled input

0x01020304050607 0x012 Victim stores input next to key

7B cache line

Cache compresses line

3 Attacker measures line’s

compressed size, infers

0x01 is in the secret data

Compromises secret key in ~10ms

Safecracker: Leaking Secrets through Compressed Caches