How endpoints and brokers guard their credentials
You are answering a security questionnaire about the endpoint agent and the detonation brokers, or an agent will not start or upgrade, or a broker will not enroll.
UPDATED
Among the credentials an endpoint holds are its agent session token, its winget feed token and, once registered, its device key. A broker holds a client certificate from your broker CA. How they are issued and checked on the wire is on the architecture page. This page is what each side does to keep them, and what you see when a check refuses something. Since 26.11.1300 refused span uploads raise an amber “Span uploads refused since …” warning that stays for 24 hours after the last refusal. The audit trail records agent.spanUploadRefusalStarted and agent.spanUploadRefusalEnded. The end is written only when the endpoint’s next refusal starts a new episode or the endpoint is decommissioned, dated 24 hours after the last refusal or at the decommission, so an episode followed by neither has no end record.
Each endpoint’s winget feed token
Each enrolled endpoint gets its own winget feed token, separate from its agent session token, and your feed checks it on every request.
- Decommissioning revokes it. Since platform 0.235.0, decommissioning an endpoint revokes its feed token with its other credentials. Endpoints decommissioned before 0.235.0 lost their feed access at the first start of 0.236.1.
- Use from a second network is recorded. A feed token used from a second network (another IPv4 /24 or IPv6 /48) within 24 hours writes one
event.v1.identity.feedTokenMultiIpaudit event per token per day. The request is still served and the token stays valid, because winget can reach the feed from changing addresses. The event does not record either address. - Expiry and renewal start off, except on a new Community Edition installation. Since platform 0.236.1 a feed token can expire and be renewed at check-in. Switched on, a token issued to agent 0.236.1 or later expires 90 days after issue, the agent’s check-in replaces it once fewer than 30 days remain, and the replaced token keeps working for 7 more days. Tokens issued before you switch it on, and tokens issued to older agents, never expire, so switching it on never cuts a fenced endpoint off from its only winget source. A Community Edition installation set up on platform 26.11.2500 or later starts with it on; an older one keeps it off. Switch it on only once the fleet runs agent 0.236.1 or later. On Community Edition it is a switch under Settings › Rollout & safety › Agent keys since platform 26.11.2200, read live, and a deployment value of
falsestill holds it off. On a dedicated instance, setWep__Catalog__WingetFeed__Credential__LifetimeEnabled=trueon the platform and restart it.MaxLifetime,RenewWithinandRenewalGrace, in the same section, change the three periods. - Rotating one endpoint’s token. Since platform 26.11.700, Rotate feed token… in the endpoint page’s head asks for a reason and a typed phrase bound to that endpoint. The endpoint receives a new feed address at its next check-in, and the old one keeps working for the renewal grace, 7 days by default, then stops. It needs the same permission as a ring move (
fleet.endpoint.ring-reassign), and is refused for an agent older than 0.236.1, an endpoint whose winget fence last reported failed, and one with a rotation already waiting. The audit trail records the request and the delivery, never the token. - The secret stays out of step text. Since agent 26.11.600 the agent and the shim replace the token’s secret with
<redacted>in a failed step’s saved output and in every audit event the agent records, keeping the token’s id. Since platform 26.11.700 the console also masks it wherever it shows older records’ text; evidence exports carry those records as they were signed.
The shim checks who started it
The shim is the program the agent starts to run each install as SYSTEM: the Apache-2.0 installer shim (source public at launch). Before it runs anything it checks three things, and refuses the run, naming the check, if any fails:
- the process that started it, as Windows recorded it rather than a path the caller supplies, carries an Authenticode signature that verifies and was made with the pinned signing certificate;
- that process runs from the agent’s installed location;
- the agent handed it a one-time secret over its standard input, a new one for every run.
Since agent 26.11.700 the shim checks the caller’s signature on the exact file it verified, held open for the check, and refuses a request whose context, action or scope it does not know before any check runs.
The shim in that release also narrows where a package manager it runs as SYSTEM can load code from:
- PATH. Folders on the machine’s PATH that a standard user owns, can write or could create are left out of the PATH the manager sees, and the shim never finds a program through one.
- Temporary files and the working folder. Chocolatey, Scoop and winget run with their temporary files in
C:\Windows\SystemTemp, and start in System32. - Chocolatey’s own code is read from the folder the shim checked.
- Staged Chocolatey and Scoop installs run only over files, and a stage folder, that only SYSTEM and the Administrators can change.
- An uninstaller the shim runs itself as SYSTEM, as when it removes a copy left in the SYSTEM profile, must be one that only SYSTEM or the Administrators can change. It must be named by a full path unless it is in System32, and sit in a folder where standard users cannot add files, so a DLL planted beside it does not load. Otherwise the step stops and says why.
- Per-user winget and Scoop run in that user’s account, and a path with a junction or link below the user’s profile is refused.
A package that calls a tool by bare name from a folder users can write therefore fails when it runs as SYSTEM.
Signed releases, from agent 0.237.0, ignore the development variables that only unsigned builds honour. In turn, the agent checks the shim’s signature when it starts, and refuses to run a shim that fails. Since agent 26.11.800 a signed agent accepts its shim, its collector and its update MSIs only when Certum Code Signing 2021 CA itself issued our signing certificate. A certificate under the same names from another authority the machine trusts, such as a TLS-inspection root, is refused. The update runner makes the same check before it installs an update.
The agent’s own files
The agent keeps its state in C:\ProgramData\Wep.
- The state database (
agent.state.db) records, among other things, what the agent decided not to install, so a row written by another process could hold installs back. Only SYSTEM can write it; Administrators can read it. The agent applies these permissions again at every start. This stops a casual write by an elevated process. It is not a boundary: an administrator can take ownership of the file and change them. - The session file is SYSTEM-only, and so is the folder unless a broker on the same machine shares it. Since agent 0.236.1, when the agent finds these permissions loosened at its start, it puts them back and records it in the audit trail.
- Owners are checked first. Since agent 26.11.100 the install locks the data folder before it writes anything, and the agent checks the owner of its folder and its files before it reads them. A file owned by anyone other than SYSTEM or Administrators could have been planted by a local user before the install, and these files decide which server this SYSTEM service obeys.
Since agent 26.11.1200 the install refuses a data folder that someone else created while it was running. Since agent 26.11.1400 the agent reads its update and rollout records through one handle, never through a link, and only when SYSTEM or Administrators owns the file. A record over 1 MiB counts as unreadable, and the agent cleans up its temporary files.
When the agent will not start, or an upgrade rolls back
The agent will not start. The service fails, and the reason, starting with WEP-AGENT-DATA-ROOT-REFUSED, is in the Application event log and in agent.startup.error.log in the data folder. It names the file and the command that re-trusts it. In this state the agent does not contact the server, so the console shows the endpoint go quiet rather than a report. If the file is yours, run the command from the message in an elevated prompt (icacls "<path>" /setowner *S-1-5-18) and start the service. If you cannot vouch for the file, uninstall the agent and enroll the device again.
An upgrade rolls back. An upgrade over a file with a foreign owner is refused, and the agent already installed stays as it was. Windows Installer reports error 1603, and the Application log has an error from MsiInstaller that starts Wep.Agent:, names each file with the same command, and says to reinstall and enroll again if you cannot vouch for one. Fix the files, then run the upgrade again.
How a broker enrolls
A broker enrolls once, with a one-time token in the install command the Brokers page generates, and from then on connects with a client certificate from your broker CA (attaching a broker). Since platform 0.242.0, with that release’s broker MSI:
- The enrollment has keys of its own. A separate challenge key signs the enrollment challenge, so the broker CA’s root key signs certificates and nothing else. The broker encrypts its enrollment token to the platform’s token key with RSA-OAEP before it leaves the host. Both use standard algorithms through the .NET stack, and neither is configurable.
- The broker checks what it connects to. It accepts only a platform certificate issued for serving brokers.
- A new broker’s key is created non-exportable. A broker enrolled from 0.242.0 keeps its key in the TPM, or, on a host without a usable TPM, as a non-exportable software key. The broker’s drawer on the Brokers page shows which, under enrollment key: in the TPM, in the software key store, or a DPAPI-wrapped file marked copyable, which an administrator of the broker host could copy to present as the broker from another machine.
- Upgrades keep the key from the 26.11.1800 broker MSI on. Until that MSI, every broker upgrade set a new password on the broker’s service account. Windows treats that as an administrative reset, so a key in the TPM no longer opened and the broker had to be re-enrolled. The move to that MSI resets the password one last time; re-enroll the broker once with Re-enroll in its drawer. Later upgrades keep the service, its account and the key.
- Older brokers keep working. A broker enrolled before 0.242.0 keeps its key, and logs Event 1099 at every start, which is expected. To move its key, install it again from a freshly generated install command:
--re-enrollrefuses a broker installed before 0.242.0 with exit code 7, and changes nothing. Since platform 26.11.501 a broker installed from an MSI older than 0.242.0 cannot enroll at all, because the platform no longer answers the old enrollment protocol; one already enrolled is unaffected. - A key the broker cannot open is Event 1204, for example after the TPM was cleared or the host reimaged. Since the 26.11.1700 broker MSI the broker then stops instead of retrying, and the Brokers page shows it as Re-enrollment needed, with Re-enroll in its drawer. The event says whether
--re-enrollor a fresh install command brings it back.
Since platform 0.241.0 the platform also checks a broker’s inputs before it spends the token. A broker whose clock is more than 24 hours off the platform’s is refused: correct its clock, for example with w32tm /resync, and enroll again with the same token.
Since broker MSI 26.11.1600 a broker with no enrollment identity stays off the catalog and logs Error Event 1274 once.
Since platform 26.11.1700 the Brokers page says when a broker you revoked is started again and tries to connect. Its drawer shows a tried to connect row, with how often since the platform started and when, and the inbox shows one item for it. A revoked broker that wiped its enrollment gives up without presenting any broker certificate. Such connections are counted in one line under the broker network list, which names the last address they came from. Both counts are kept in memory, so they start again at a platform restart.
Since the 26.11.1800 broker MSI the installer registers the event source Wep.Detonation.Broker. The broker’s numbered events, such as 1204 and 1274, then go to the Windows Application log, where Get-WinEvent finds them. On a host installed from an earlier MSI they are in the broker’s own log file, under C:\ProgramData\Wep\Broker\logs. Its ordinary warnings and errors stay in that file, which only SYSTEM, administrators and the broker’s service account can read.
Device certificates and signed agent requests
Since platform 0.249.8 the server has two pieces, and since agent 26.11.1700 the agent uses both.
- Client certificates for enrolled devices. An enrolled agent can ask
POST /api/v1/agents/device/certificatefor a 90-day client-authentication certificate for the device key it registered, after it signs a single-use challenge. A front door that checks client certificates againstdevice-ca.crtcould then admit only enrolled devices. Each certificate issued is recorded in the audit trail before it is returned. - Signed agent requests. The server verifies a request signature made with the device key (RFC 9421, ECDSA P-256, over the method, path, query and a digest of the body). Once a device has sent one verified signature, an unsigned request with its bearer token is refused like a revoked one, so a copied bearer token would be useless without the device key.
The server side and its key are live today: the first start mints device-ca.key, the backup carries it, and a start refuses while it is missing (when a key goes missing). Since agent 26.11.1700 an agent with a registered device key signs every request it sends with its bearer token: check-in, inventory, span uploads, the wake probe, its own update download and device-key rotation. An agent whose device key is a CNG key also asks for a device certificate, keeps it in the machine’s personal certificate store, renews it after 60 of its 90 days, and presents it only when the other end of the TLS connection asks for a client certificate. The platform’s own listeners never ask, so only a front door you set up to request it ever sees it. An agent still on the older key file protected by DPAPI signs its requests and gets no certificate. Each endpoint starts when it moves to agent 26.11.1700.
Where this stops
- Feed tokens do not expire unless expiry is on. It starts on only in a Community Edition installation set up on platform 26.11.2500 or later, and tokens issued before it is switched on never expire.
- A copied feed token is recorded, not refused. Rotating it is a manual action, one endpoint at a time.
- The state database’s permissions are hardening. An administrator can take ownership of the file.
- A refused data folder is quiet in the console. The reason is on the endpoint, in its event log and its startup log.
- Old brokers keep a copyable key. A broker enrolled before platform 0.242.0 keeps it until it is installed again from a fresh command.
- Signed requests and device certificates start with agent 26.11.1700. An endpoint that has never sent a signed request is still served on its bearer token alone. Since platform 26.11.2200, where you have armed a device-certificate CA for automatic approval, the console asks an agent on 26.11.2000 or later to prove it holds its Intune-issued certificate. Otherwise the platform asks no agent for it.