Respond to a tampered target#
shirudo reports tampered when the state it protects is not what it
recorded. Handle every tampered as an incident: keep the evidence,
get an account from the TPM that the target cannot forge, and compare it
with your own records.
A target reports tampered in two ways:
A command refuses with the failure category
tampered. A load or unload refuses before it touches the kernel when the BPF keyring is not the one init froze, when the LSM link is not pinned, or when the register differs from the value--expect-chaingave. The last case carries the messagechain_drift. A load is also undone when the register refuses its extension because it is not the register init bound. Init refuses when the register it recorded this boot is gone or replaced, or when another task restricted the BPF keyring first.shirudo statusreports the verdicttampered: the live register differs from the eventlog replay, the BPF keyring is not the one init froze or is gone, or the config PCR, the activation records and the mounted config disagree.
Do not retry the refused command, with or without an --expect-chain
value read from the target. A value read from the target accepts
whatever changed it. Do not reboot the target before the evidence is
safe: a reboot starts a new register, and the TPM can no longer certify
the state of this boot.
A tamper or integrity counter that moved is a different signal: something tried an operation and the LSM refused it. Tamper counters and Integrity counters explain the counters.
Before you begin#
Root on the target. On the target,
shirudois the runtime image’s binary, as Run shirudo on the target sets up.The operator host with the operator package, and a place off the target for the evidence.
The target’s enrolled attestation key name, and the values Attest targets pins: the endorsement key name, the PCR 9 and PCR 11 binding values of its UKI, and the approved config root and PCR.
Your records of what the target should run: the certificates it enrolled, the upatches it restored at boot, and every load and unload since.
Preserve the evidence#
Stop the timers that change state, so that nothing extends the register while you collect evidence:
target# systemctl stop shirudo-bpm-repo-update.timer shirudo-bpm-tree-sync.timer
shirudo-bpm-repo-update.timerrunsshirudo bpm upgradeevery 60 seconds, andshirudo-bpm-tree-sync.timerapplies the upatch tree every 60 seconds. Both load and unload upatches.Save the target’s own account, with this boot’s eventlog:
target# shirudo status --json --include-eventlog > status.json
statusruns in every state, and without--checkit exits 0 even when the verdict istampered. Keep the file, but do not rely on it: the target wrote it.Copy the eventlog, the pending init record and the config activation records:
target# mkdir evidence target# cp /var/lib/shirudo/eventlog evidence/ target# cp /var/lib/shirudo/config-update/state evidence/ target# cp /var/lib/shirudo/config-update/events evidence/
Copy
/run/shirudo/eventlog.pendingtoo when it exists. Use plaincp. With-aor--preserve=xattr,cptries to copy the seal label to the copy, which the seal refuses and counts asSealLabel.Save the journal of this boot:
target# journalctl -b -o export > evidence/journal.export
shirudo logs under the identifier
shirudo. The journal holds the refusal messages, and an audit line for every measured load and unload with the register value after it.Choose a fresh nonce on the operator host:
operator$ openssl rand -hex 32
Have the TPM sign evidence for that nonce:
target# shirudo attest --nonce=<nonce> --output=evidence/evidence.json
When the config cannot be verified or its activation is pending, every command but
statusandimage statusrefuses,attestincluded, withshirudo: image state:and the reason. The TPM cannot certify this boot’s state then. Keep what steps 2 to 4 saved and go to After the investigation.Copy
status.jsonand theevidencedirectory to the operator host.
Verify with the TPM#
Predict the register from your records, as Attest targets describes. Never take the certificates or the events from the target’s eventlog: that would check the target against itself.
operator$ shirudo attest predict --cert=<cert> --upatch=<upatch> \ --event=load:<name>=<payload-sha256>
<cert>is each certificate the target enrolled,<upatch>each upatch it restored at boot, and each--event=one change after boot that you know of. Useregister_after_events, orregister_at_bootwhen there are no events.Verify the evidence with every value pinned:
operator$ shirudo attest verify --evidence=evidence.json --nonce=<nonce> \ --ak-name=<ak-name> --ek-name=<ek-name> \ --expect-bind-pcr=9=<pcr9> --expect-bind-pcr=11=<pcr11> \ --require-initrd --expect-chain=<register> \ --expect-config-root=<config-root> --expect-config-pcr=<config-pcr>
Attest targets explains each option and the report.
Read the result#
Result |
Meaning |
Next |
|---|---|---|
|
The TPM certifies a register that your records explain. For a
|
Find out who issued the command with that value. Record the incident. |
|
The register is a genuine record, but it holds changes your
records do not cover. The |
Match every note with the journal’s |
|
Something extended or replaced the register outside shirudo’s records, or bound it outside the initrd. |
Treat the target as compromised. Keep every file. |
|
The evidence is not this TPM’s answer to your request. |
Treat the target and the path you collected it on as compromised. |
|
The config PCR, the activation records and the mounted config disagree, or an activation is pending. |
Keep |
After the investigation#
Reboot the target once the evidence is off it. The new boot binds a new register and runs init from the initrd again.
Verify the new boot with every value pinned, as in Verify with the TPM. A upatch that someone loaded with an enrolled key is in the archive, and init restores it at boot. The init event then covers it, and the verification fails on
state: init event covers the expected certificate, set and tree root.Remove what you did not authorize: unload a upatch with a signed unload directive, or revoke its signer through a signed config as Manage signing keys describes.
The timers you stopped start again at boot when they are enabled.