Side Channel Vulnerabilities

What can we infer about another thread by observing its effect on the system state? Can we trigger the exposure of private data?

1. Exfiltration

One example is exfiltration, where attacker and victim threads may share a L2 cache. To do this, the attacker could:

2. Shared State

For a side channel to be exploited, there must be a shared state affected by the execution of both attacker and victim.

3. Victim Execution

To perform a side channel attack the attacker must trigger victim execution:

Function Calls as Side Channels

This is already in the same address space! However, it is still used for:

  • Testing language based security.
  • When victim is an object with secret state and public access method.

Historically, to limit the cost of a context switch, the OS would store copies of all of its page address translations alongside each process, marked with supervisor only access. This avoids a TLB flush. However, this means a spectre attack can be used to access kernel data.

4. Avoiding Attacks

Kernel Address Space Layout Randomisation (KASLR) randomises the placement of code and data in the address space, making spectre attacks guess where the data it wants is stored. This is not foolproof.

Kernel Address Space Isolation (KASI) changes the virtual address space mapping every time the kernel is entered (flushes TLB). This mitigates spectre attacks but has a significant performance impact. However, this is no match for Spectre 2 :(`

4.2 Spectre 2

Attacks could trick the branch predictor into executing a certain piece of code. It:

  1. Finds a gadget (secret code) in the victims code space.
  2. Trains the branch predictor to speculatively branch to the gadget when a syscall is executed.
  3. Observe microarchitectural or cache side channel from the speculatively executed gadget.
  4. Steal!

To mitigate this we could:

1RP0: call RP2 ; Push RP1 addr onto stack, jump to RP2 2RP1: int 3 ; Breakpoint to capture speculation 3RP2: mov [rsp], <Jump Target> ; Overwrite return addr to desired target 4RP3: ret ; Return
Back to Home