Endpoint integrity: device keys and installed bytes
You need to know that the machine checking in is the one that enrolled, and that the software on it is still the bytes Attestree verified, and what to do when either is no longer true.
UPDATED
Two questions sit under every report an endpoint sends: is this the machine that enrolled, and is what it runs still what was verified? This page covers both. What each package label on an endpoint means is on where Attestree enforces.
The agent’s keys
Each agent holds two keys of its own, both ECDSA P-256 and both created non-exportable:
- The device key is the endpoint’s identity. The agent signs its check-ins with it, and uses it to get itself a new session token without an operator. Since agent 0.242.2 it is a CNG key, in the TPM where the machine has a usable one (the Microsoft Platform Crypto Provider), otherwise in the Microsoft Software Key Storage Provider. An agent that enrolled earlier, with the older key file protected by DPAPI, moved its key without re-enrolling: the old key signed the move. The move waits until a freshly updated agent is confirmed healthy, because an older agent rolled back over it could not use the new key. A software-keyed agent checks at most once a day whether the TPM has become usable, and moves its key into it the same way.
- The span key signs the agent’s audit events, since agent 0.240.0: in the TPM where it can, else in software, usable only by LocalSystem.
Wep.Agent.exe --span-key-statusprints its state on the endpoint. The endpoint page shows its state and protection, and an admin can mark it compromised from a chosen moment, after which its events are refused at ingest and left out of exports.
Where a key lives is what the agent reports; nothing attests it yet. A key in the TPM cannot leave the machine, but anyone holding LocalSystem on it can use it. A software key can be extracted by a local administrator.
An endpoint enrolled before device keys can still check in unsigned, with its session token alone. The setting that refuses agents without a device key ends that. Since platform 26.11.400 it refuses a check-in from an identity with no active device key, and since 26.11.900 every other agent route too, except registering a key and downloading the agent installer, so an agent that can register a key is not stranded. Since 26.11.1100 such an agent’s first key waits for an admin’s approval in Settings › Rollout & safety › Agent keys, which flags a request from a different network or from more than one key and raises an inbox item for each waiting key. It ships off, except that a Community Edition installation set up on platform 26.11.2500 or later starts with it on. On Community Edition it is a switch in that Agent keys group since platform 26.11.2200, read live: turning it on while some agent has no device key asks for a typed confirmation that lists those agents, and a deployment value of false still holds it off. On a dedicated instance it is the deployment setting Wep:Agents:DeviceIdentity:RefuseUnkeyedCheckins. Turn it on only once the fleet runs agent 26.11.1100 or later: an older agent asks for its first key once, then stays refused, and an approval of its key binds only after that agent is upgraded by hand (MSI, Group Policy or Intune) or enrolled again.
When a key is replaced
A key is normally replaced only with the old key’s signature over the new one, as when a key moves into the TPM. The one exception is a key the agent can no longer use: a cleared TPM, a reset firmware TPM, a removed vTPM. Then the agent reports the key lost and asks to bind a new key that the old one cannot sign. A TPM that is merely not ready after boot gets 10 minutes first. The server accepts such a re-bind only for a CNG key. An older key file protected by DPAPI is never replaced that way: losing one means re-imaging, and the endpoint is enrolled again.
This is also the one path that needs no device key, so someone holding a copy of the endpoint’s session token could use it to bind a key of their own. The real agent’s next check-in then fails against the new key. That is why every such re-bind raises an alert.
Alerts. Since platform 0.242.2 the inbox gets an item when:
- a key was replaced without the old key’s signature. That is expected after a TPM loss. If nothing happened to that endpoint’s TPM, someone holding its session may have bound their own key: decommission the endpoint and enroll it again.
- a key moved out of the TPM, replaced by one the agent reports as not in the TPM. A software key can be copied by a local administrator, so check the endpoint’s TPM if you did not expect it.
- a re-bind is held for your approval, when the hold below is on.
The hold. The tenant setting Wep.Agents.KeyRebindHold.HoldUnverifiedRebinds is off by default, except that a Community Edition installation set up on platform 26.11.2500 or later starts with it on. A change applies from the next re-bind, without a restart. On Community Edition it sits on Settings › Rollout & safety (/community/settings/rollout-safety), under Agent keys, as the switch Hold agent key re-binds the old key did not sign. With it on, a re-bind without the old key’s signature does not bind. It waits under Held re-binds, which shows the endpoint, which key, the new key, its reported protection and when it was asked. An admin then decides:
- Approve only a re-bind you expected; compare the new key with the inbox item. The agent’s next attempt binds that key and retires the old one.
- Reject refuses it. An endpoint that really lost its key then has to be enrolled again.
While a device-key re-bind waits, that endpoint cannot check in; its agent asks again about every 10 minutes. While a span-key re-bind waits, the endpoint’s audit events wait unsealed. If the setting cannot be read, the re-bind is answered “try again later”, never bound. The same decisions are available through the API, at /api/v1/fleet/endpoints/{endpointId}/key-rebind/approve and /reject.
Checking the installed bytes
A verified installer says nothing about what is on the disk a month later, after a vendor’s own updater ran or someone replaced a file. So the agent checks the installed bytes of winget packages against a reference, three ways. At each check-in the server names what the agent should check.
- MSI, since platform 0.239.0 (agent 0.239.0 or later). Windows Installer keeps a copy of every MSI it installed. The agent hashes that copy for each MSI product your catalog holds an attested installer for, and the server compares it with the attested installer, or, for an MSI taken from inside a bundle, with the package Attestree took out of it.
- The main program file, since platform 0.240.0 (agent 0.240.0 or later). For each installed winget version whose detonation identified its main program file, the agent hashes that file. The reference is the hash that endpoints of the same architecture recorded right after Attestree installed that version on them, once at least two agree (by default). Without that agreement, it is the hash this endpoint itself recorded right after Attestree installed the version here.
- MSIX, since platform 0.240.0 (agent 0.240.0 or later). The agent asks Windows, as SYSTEM, to check the package’s files against the package’s signed contents. The server checks that the installed package is one the attested installer declares.
Each package row on the endpoint page then carries one of four readings:
- bytes verified: the bytes match the reference.
- vendor updated in place: the bytes differ, but they carry a valid signature from the same publisher, so the vendor most likely updated them without changing the version. Attestree has not tested these bytes, and the row no longer reads as a match.
- foreign bytes: the bytes differ, and no signature can vouch for the difference, because they are unsigned, their signature does not match their contents or does not chain to a trusted root, another publisher signed them, or the verified file itself was unsigned. Treat that copy as untrusted.
- byte evidence unavailable: no reference yet, an agent too old to report, a file not checked yet, a check too old to rely on, or a read that failed. This is never a finding.
Foreign bytes raise a card on Home naming the package, the version and the endpoints. Re-test asks the endpoint’s agent to hash the file again at its next check-in. It changes nothing on the endpoint, and an unanswered request lapses after 24 hours.
Heal now
Heal now, on the endpoint page, reinstalls the version the endpoint’s ring serves, from its attested installer, over what is there. It is offered on a row that reads foreign bytes, and on an adopted package that reads provenance pending, because Attestree did not install the version it has. Nothing heals by itself: a red reading only offers the button, and the click asks for a second click to confirm. Since 26.11.1300 Heal now also refuses an endpoint that keeps its copy of another installer family, and says why.
- It never goes backwards. It refuses when the ring’s version is older than the one the endpoint reports, and points you to promotion or rollback instead.
- It needs a version the ring serves. It refuses a version that is quarantined, blocked or withheld, and says why.
- It stops during an emergency stop.
- It is rate-limited per operator and per endpoint, recorded in the audit trail, and a second click while one is pending does nothing. Since platform 0.250.1 a Heal now the platform could not act on expires after 14 days.
Admins and catalog authors can use Heal now and Re-test; the roles page has the rest.
Where this stops
- Key protection is reported, not attested. A TPM key cannot be copied, but LocalSystem on the endpoint can use it, and a software key can be copied by a local administrator.
- The hold is off by default, except on a Community Edition installation set up on platform 26.11.2500 or later. Without it, a re-bind after a lost key binds at once and only the inbox says so.
- An agent older than 26.11.1700 signs each check-in’s identifying fields with its device key, not the whole request. From 26.11.1700 the agent signs every request it sends with its session token, over the method, path, query and a digest of the body.
- Byte checks are narrow. Winget packages only; the Windows Installer copy of an MSI, one main program file per version, and MSIX packages. Other files a package installed, such as its libraries and configuration, are not checked.
- A program file needs a reference. Until Attestree installed the version on that endpoint, or enough endpoints agree on its bytes, the reading is “byte evidence unavailable”.
- Heal now is manual. It reinstalls; it does not find out who changed the bytes.