The Big Picture: Two Different Questions

Section 5 asked: "What can the service do?" (its account). This section asks the opposite question: "What can people do to the service?" Who may start it? Who may stop it? Who may change its settings?

Think of the hotel again. The cleaner's key (Section 5) decides which rooms the cleaner can enter. But a separate rule decides who is allowed to tell the cleaner to start or stop work. Only managers should.

     Section 5                          Section 6
  SERVICE  ──acts on──►  system       PEOPLE ──act on──► SERVICE
  (its account)                       (its permissions)

6.1 Who Can Start/Stop/Configure a Service

What it is: Every service is a protected object. Windows attaches to it a security descriptor, a small record that says who may do what. Inside is a list called the DACL (Discretionary Access Control List). Each line in the list is an ACE (Access Control Entry): "this user or group is allowed (or denied) these actions".

The actions (rights) on a service:

RightPlain meaning
Query statusSee whether it is running
Query configurationSee how it is set up
StartStart it
StopStop it
Pause and continuePause or resume it
InterrogateAsk it for its current status
User-defined controlSend special commands the service allows
Change configurationChange startup type, account, path
DeleteRemove it
Read / change permissionsSee or edit this list

Typical defaults for a normal Windows service:

WhoWhat they can do
Everyone / Authenticated UsersLook: query status, query configuration (so any user can see the list)
Interactive users and SystemA little more, such as asking for status and sometimes starting a few
AdministratorsStart, stop, change settings (full control, in most cases)
SYSTEMFull control

This is why a normal user can open services.msc and read it, but gets "Access is denied" (error 5) when trying to stop most services. To change services you open the tool as administrator.

See a service's permissions in a safe way (read-only):

sc sdshow Spooler

You get an odd-looking line called SDDL (Security Descriptor Definition Language), like:

D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)

(Your output may differ a little.) How to read it:

PartMeaning
D:This is the DACL (the permission list)
(A;;rights;;;WHO)An Allow entry: allowed rights for WHO
SYSYSTEM
BABuilt-in Administrators
IUInteractive users (people logged on at the PC)
SUService logon users (accounts used by services)
CC, LC, SW, RP, WP, DT, LO, CR, SD, RC, WD, WOShort codes for individual rights (query config, query status, enumerate dependents, start, stop, pause, interrogate, user-defined control, delete, read control, write DAC, write owner)

You do not have to memorise the codes. The skill to learn: find the WHO letters and see which rights each one has. If BA has long rights and IU has few, only admins can change it.

Warning: sc sdset changes these permissions. A wrong value can lock everyone out of a service, including you. In this course, only read with sdshow.

Why would anyone change them? Sometimes an administrator wants a non-admin helper to restart one particular service (for example, a web server) without giving them full admin rights. They add one ACE for that user with just "start" and "stop".

Who else is checked? The SCM checks permissions on every request (Section 2.3). That includes services.msc, sc, PowerShell and any program using the SCM API.

6.2 Service SIDs

What it is: A SID (Security Identifier) is a unique code that Windows uses to name a user, group or object inside permission lists. A service SID is a SID created for one particular service. It lets you say "give this service only access to this folder".

How it is made. The SID is generated from the service name (a repeatable calculation, so the same name always gives the same SID). It looks like S-1-5-80-... and can also be written as NT SERVICE\<ServiceName>.

Why it is useful:

Problem without service SIDsFix with service SIDs
Two services run as LocalService. A folder given to LocalService is open to bothGive the folder to NT SERVICE\ServiceA only
To limit a service, you need a special user account with a passwordThe service SID needs no password
 Both run as LocalService                With service SIDs
┌──────────┐  ┌──────────┐             ┌──────────┐  ┌──────────┐
│ Service A│  │ Service B│             │ Service A│  │ Service B│
└────┬─────┘  └────┬─────┘             └────┬─────┘  └────┬─────┘
     │ same badge  │                        │ NT SERVICE\A│ NT SERVICE\B
     └──────┬──────┘                        ▼             ▼
            ▼                          Folder A       Folder B
    both can open both folders        each opens only its own

See the SID type of a service (read-only):

sc qsidtype Spooler

The types are:

TypeMeaning
NONENo service SID is added to the service's identity
UNRESTRICTEDThe service SID is added; the service can use it in permissions
RESTRICTEDThe service SID is added and the process is also write-restricted (Section 6.3)

Virtual accounts and service SIDs. A virtual account (Section 5.4, NT SERVICE\<name>) uses the same name as the service SID. They go hand in hand.

Real-world analogy: each worker gets their own coloured wristband in addition to the shared company badge. Doors can be set to open only for one wristband.

6.3 Service Hardening (Windows 10+ Restrictions)

What it is: Hardening means making something harder to attack. Over the years (starting with Windows Vista and strongly in Windows 10 and 11) Microsoft added extra walls around services, so a bug in one service does less damage.

The main hardening steps:

StepWhat it does
Session 0 isolationServices run apart from the user's desktop (Section 1.2)
Least-privilege accountsMost services moved from LocalSystem to LocalService, NetworkService or a virtual account (Section 5)
Required privilegesA service can list the exact privileges it needs, and the SCM removes all others from its process. Check with sc qprivs <name>
Service SIDs and write-restricted tokensA restricted service can only write to places that explicitly allow its service SID (6.2)
Service isolationServices are separated from each other by SIDs and permissions, instead of sharing one badge
Own-process hostingWindows 10 (version 1703 and later) splits many services into their own svchost.exe on PCs with enough memory (about 3.5 GB or more), so one crash does not take down a group (Section 9)
Protected servicesSpecial anti-malware services run as Protected Process Light so even administrators cannot tamper with them easily
Signed code and Memory protectionsNewer Windows adds code-signing checks and exploit protections to service processes

What "privilege" means here. A privilege is a special power such as "load a driver", "debug other programs" or "shut down the system". The more a service has, the more a bug can be abused. Required-privilege lists strip away powers the service never uses.

See required privileges (read-only):

sc qprivs Spooler

You get a list such as SeChangeNotifyPrivilege, SeImpersonatePrivilege, and so on. (Exact lists differ by service.)

What this means for you:

  • A service may be unable to write somewhere even though its account looks powerful. A restricted token is the likely reason.
  • Do not "fix" a failing service by giving its account full control of a folder. Add the service SID with just the rights needed.
  • Services cannot show windows to the logged-in user (Session 0). A service that "needs a screen" should use a separate helper app in the user's session.

Summary

ConceptMeaning
Security descriptor / DACLThe permission list attached to a service
Default rightsEveryone can look; Administrators and SYSTEM can control
sc sdshowRead-only way to see the permission list (SDDL)
Service SIDA per-service identity, written NT SERVICE\<name>, with no password
sc qsidtypeShows NONE, UNRESTRICTED or RESTRICTED
HardeningSession 0, least privilege, required privileges, restricted tokens, own-process hosting, protected services