CS 4630 Defense Against The Dark Arts
Lecture 23 · Tamper-evident logging

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 hostChain value recomputed from the records

The host's own check

The auditor's check

Try these

  1. Change r2 from read secret to read notes. Which check fails, and where?
  2. Now press recompute. What does the host's check say? The auditor's?
  3. Reset. Change r4 and r5, then recompute. Why does the auditor see nothing wrong?
  4. Reset. Delete the last record twice, then once more. When does the auditor notice?
A chain that checks out on the host proves nothing: the hash has no secret, so root recomputes it. Only a value that left the host before root catches an edit, and only for the records it covers.

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.

Key design:

#Record (edit me)Its key, when root arrivesTag stored on the hostTag the auditor recomputes

The auditor's check

What actually happened

Try these

  1. With one permanent key, change r2 to read notes. What does the auditor say? Now press re-tag. And now?
  2. Switch to forward keys. Change r2 again and press re-tag. Why does it fail this time?
  3. Change r5 to rm nothing and re-tag. Is the change caught? Why is that not a broken design?
  4. Tick the logger forgot to erase K3, change r3, and re-tag. Which records are still protected?
A stolen key lets root forge tags only for the positions whose keys it can still get. With forward keys, that is the present and the future, never the past, as long as old keys are truly erased and the auditor is safe. Records written after root can carry valid tags and still be false.

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.

The checkpoint is saved as:

Stored on the host

What root holds

#Record on the host (edit me)Auditor: this record's tagAuditor: running tag so far

Auditor: is this the full log?

Auditor: are r1 to r4 authentic?

Try these

  1. 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?
  2. 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?
  3. Reset and change r2. Both checks fail. Which erased value would root need to fix them?
XOR only combines the tags; the protection comes from keys and states that are gone. Masking the checkpoint stops the rollback, and the auditor can still unmask it to confirm the records that survive. The two checks stay apart: an unmasked checkpoint proves r1 to r4, never that the log ended there, since counting it as a final tag would bring the rollback back. None of this brings deleted records back, makes records written after root true, or captures an event that was never logged.