Skip to content

Class 04

Microarchitecture Security

Class video

Assignment

In this lab, you will complete the following tasks:

  1. Measure how long it takes the processor to read data from different levels of the memory hierarchy (the cache vs. main memory / DRAM).
  2. Solve a CTF (capture-the-flag) puzzle using a cache-based side channel attack called Flush+Reload.

The goal of this lab is to give you hands-on experience interacting with the cache on a real machine. In class we talked about the cache hierarchy: the processor keeps recently used data close by in small, fast caches (L1, L2, L3), and falls back to the much slower main memory (DRAM) when the data is not cached. That speed difference is normally invisible to a program — but if we measure carefully, we can see it. And once we can see whether a piece of data was in the cache or not, we can use that as a side channel to learn secrets.

By the end of this lab you will have measured the cache-vs-memory timing difference yourself, and then used it to steal a secret from another program.

Setting Up Your Environment

To compile and run the code in this lab, you need make and gcc installed. On ayour VM, you can install them with:

sudo apt install make gcc

On other systems, use your package manager’s equivalent. If gcc –version and make –version both print something, you are ready to go.