Tamper-evident logging demo
Play root on a logging host, in three parts that follow the lecture. Each part adds one defense, and you try to beat it.
The story. An attacker becomes root on the computer that keeps the logs (the host). Root can read every secret in memory and change any file. We cannot stop it from lying about what happens next. The question is narrower: can root rewrite the records written before it arrived, without an auditor, a trusted machine off the host, noticing?
Each part adds one defense from the lecture. Read the short story, follow the numbered steps under the widget, and predict each result before you press the button. Hashes and tags are real (SHA-256 and HMAC-SHA256) but shown as their first 4 hex digits; hover over a value to see all 64.
Part 1 · Hash chain: send a fingerprint off the host
Each record ri gets a chain value Ci = H(Ci-1, i, ri). C2 is not a record: it is one short hash that covers r1 and r2. The hash has no secret, so anyone can recompute it, root included. Before root arrived, the host sent C3 to the auditor.
| # | Record (edit me) | Chain value stored on the host | Chain value recomputed from the records |
|---|
The host's own check
The auditor's check
Try these
- Change r2 from
read secrettoread notes. Which check fails, and where? - Now press recompute. What does the host's check say? The auditor's?
- Reset. Change r4 and r5, then recompute. Why does the auditor see nothing wrong?
- Reset. Delete the last record twice, then once more. When does the auditor notice?
Part 2 · MAC and forward keys: a secret root cannot reach
Now each record gets a tag, ti = MAC(Ki, i, ri). Without the key, root can edit a record but cannot make its matching tag. The auditor keeps the first key off the host and recomputes every tag. Root arrives after record 3 and reads whatever key is in memory at that moment.
One permanent key: every record uses the same K, so root steals the key for all of them. Forward keys: after each record the logger computes Ki+1 = F(Ki) with a one-way F and erases Ki. Root steals K4; it can compute K5, but never K3, K2 or K1.
| # | Record (edit me) | Its key, when root arrives | Tag stored on the host | Tag the auditor recomputes |
|---|
The auditor's check
What actually happened
Try these
- With one permanent key, change r2 to
read notes. What does the auditor say? Now press re-tag. And now? - Switch to forward keys. Change r2 again and press re-tag. Why does it fail this time?
- Change r5 to
rm nothingand re-tag. Is the change caught? Why is that not a broken design? - Tick the logger forgot to erase K3, change r3, and re-tag. Which records are still protected?
Part 3 · One running tag, and the rollback attack
Keeping one tag per record costs space, so the logger folds every tag into one running tag: Ti = Ti-1 XOR ti, starting from T0 = 0. It carries a secret state S instead of a key: each step turns Si-1 into the key Ki and the next state Si, then erases the old state. The host remembers enough to continue; the auditor kept S0, enough to check the past.
After record 4 the logger also saved a checkpoint of the running tag. Root arrives after record 8 and holds only S8. It cannot forge a tag for old records, but it does not need to: it can delete the end and show the old, real checkpoint. That is a rollback. Rewriting creates false evidence; rollback reuses real old evidence.
Stored on the host
What root holds
| # | Record on the host (edit me) | Auditor: this record's tag | Auditor: running tag so far |
|---|
Auditor: is this the full log?
Auditor: are r1 to r4 authentic?
Try these
- With a plain checkpoint, press delete and show the checkpoint. Does the auditor accept the four-record log as the full log? Did root forge anything?
- Switch to masked (this resets) and do the same. What changes, and why can root not unmask the value itself? The auditor can check r1 to r4; why does it still refuse them as the whole log?
- Reset and change r2. Both checks fail. Which erased value would root need to fix them?