A device verifies a firmware update's vendor signature but never compares the signed subject digest to the bytes it flashes. What has it verified?
answer
- the signature covers a statement
- subject names the artifact by digest
- hash what you will actually use
- detached signature, undeclared artifact
- verify and use the same bytes
basics
~20 sOnly that the vendor signed some statement. Until the device hashes the bytes it is about to flash and matches that digest against the signed subject, the signature is not bound to the payload at all.
solid answer
~50 sIt has verified a signature over a document, not over the firmware. Signed attestations name their artifact indirectly: the signed payload carries a `subject` entry with a digest, and the signature covers that payload. Verification therefore proves the vendor produced the statement — the binding to the bytes you hold only exists once you hash those bytes and find the result in the subject. A warehouse robot fleet that skips that comparison will happily flash a swapped payload alongside a genuine, unmodified vendor signature, because nothing ever tied the two together. Anyone who can substitute the file — someone on the maintenance network, or holding the device — passes. The fix is mechanical: hash the exact bytes you will use, match them against the signed subject, and flash *those* bytes without re-fetching or re-reading afterwards.
code
json · 11 lines{
"_type": "https://in-toto.io/Statement/v1",
"subject": [
{
"name": "controller-firmware.bin",
"digest": { "sha256": "9f2c...a17b" }
}
],
"predicateType": "https://slsa.dev/provenance/v1",
"predicate": { "...": "..." }
}go deeper
Know that a signature covers a specific set of bytes, and that a verifier has to be told which bytes those are. Be able to say why checking a signature file on its own proves nothing about the file you install.
Explain the indirection: the signature covers a statement whose subject names the artifact by digest, so verification is only complete once you hash the artifact and match it. Name detached signatures as the format where this is easiest to get wrong.
Show you would audit a verifier for this. Walk the path from downloaded bytes to installed bytes, point at every place the artifact is re-fetched or re-read after the check, and explain why TLS does not substitute.
Frame it as an evidence problem: your organisation's claim about what ran is only as good as an unbroken digest chain from signer to runtime. Decide where that chain must be enforced and what you tell an auditor when it is broken.
## Indirection is the whole problem Modern artifact signing is rarely a signature laid directly across a file. It is a signature over a small **statement** that *names* the artifact by digest. An in-toto statement is the common shape: - `_type` — the statement schema; - `subject` — a list of entries, each with a name and a `digest` map such as `{"sha256": "..."}`; - `predicateType` and `predicate` — what is being claimed about that subject. The signature is applied to the envelope carrying this payload, separately from the payload itself. So a successful verification proves one thing: *the signing identity produced this statement*. Which real bytes the statement is about is a question the verifier has to answer for itself, by hashing the artifact in its hands and looking for that digest in `subject`. Miss that step and you have built a control that checks a document and installs a file, with nothing connecting them. ## What the gap buys an attacker A warehouse robot fleet takes firmware over the air. The controller downloads an update bundle, checks that the signature is valid and made by the fleet vendor's identity, and flashes the payload. It never hashes the payload. Now anyone who can substitute the payload between the check and the flash — an operator on the maintenance network, a contractor with physical access to a robot, a compromised staging cache — supplies their own firmware and reuses the vendor's genuine signature file unchanged. Verification is green, the vendor's key is untouched, and a fleet of machines that move at speed around people is running code nobody vouched for. The asset at risk here is not data; it is the safety of a physical process. Detached signatures make this failure natural. Signature and artifact are separate files, so the verifier must be *told* which artifact the check applies to, and it is easy to tell it one thing while the installer uses another. Formats where the signature lives inside the artifact container are less prone to it, because there is only one object to point at — though even then the installer must use the object it verified rather than fetching a fresh copy. ## Time of check, time of use Even a verifier that does the digest comparison correctly can undo it. Hash the file, match the subject, then re-download it, re-read it from a path another process can write, or unpack it and install from a directory that was rewritten in between, and the guarantee is gone: you verified one set of bytes and used another. The rule is that the bytes you hashed are the bytes you use — verify from a buffer or an immutable copy, and do not resolve the artifact a second time. ## Transport is not artifact integrity A frequent wrong answer is that fetching over TLS closes the gap. It does not. Transport security authenticates the server and protects the channel from outsiders; it says nothing about whether the object the server chose to send is the one the signature covers. If the mirror is compromised or misconfigured, the attacker is *inside* the channel and TLS carries their payload faithfully. Artifact integrity has to be established on the artifact, end to end from signer to consumer. ## The same failure as an audit problem The subject question also decides whether a signature can serve as evidence. Suppose a bank's release ledger records "signed by release-engineering" as proof that a specific build of an internal risk library shipped. If the signature covers a release manifest rather than the package bytes, the ledger proves that a manifest was approved — not what ran in production. An auditor asking "what code executed on this date?" can only be answered when there is an unbroken digest chain: the signed subject digest equals the artifact digest recorded at deploy time equals the digest of what the runtime loaded. Wherever that chain has a name in it instead of a digest, the evidence stops. ## The checklist a verifier owes you 1. The envelope's signature verifies against a key or identity you decided to trust. 2. The payload is a statement of the type you expected. 3. **The digest of the exact bytes you are about to use appears in that statement's `subject`.** 4. You then use *those* bytes, with no re-fetch, re-read or re-resolution between check and use. Step three is the one that gets skipped, and skipping it makes the other three decorative.
- A bank's release ledger records 'signed by release-engineering' as proof a given build shipped. What must the signature cover?The package bytes, named by digest. If it covers a release manifest instead, the ledger proves a manifest was approved, not what ran. Audit evidence only holds when there is an unbroken digest chain — signed subject equals the artifact recorded at deploy equals what the runtime loaded. Any point where that chain carries a name or a version string rather than a digest is where the evidence stops.
- The verifier does compare the digest correctly. How can the guarantee still be lost?By verifying one copy and using another. Re-downloading the artifact after the check, reading it from a path another process can write, or unpacking to a directory that gets rewritten in between all reintroduce the gap between time of check and time of use. Verify from an immutable copy or an in-memory buffer, and install exactly the bytes you hashed with no second resolution.
- Does fetching the update over TLS make the digest comparison unnecessary?No. TLS authenticates the server and protects the channel from third parties; it says nothing about whether the object that server chose to send is the one the signature covers. A compromised or misconfigured mirror sits inside the channel and TLS delivers its payload faithfully. Artifact integrity has to be established on the artifact itself, end to end from signer to consumer.
A signed delivery receipt lists a parcel's tracking number. If you never compare that number with the label on the box in your hands, the receipt is genuine and it is for some other parcel.
saying these in an interview costs you the question
- Thinks a valid signature alone proves these bytes are the signed ones
- Never hashes the artifact it is about to install
- Assumes the signing tool binds the subject automatically
- Verifies one file and installs a freshly fetched one
- Treats TLS transport as artifact integrity