DOCS / FAB-SECURITY

Fab security: every computer in the building

Research date for everything below: 2026-11-27, unless a line says otherwise.

Jon, 2026-11-27: "a persistent/trusted/tamperproof environment would be extemely important for a fab like this. you dont want anyone messing with important work, it could cost money, be dangerous". And: "we dont need to immediately buy anything, we are just speccing this out. for the fab. we can iteratively improve this over time until its sound enough to buy and test irl."

So nothing here is bought, and every claim about the design is unknown until it earns a grade. It starts from a plan Jon drafted with Claude the same day ("Where this came from", below). What already exists is in prior-art.md, "Attesting a fab's computers".

What it protects, and what it doesn't. It protects the work: designs, recipes, records, and the time and money in them. It doesn't make the fab safe. That is the interlocks' job (fab.md, rule 2): a tampered computer must be unable to make a tool dangerous, whatever this check says.

Where it stands

As of 2026-11-29: each step of "Getting to v1.0" (below), then parts of the design still to build, with what holds each. An item is done or partly done only with the tests that hold it, named here; crates/repo fails if a named test doesn't exist (the_fab_security_status_names_real_tests). It can't see a row the work left behind, such as one still "not started" after its code is written. Of the eleven items of "Before anything is bought", one is answered, for Fedora's Cloud image and not yet its bootc image.

itemstatusheld by
1a: the judge (checks 1 to 4, the findings table, the verifier's own list)donethe_tpm_s_own_quotes_pass_the_checks, an_old_answer_sent_again_is_refused, the_findings_table_in_its_order, every_enrolled_computer_is_judged_from_the_verifier_s_own_list
1b: the boot event log (check 5)doneeach_boot_s_log_replays_to_its_quote_and_is_the_reference, a_log_changed_by_the_hub_is_refused, each_boot_s_log_replays_to_the_pcrs_its_tpm_held
1c: the IMA entries (check 6)not started—
enrollment: credential activation, and the fingerprint comparednot started—
how the verifier is given its reference valuesnot started—
the hub's messages: CBOR in frames with a length and a CRC32not started—
2: Kani on the parsers and the findings tablepartly: the event log's reader never panics, up to a bound, and the rows of the findings table judge decides; not yet what a log reads as, the reference's list, the signature's reader, the verifier's own list, or the hub's messages, which aren't builtany_spec_id_event_is_read_or_refused_without_a_panic, any_entries_after_a_spec_id_event_are_read_or_refused_without_a_panic, each_verdict_is_the_first_row_of_the_findings_table_that_holds
3: virtual machinespartly: Fedora's Cloud image, not yet its bootc image, Keylime, IMA entries per day or the staged attacksboots_before_the_flag_is_set_are_the_same_boot, the_boot_success_flag_changes_pcrs_8_and_9
a computer off while no one is there: the power-on table and the check stickpartly: the power-on table, on swtpm's power events and a TPM2_Clear under both hierarchies' keys, and checked by Kani; not yet the check stick, its disk check or the verdict's PCR, the storage-hierarchy key in enrollment, a real computer's cap, or its intrusion switchthe_power_on_table_on_real_power_events, an_off_computer_with_a_storage_key_is_red_after_a_clear, each_computer_is_judged_by_its_mode, each_power_on_verdict_is_the_first_row_of_its_table_that_holds
4: the Pico 2 W (a P-256 check's time; the raw ring oscillator and its health tests)not started—
5: an attack read by someone elsenot started—
the verifier's firmware on Tock: its processes, drivers, display and stored state, secure boot, and a second verifiernot started—
disk unlock: the TPM and a PIN, and a signed policy on PCR 11 once the image boots unified kernel imagesnot started—
the network: its zones, the router, and Keylime's agents pushing to the hubnot started—
the room: the cabinet, the UPS read by NUT, intrusion switches, seals, cameras and sensorsnot started—
our own microcontrollers' identity, derived from their firmware as DICE doesnot started—
the list of the building's computers, each in a classnot started—

The goal

Leave the fab, come back, and show in about a minute, for each computer the verifier checks, that:

And for every other computer in the building, what its class has instead ("Every computer in the building", next).

Every computer in the building

Jon, 2026-11-29: "this should be for every computer basically within an entire building". So each computer in the building is to be in one of these classes, by what can show it was changed. The classes are a proposal, unknown until each is checked, and the list of the building's computers is still to write.

classfor examplewhat shows a change
a computer with a TPM and measured boot, running our imagethe hub, the stores' server, each tool's station, the cameras' recorder, a workstationthe verifier's check ("Each check, leaving and coming back"), on while no one is there or off ("Off while no one is there")
a microcontroller running our firmwarethe sputter station's controller, the stores' shelf nodes (makerspace.md, "The nodes"), the mesh's nodes once they run our own firmware (mesh.md), the bench's supply enforceran identity derived from its firmware, as DICE does ("The tools' controllers"), unknown; until then, its firmware's hash recorded when it is flashed
a bought device that can't be checkedthe tools' bought controllers, the router, switches, the UPS, the cameras what stands in for a check, as each applies: a zone with no internet ("The network"), the locked cabinet or a seal ("The room"), its firmware version recorded and its settings in the repo
the building's own systemsthe fire alarm, door access, heating and ventilationnot decided; those wired to mains are installed by a licensed electrician (fab.md, rule 3)
a person's own devicephones, laptopsnone; which network one may join is not decided

Trust only the device in your pocket

threatwhat shows it
someone changes the firmware, bootloader or disk, then puts things backa restart, or a boot measurement that isn't ours; firmware rewritten in its flash while the computer is off can report the old measurements, unless hardware checks it ("The computers the verifier checks")
a look-alike computer replaces a real oneit can't sign with the enrolled key
a compromised system reports "all clear"the TPM signs the quote, not the system
an old clean answer, sent againevery challenge is new
the hub is compromisedthe verifier makes the challenges and judges the answers

Out of scope: attacks on the chips themselves, such as fault injection or decapping, given long unattended access. The seals and cameras are there to make those hard to do unseen. Not seen by any check here: an attack on a running computer that neither restarts it nor runs a file the image and its containers don't hold, such as one that uses only programs already there. What IMA measures is set by its policy, which is still to write.

Enrolling a computer

Once, when the computer is known to be clean:

  1. The computer makes an attestation key in its TPM, in the storage hierarchy, so that a TPM2_Clear makes it anew ("Off while no one is there").
  2. The verifier proves that key is in that TPM, by credential activation against the TPM's endorsement key. It makes the challenge itself (MakeCredential). Checked against the TPM maker's certificate, the endorsement key puts the verifier's trust in the TPM, not in the system enrolling it. An endorsement key only recorded at enrollment trusts that system, at that one clean moment. Whether the verifier can check the maker's certificate itself is unknown.
  3. The computer shows the key's fingerprint on its own screen and the verifier on its own, and a person compares at least 80 bits of it before pressing accept.
  4. For a computer off while no one is there, the verifier records the restart count the key signs in a boot with no resume since it started (Off, in firmware/verifier).

Each check, leaving and coming back

The verifier sends a challenge to every computer it enrolled, from its own list, not the hub's, so a computer the hub leaves out shows red. Each challenge is 32 bytes from the RP2350's random-number generator, hashed with SHA-256, new for each computer and each check. The computer answers with a quote of PCRs 0 to 10, its boot event log, and the IMA entries added since the last check. Each message is a CBOR object in a frame with its length and a CRC32.

The verifier checks that:

  1. the quote is signed by the enrolled key;
  2. the TPM made it, as a quote (TPM_GENERATED_VALUE, TPM_ST_ATTEST_QUOTE), which means something because enrollment showed the key is the TPM's own;
  3. it carries the challenge just sent;
  4. the PCR values the hub passed on hash to the digest inside the signed quote;
  5. the event log replays to PCRs 0 to 9, and its entries match the reference values;
  6. the new IMA entries replay from the last check's PCR 10 to this one, and each is a file the image or its containers hold.

It reads the reset and restart counts, the clock and the TPM's firmware version from the signed quote.

Checks 1 to 4, the verifier's own list, and the findings table's rows for restarts and for PCRs against the last snapshot are tested on real quotes from swtpm, a software TPM, and on copies changed as a hub could change them. Check 5, and the row for PCRs 0 to 9 against the reference, are tested on those quotes with the event log of a made-up boot that swtpm was given entry by entry, on logs changed as a hub could change them, and on the logs of seven real boots (step 3's first slice, below). The rows for the TPM's firmware and for the clock are tested on values made up for the test (firmware/verifier; architecture.md, "Rules"). That the event log's reader never panics is also checked by Kani, up to the bounds step 2 states ("Getting to v1.0"), and so are the rows of the table judge decides, for any snapshot and quote. Check 6 is not built yet, nor how the verifier is given its reference values.

findingresult
the reset or restart count changedred: restarted
a PCR changed since the snapshot, or a PCR from 0 to 9 or an event log entry isn't the referencered: boot chain isn't ours
a new IMA entry isn't a file in the imagered: something new ran
the TPM's firmware version changedred: TPM firmware changed
no valid answerred: missing
the clock went backwardsamber: look into it
everything matchesgreen

Why PCRs 0 to 10. GRUB puts the kernel command line in PCR 8, and every file it reads, the kernel and initramfs included, in PCR 9 (GRUB 2.16's manual, "Measured Boot", read 2026-11-27). IMA measures into PCR 10 by default (IMA_MEASURE_PCR_IDX, "default 10", in Linux's security/integrity/ima/Kconfig at f4585067). Fedora 45's Cloud image, booted under QEMU on 2026-11-28, measures GRUB's commands and the kernel command line into PCR 8, and nothing else there, and the files GRUB reads, the kernel and initramfs among them, into PCR 9 (tested: fedora_s_grub_measures_its_commands_into_pcr_8_and_the_files_it_reads_into_pcr_9, step 3's first slice, below). Fedora's bootc image is not yet run.

Reference values, not only the last snapshot. Comparing with the last check alone would pass a computer that was already wrong when it was left. So:

Keylime, on the hub, keeps attesting every computer while no one is there, and raises an alarm on a failure. The hub is not trusted, so that alarm is a help, not the judgement. The judgement is the verifier's, at the next check.

Off while no one is there

Jon, 2026-11-29: a second mode, for a computer that is off while no one is there, as an anti-evil-maid program keeps one. Each computer is enrolled in one of the two (Mode, in firmware/verifier):

The return, in order. It is a proposal, built only where a test is named below.

  1. Leaving: the verifier takes the snapshot quote; the computer is shut down.
  2. Coming back, it is booted from its check stick: a USB stick of our own, whose boot is pinned (its shim, boot loader, kernel and initramfs, and the check's own code, which the boot measures into PCR 9), never from the computer's own disk. That is the first boot since the snapshot.
  3. The stick's code answers the verifier's challenge with a quote of that boot by the computer's attestation key, and the verifier judges it by the power-on table, below, against a reference for this computer booting this stick, PCRs 0 to 9.
  4. Then the stick reads the computer's disk as data, never running it: every file of the EFI system partition and of /boot, as they are and as the next boot will leave them; the partition table and the space after it; each encrypted volume's header and key slots; the Secure Boot keys, the boot entries and the names of every EFI variable; the ACPI tables, less the fields the firmware fills in at every start; the firmware's and the hardware's identity. It compares them with a baseline the same stick recorded when the computer was known good, kept authenticated so that a stolen stick can't rewrite it. The verdict's digest is extended into a PCR the stick's boot leaves alone, and quoted, so the verdict the verifier shows is the one the attested boot reached, on the verifier's own screen. How the stick's session reaches the verifier, through the hub or by cable, is not designed yet.
  5. Only on green is the disk's passphrase typed, into the stick's session, which then reads the computer's root filesystem as data in the same way; then the computer is shut down, and booted from its own disk.

So the disk's passphrase goes only to a boot shown to be ours, as Qubes's Anti Evil Maid shows its secret "before you enter your LUKS disk encryption or key file passphrase" (its README); and the boot chain on the computer's own disk, unchecked, never runs before the check. What PCRs don't measure, the disk check reads; what the screen could fake, the verifier shows. But firmware rewritten in its flash while the computer is off can report the old measurements, which the power-on table would take as ours; whether reading the flash as data, from the check stick, would show the rewrite is unknown. What stands against it is in "The computers the verifier checks".

It rests on what a TPM counts across power (TPM 2.0 Library Part 1, Revision 01.59, read 2026-11-29). resetCount goes up by one on each TPM Reset and "is set to zero in TPM2_Clear()" (§36.4). restartCount goes up on a TPM Resume or Restart, as after a suspend, and goes back to zero on a TPM Reset (§36.5). The TPM lets no software set Clock backward, "except for changes in ownership (TPM2_Clear())" (§36.3): "When the owner of the platform changes (new SPS generated) Clock is reset to zero" (§36.6). Clock is also "reloaded from the NV Clock on each _TPM_Init", so it can come back behind a value reported before a power cut (§36.4, NOTE 2), and its flag safe "is CLEAR after a non-orderly shutdown" (§36.3). A key in the Endorsement hierarchy signs the counts as they are; a key in another has "a key-specific value added", which keeps their differences (§36.7).

The attestation key is to be in the storage hierarchy, so that a TPM2_Clear, which gives the platform a new owner, makes it anew and the enrolled key no longer checks the quote: "Using Clock to do time stamping with a non-duplicable key does not constitute a vulnerability because the signing key also becomes inaccessible when the owner changes" (§36.6). Its counts then carry its offset, so enrollment records the restart count it signs in a boot with no resume since it started (Off, restart_at_boot), and "one more" wraps at the top.

finding, at the first boot since the snapshotresult
the reset count isn't one more, the restart count isn't the key's at boot, or Clock advanced more than the computer's shutdown and one boot takered: it ran while no one was there
a PCR from 0 to 9, or an event log entry, isn't the reference for this computer booting its stickred: boot chain isn't ours
the stick's check of the disk found a change it can't name, or didn't run (not built)red: the disk was changed
the TPM's firmware version changedred: TPM firmware changed
no valid answer, as after a TPM2_Clear made the key anewred: missing
the clock went backwards, or isn't safeamber: look into it
everything matchesgreen

PCRs aren't compared with the snapshot's, since a new boot extends them anew.

Measured on swtpm 0.10.2 (2026-11-29), made by examples/swtpm_quotes.rs and committed as tests/swtpm_power.txt (power: one TPM across power events) and tests/swtpm_clear.txt (clear: a storage-hierarchy key beside an Endorsement one, across a power cycle and a TPM2_Clear), all tested in firmware/verifier:

Not built: the check stick and its code, the disk check, the verdict's PCR (the quote covers PCRs 0 to 10 only), and enrollment, with its key in the storage hierarchy and the restart count it reads at boot. unknown until a real computer is measured: whether its TPM's Clock counts time while the computer is off, which on swtpm it doesn't, and which would leave the cap unable to tell time off from a boot; and how long its shutdown and boot take, which sets the cap. What already exists is in prior-art.md ("Attesting a fab's computers"): anti-evil-maid tools that show the person a secret the TPM unseals only when the PCRs match, none of them, as read, checking the reset count or Clock.

The verifier

The computers the verifier checks

The network

zoneholdsreaches
managementthe hubeach computer's Keylime agent, until the agents push (below)
fab computersthe tools' stations, the stores' servereach other and the hub
tool controllersthe controllers we boughttheir own station only; no internet
cameraslocal camerastheir recorder only; no internet

The room

The tools' controllers

The routine

Where this came from

Jon's plan, drafted with Claude on 2026-11-27. Changed here:

  1. The hub and server board: the H4 family is discontinued, so the H5 is the candidate, and Dasharo is still a release candidate for it.
  2. What ran is judged by the verifier from PCR 10, not by Keylime on a hub the plan itself calls untrusted.
  3. PCRs 0 to 7 became 0 to 10, to cover the kernel command line, the initramfs and what runs.
  4. Reference values and twins, beside the last snapshot.
  5. Enrollment proves the key is the TPM's own, and compares 80 bits, not a short fingerprint.
  6. TrustRoot is dropped.
  7. UART is chosen to keep the hub away from a USB stack, not as a fallback.
  8. The verifier's flash: what needs protecting is that no one changes it, not that no one reads it.
  9. The backup verifier is a second Pico, not a phone app that verifies phones.
  10. The hub's reach into every zone ends once the computers push to it, if Keylime's push model is ready.
  11. The verifier challenges the computers it enrolled, not the list the hub sends.
  12. Every computer in the building, not only the fab's (Jon, 2026-11-29), each in a class by what can show it was changed ("Every computer in the building").
  13. A computer can be off while no one is there (Jon, 2026-11-29), judged on return from a check stick, before its own disk runs ("Off while no one is there").

Left out: the plan's prices, which were estimates, and its computers that aren't the fab's.

Before anything is bought

Getting to v1.0

Jon, 2026-11-27: "great idea", to auditing the design by making it run before anything is bought. The review that found the hub could leave a computer out did it by reading; a test of the verifier's own list would have failed.

v1.0 is reached when:

  1. every threat in "Trust only the device in your pocket" and every row of the findings table has a named test, and taking out the check it covers makes that test fail (tested);
  2. the parser that the hub's messages reach is checked with Kani, up to a stated bound (checked);
  3. one whole leave-and-return runs on virtual machines, with each attack staged;
  4. each item of "Before anything is bought" is answered, or marked as needing the board.

Then one H5 is worth buying, Jon's decision, and a second answers whether twins report identical PCRs.

stepwhatneeds
1aThe judge, in Rust, built for the host and for the RP2350 alike (no_std): the quote's signature, challenge, PCR digest and counts; the findings table; and the verifier's own list of computers. Its test inputs are real quotes from a software TPM, committed with the program that makes them, so the Quality Gate needs no TPM.nothing bought
1bThe boot event log, replayed to PCRs 0 to 9 and checked against reference valuesnothing bought
1cThe IMA entries since the last check, replayed to PCR 10, each with a proof against the image's Merkle rootnothing bought
2Kani on the parser and the findings tablenothing bought
3Virtual machines: Fedora's bootc image under QEMU, with a software TPM and UEFI measured boot, and Keylime's push model between themnothing bought; whether this Mac runs it, or the x86 desktop is needed, is unknown
4A Pico 2 W already on hand: how long a P-256 check takes; the raw ring oscillator with the health testsJon's approval to flash it, since it isn't a lab target; no OTP step; waits until Jon can reach the board (2026-11-27)
5An attack read by someone else: a reviewer given only this section and Sperrle's security analysis, not the reviews beforenothing

Written in docs/fab-security.md, on main; this page is made from it.