learn-blockchain-with-phoebe / Leader session 2 of 6
Learn Blockchain with Phoebe · Leader session 2 of 6

Tamper evident is not tamper proof

Block 2 of the Harbourgate register says consignment 41 was inspected and the seal was intact. Someone with write access to the database would like it to say the opposite. What follows is not one event, it is three, and they are usually described as though they were one. The edit is caught. The attacker's repair is also caught, one block further down. And then the attacker does the thing that actually works, which takes four blocks and, at difficulty 0, no time at all. The gap between visible and impossible is the whole of tonight.

🟡 Foundations Anyone being sold a chain Anyone who has to sign off on one 45 min
0-3 · Welcome 3-18 · The edit, and the repair 18-26 · What consistency costs 26-45 · Build-along and Q&A
Part 0

The attacker who is allowed in

Assume the worst realistic case rather than a dramatic one. Nobody breaks any hash function, nobody guesses a secret, and nothing is stolen. Someone who already has legitimate write access to the register decides that block 2 should read differently, and they are patient, competent and unhurried. Every result below comes from running that scenario against the six block register and reading what the verification routine says.

Live = presented in the 45 minutes Self-study = the full depth, after class 🔍 Every diagram zooms

★ What you walk out with tonight. The three stages in order, so you never again describe tamper detection as a single event. The number 4, which is how many blocks have to be redone to make the Harbourgate register consistent after an edit at block 2. And a sentence you can say in a procurement meeting without later having to walk it back: the chain makes an edit visible, it does not make an edit impossible.

LiveTwo words that get swapped4 min▶

Tamper evident means an alteration leaves a mark that anyone checking will find. A seal on a shipping container is tamper evident. Tamper proof means an alteration cannot be made at all, which almost nothing in the physical or digital world is, and which a chain certainly is not.

A chain sits firmly in the first category. Its contribution is that the mark left by an alteration is arithmetic rather than physical, so it cannot be faked by a careful hand, and it can be checked by anyone holding a copy without asking permission from whoever keeps the register. That is a genuinely useful property. It is also a much smaller property than the word immutable implies.

Real world

At Harbourgate the edit is caught instantly, the attacker's fix is caught instantly, and the full rewrite succeeds instantly. All three are true at once, and a description that stops after the first one is a description that will embarrass you later.

Self-studyThe words that will keep coming back4 min▶
  • Hash mismatch. A block's stored hash is not the hash of its own contents. The signature of an edit with no repair attempt.
  • Link mismatch. A block's previous hash field does not match the hash of the block above it. The signature of a repair that stopped too early.
  • Reforge. Redoing a block and every block after it so the register is internally consistent again. Practitioner session 5.
  • Tamper evident. An alteration leaves a detectable mark.
  • Tamper proof. An alteration cannot be made. Not a property of any chain.
  • Difficulty. How much work a single block's hash has to cost. Zero here, which is why the rewrite is free. Session 3.
  • Independent copy. The register somebody else holds, which is what turns detection into consequences. Session 4.
Part 1 · covers stages one and two

The edit, and the repair that does not work

15 min live

Verification recomputes every block's hash and compares every block's previous hash field against the block above it. Run it after the edit and it returns one problem. Run it after the attacker's repair and it still returns one problem, in a different place. The count does not improve, which is the part that gets skipped.

Stage one · edit block 2's entry, leave every stored hash alone block 0 block 1 block 2 block 3 block 4 block 5 1 problem hash mismatch at block 2 Block 2 now reads seal BROKEN, and the hash stored in block 2 was not touched. Recomputing block 2 from its own contents gives something else, so the block disagrees with itself. The failure moves. It does not vanish. Stage two · the attacker recomputes block 2's hash as well block 0 block 1 block 2 block 3 block 4 block 5 1 problem link mismatch at block 3 Block 2 now agrees with itself again, and block 3 has not been touched at all. Block 3 still records the hash block 2 had before the edit, so the join between them has come apart. One problem before the repair, one problem after it. The attacker has not reduced the evidence, only relocated it, and the location is a clue to where the edit was.
🔍 Click to zoom - two runs of the same verification against the same register, one before the attacker's repair and one after.
Live The six block register, tampered and verified in this page. Step through the stages.

...

...

...
LiveWhy the failure has to move rather than clear4 min▶

Block 2's hash is a fingerprint of block 2's contents. Change the contents and the old fingerprint is wrong, which is the first failure. Compute the new fingerprint and block 2 is consistent, but block 3 contains a copy of the old fingerprint, which it recorded when it was written, and nothing about editing block 2 reaches into block 3 to update it.

So the repair cannot terminate. Every fix creates the next mismatch one block along, and the only place the sequence can stop is the end of the register. That is the mechanism behind every claim you will hear about rewriting history being harder the further back you go.

LiveReading the output like an auditor3 min▶

The two failure kinds say different things and are worth telling apart. A hash mismatch at block N means block N's contents were changed and nothing else was done. A link mismatch at block N means block N minus one was changed and repaired, and the repair stopped short.

So the location of a link mismatch points one block upwards at where the edit actually was. An attacker who works from the back of the register forwards leaves the mismatch at the very last block they failed to reach, which is why the first index reported is the one worth reading.

Self-studyThe disagreement about the word immutable4 min▶

One camp holds that a chain record is immutable in any sense that matters. Rewriting is detectable by every holder of a copy and, once work is attached to each block, expensive enough that nobody rational attempts it. On that reading the word is a fair summary of the practical situation, and insisting on precision is pedantry.

The other camp holds that immutability is not a property of the data at all. The bytes can be changed by anyone with write access, as tonight demonstrates. What resists the change is the network of independent copies and the people who refuse to accept the rewritten version. Calling the data immutable moves the trust question out of sight rather than solving it, and buyers then skip the question of who holds the other copies.

The split is real and it is not going to be settled here. What is worth noticing is that the second camp's objection is unanswerable on a register with only one copy, which is the shape most organisations actually build.

Part 2 · covers stage three

What making it consistent actually costs

8 min live

The attacker's only winning move is to stop repairing one block at a time and redo everything from the edit to the end of the register. At Harbourgate that is 4 blocks, 2 through 5. The register then verifies clean, with no problems reported at all.

Stage three · everything from the edit to the end of the register block 0 untouched block 1 untouched block 2 edited, must be redone block 3 must be redone block 4 must be redone block 5 must be redone unchanged 4 blocks, 2 through 5 every block from the edit to the end of the register At difficulty 0 this is instant Four hashes recomputed, and the register verifies clean. Nothing in the structure slowed the attacker down at all. Which is exactly why mining exists Make one hash expensive to find and four of them become real work. Session 3 measures what that work actually costs. Visible is not impossible. A chain guarantees a rewrite can be seen by anyone holding a copy. It does not guarantee a rewrite cannot happen. What you can honestly claim about a system built on one stops at the first of those two sentences.
🔍 Click to zoom - the bracket is the attacker's real workload, and its length is set by how far back the edit is.
LiveThe number that matters is the distance from the end4 min▶

Editing block 2 of a six block register means redoing 4 blocks. Editing block 5 would mean redoing 1. Editing block 0 would mean redoing all six. The cost of a rewrite is set entirely by how much register sits after the entry being changed, which has an uncomfortable implication for anything recent.

The most recent entry is always the cheapest to rewrite, and it is usually the entry someone has a live reason to change. A register that has been quiet for a year protects last year's entries very well and this morning's hardly at all.

LiveWhat actually stops the rewrite3 min▶

Nothing in the six block register stops it. The attacker redoes four blocks, verification passes, and the register now says the seal was broken on the earlier inspection as well. On a single copy held by a single organisation, tamper evidence buys nothing at all against an insider with write access, because that insider can also rebuild the evidence.

What turns detection into consequence is somebody else holding a copy. If a buyer, an insurer and the port authority each hold the register, the rewritten version differs from two others and the disagreement is the alarm. The chain provides the comparison; the independent copies provide the reason anyone is comparing. Session 4 is about who those copies belong to.

Self-studyWhere difficulty enters the argument4 min▶

Harbourgate runs at difficulty 0, so producing a block's hash costs one computation. Raise the difficulty and a valid hash has to start with a required number of zeros, which cannot be arranged directly and has to be found by trying nonces until one works. The attacker's four blocks each acquire a cost, and an honest register keeps growing while the attacker works, so the target moves.

The temptation at this point is to quote a number for what that costs. A single mining run is close to uninformative, because the spread around the expected figure is enormous, so any cost claim has to be a mean with its trial count attached. Session 3 does exactly that and the spread is the interesting half.

Part 3 · build-along

Run the attack out loud

19 min hands on

No code. Six steps using the live box above and the register from session 1. The aim is to be able to narrate all three stages without notes, and to stop before the sentence that overclaims.

Predict before you press

Before stepping to stage one, say how many problems verification will report and at which block. Then press it. Getting this right matters less than noticing whether you expected more than one.

Say what the attacker learned

Stage two fixes the hash and the problem count stays at one. Say in a sentence what the attacker gained and what they gave up, given that the new problem is at block 3 rather than block 2.

Read the mismatch backwards

You are handed a register you have never seen and verification reports a link mismatch at block 4. Say which block was edited and how you know. Then say what you would still not know.

Count the workload at each position

For an edit at block 2, block 4 and block 0 in turn, say how many blocks must be redone. Then state the rule in general terms, and say which entries in a long lived register are the cheapest to change.

Ask who else has a copy

Take a register in your own organisation. Name every party that holds an independent copy. If the answer is none, say what your tamper evidence is actually buying you against someone with write access.

Repair last week's sentence

Take the honest claim you wrote in session 1 and edit it until it survives everything on this page. Most sentences lose the word prevents and gain the word detects. Keep it for session 6.

The habit to keep. When somebody says records on their chain cannot be changed, ask two questions. Who has write access to the underlying store, and who else holds a copy to compare against. The first question tells you who can rewrite. The second tells you whether anyone would find out.

Check yourself

Three questions

Block 2's entry is edited and every stored hash is left alone. What does verification report?

Every later block still records the hash its predecessor stored, and none of those stored hashes changed, so every link still joins. The only disagreement is inside block 2, between its contents and the fingerprint sitting in it.

The attacker then recomputes block 2's hash so the block agrees with itself again. What happens to the detection?

Fixing the hash does not hide the edit, it relocates the failure one block along. Block 3 recorded its predecessor's fingerprint when it was written and nothing about editing block 2 updates that copy. The problem count stays at one throughout.

To make the six block register internally consistent after an edit at block 2, how much must the attacker redo, and what does that prove?

Each repair creates the next mismatch, so the sequence only terminates at the end of the register: blocks 2, 3, 4 and 5. With no work attached to a hash, redoing four of them costs nothing, which is why difficulty exists and why detection alone is not protection.

Before session 3

Homework

Twenty minutes, on a claim somebody has already made to you or that you have made yourself.

Find an overclaim in the wild

Locate one sentence in a vendor page, an internal deck or a policy document that says records cannot be altered. Write down what it would have to say instead to be accurate, and note how much weaker it reads.

Size a rewrite in your own terms

For the register you picked in session 1, say how many entries sit after a row someone might want to change today. That count is the attacker's workload before any difficulty is applied, and session 3 puts a cost on each unit of it.

Covered tonight

What this session covers

✓Stage one, the plain editOne problem reported, a hash mismatch at block 2.
✓Stage two, the repair that relocatesStill one problem, now a link mismatch at block 3.
✓Stage three, the full rewrite4 blocks, 2 through 5, and at difficulty 0 it is instant.
✓Tamper evident against tamper proofWhat a chain makes visible, and what it leaves entirely possible.
◐What difficulty does to the rewriteNamed tonight, measured in session 3 as a mean with its trial count.
◐Why independent copies turn detection into consequenceSession 4.
○Key management, rotation and certificate hygieneA discipline of its own, covered in the security and access control courses.
○Named commercial chains and their roadmapsThey move faster than a course can, and none of the mechanism depends on which one.
Take this with you

Cheat sheet

The one sentence. A chain makes an edit visible. It does not make an edit impossible.
Stage one. Edit the entry only: 1 problem, hash mismatch at block 2.
Stage two. Recompute that hash: still 1 problem, link mismatch at block 3.
Stage three. Make it consistent: 4 blocks, 2 through 5, instant at difficulty 0.
Hash mismatch. This block was edited and nothing else was done.
Link mismatch at N. Block N minus one was edited and the repair stopped short.
The workload rule. Redo everything after the edit, so recent entries are the cheapest to rewrite.
The two questions. Who has write access, and who else holds a copy to compare against.