Hardware security

Table of Contents

CPUs

CPU caches

Caches: add fast-path access to memory

Basic RELOAD attack: you can determine which function is being executed using a timing side channel – a function that was already executed will be in the cache, so faster.

Important properties:

Addressing:

Timing cache attack

Threat model

Flushing the cache: clflush (x86)

Observing cache activity: FLUSH+RELOAD

Cache attacks on hardware - out-of-order execution

for FLUSH+RELOAD, victim hardware unit must:

covert channel: both parties controlled by attacker

Rogue Data Cache Load (Meltdown): flush+reload attack

Mitigating Meltdown:

Transient execution attacks

Branch prediction unit: avoids pipeline stalls using speculative execution

After branch prediction:

Spectre v1: bounds check bypass

Mitigations for Spectre v1:

Spectre v2: branch target injection

Mitigations for Spectre v2:

Other applications of transient/speculative execution

Advanced cache attacks

Limitations of flush+reload:

Eviction-based attacks:

Building eviction set for L1:

Building an eviction set for L2:

  1. Allocate large pool of pages (large enough to cover all cache sets and ways of target cache)
  2. Pick page P from pool
  3. Check that accessing first cache line of all other pages evicts first cache line of P
  4. Pick page Q from pool and remove it. See if pool without Q still evicts P. If yes, remove Q from pool.
  5. Keep removing pages until pool has exactly 4 members. This is eviction set for P (64 sets).
  6. Try this again with page that eviction set for P doesn’t does not evict to find another eviction set.

In L1 and L2, cache sets will be striped throughout memory. But because L3 is sliced, the distribution will be chaotic. However, the same eviction set algorithm also works for L3, because no assumptions are made on physical addresses.

Prime+probe attack:

Evict+time: