skip to content

On Windows, how do a per-user autostart, a machine-wide Run key and a service differ in privilege, survival and storage?

level: middleimportance: should knowfreq 38%

answer

  1. rights needed rise with each step
  2. who signs in versus no sign-in
  3. profile versus machine hive versus database
  4. account the service runs as

basics

~20 s

A per-user autostart needs the user's own rights and goes with the profile. A machine-wide Run key needs administrator rights and fires for any user. A service needs administrator rights, starts at boot before sign-in and sits in the service control manager's database.

solid answer

~40 s

The per-user autostart needs only the user's rights, runs at that user's sign-in and goes with the profile. The machine-wide Run key sits in the machine hive and by default takes administrator rights to change; it runs at user sign-ins and does not depend on one profile. A service takes administrator rights to create, because only Administrator-privileged processes can open the service control manager handle that allows it. It starts with the system rather than a sign-in, under a chosen account such as LocalSystem, and the service control manager's database keeps it. None of the three survives a rebuild of the host.

go deeper

for a junior

Say that the per-user autostart is the cheapest and goes with the profile, while services and machine-wide keys need administrator rights.

for a middle

Compare the three by rights, start-up moment and storage, and say why a service starts before sign-in under a chosen account such as LocalSystem.

for a senior

Use the price list to read an incident: a service found means administrator rights were held, and a cheap trigger may sit beside it.

for a principal

Decide which classes the estate can make unavailable by withholding administrator rights, and who may keep the right to create a service.

## Persistence as a priced choice Every start-up trigger trades three things: the **rights** needed to place it, what it **survives** (a sign-out, a reboot, the loss of a profile, a rebuild) and what it **leaves behind to find**. Reading the trade tells a defender what a clean-up must cover and what a rebuild removes. | | Per-user autostart | Machine-wide Run key | Service | |---|---|---|---| | Rights to place it | The user's own | Administrator-level, by default | Administrator privileges to create | | Starts | At that user's sign-in | At a user's sign-in | With the system, or on demand; no sign-in needed | | Runs as | That user | The signed-in user | A chosen account, such as LocalSystem | | Survives a reboot | Yes | Yes | Yes | | Survives profile loss | No | Yes | Yes | | Survives a re-image | No | No | No | | Kept in | The user's hive and Startup folder | The machine hive and all-users Startup folder | The service control manager's database | ## The machine-wide Run key The Run keys can be set for the user or the machine, and the machine-hive key applies across users. The documentation states one administrator note, and it concerns the machine-hive RunOnce key: it executes only when members of the Administrators group log on after the reboot. It does not state the right needed to write a machine-hive value, so "administrator-level by default" is the general expectation rather than a quoted rule. This is one reason a machine-wide entry is worth treating as a sign of a more privileged compromise. ## The service - **Creation is gated.** The service control manager access right to create a service is required for the create call, and only processes with Administrator privileges can open handles to the manager that permit it. The right to change a service's configuration should be granted only to administrators, because it lets the caller change the executable the system runs. - **It starts early.** The manager is started at system boot, maintains the database of installed services and starts services upon system startup or on demand. Nobody has to sign in. - **The account matters.** A service executes in the security context of a user account. LocalSystem has extensive privileges on the local computer and acts as the computer on the network; its token includes the SYSTEM and Administrators identities and it is not associated with any logged-on user. The documentation notes most services do not need such a high level, and names LocalService and NetworkService as lower choices. ## The order in which they start 1. The service control manager starts with the system and launches automatic services; nobody has signed in. 2. A user signs in; their profile loads and the Run keys and Startup folders for that user and for all users are processed. 3. The system may delay those programs to a quieter moment, and does not guarantee how promptly they run. Both Run-key classes are ignored in Safe Mode by default, so a program held only there does not start in that mode. ## Reading the list as a defender 1. **A service running as LocalSystem that nobody installed** means someone held administrator rights, so the incident is wider than one user's session. 2. **A per-user entry alone** is a smaller finding, but a cheap trigger often sits beside a robust one. 3. **Survival ends at the rebuild.** All three live on the host's disks; a re-image removes them and leaves credentials already read and access used elsewhere untouched. ## What the owner can restrict Hold back local administrator rights from everyday accounts, so the machine-wide and service classes are out of reach of a user-level compromise. Treat the right to create or reconfigure a service as an administrators-only privilege and review who holds it. Enumerating these places as evidence, or proving that an entry executed, belongs with the security-operations material.

  • What does finding an unknown service tell you about the account that created it?
    That administrator-level rights were in play. Only processes with Administrator privileges can open the service control manager handle that permits creating a service, so the compromise reaches beyond one user's session, and under the rebuild guidance this is a reason to lean toward rebuilding the host.
  • Why does running as LocalSystem matter more than running as a lower service account?
    LocalSystem has extensive privileges on the local computer and acts as the computer on the network, with SYSTEM and Administrators identities in its token. Code in such a service carries the machine's own authority and credentials to remote servers; LocalService and NetworkService are the documented lower choices.
  • What does a service survive that a per-user autostart does not?
    The loss of any one profile, and the absence of any sign-in. It starts with the system. It does not survive a re-image, because the service control manager's database is part of the host being rebuilt.

Think of three places to keep a spare key to a flat. Under the doormat needs no one's permission but goes when the mat is replaced. A cabinet in the hall needs the caretaker's say-so and serves every resident. A hook in the building office needs the highest authority, opens the door before any resident arrives, and is listed in the office's own register. The more authority it takes to place, the more it survives, and the more official the register that records it.

  • A machine-wide Run key needs no special rights
  • A service only starts after a user signs in
  • All services run as the signed-in user
  • A service survives a full re-image of the host
  • Per-user and machine-wide autostarts are the same thing