SECURITY ENGINEERING · PART 1 · LINUX AND WINDOWS, FROM THE INSIDE · WINDOWS · 17 OF 229

Windows Security: Users, UAC, Registry, Services

The Windows security model an engineer needs, since most company laptops and many servers run it: accounts and SIDs, the SAM and LSASS, access tokens and groups, User Account Control, the registry and its run keys, services and scheduled tasks, Defender and SmartScreen, and the places attackers hide for persistence, each with its defensive setting.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 12

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • SIDs and tokens
  • UAC is not a boundary
  • LSASS holds creds
  • registry, services, tasks
  • Defender, BitLocker, ASR

Notes

Accounts and SIDs

Windows identifies every account by a security identifier, a SID, not by its name, so renaming an account changes nothing underneath. Local accounts are stored in a database called the SAM. Domain accounts live in Active Directory, which the next episode covers. Permissions are granted to SIDs and groups such as Administrators and Users. The two most powerful identities are the built-in Administrator account and SYSTEM, the account the operating system itself runs as.

Identity on Windows
  • every account has a SID, a unique id like S-1-5-21-...
  • local accounts live in the SAM
  • domain accounts live in Active Directory (next episode)
  • groups: Administrators, Users
  • the built-in Administrator and SYSTEM are the powerful ones

Tokens and UAC

When you log in, Windows builds an access token listing your SID, groups and privileges, and every program you run carries a copy. User Account Control means that even an administrator runs with a limited token for normal work, and only switches to the full admin token when something elevates, which is the consent prompt you see. Microsoft is explicit that UAC is a convenience to reduce accidental admin actions, not a hard security boundary, so do not rely on it alone.

Access tokens and UAC
  • a token lists your SID, groups and privileges
  • User Account Control: even an admin runs with a limited token by default
  • elevation (the consent prompt) switches to the full token
  • UAC is a speed bump, not a security boundary, per MS

Where credentials live

This is the most important Windows security fact. The process called LSASS holds logon secrets in memory while you are signed in, including password hashes and Kerberos tickets. An attacker who gains administrator rights can read that memory and steal those credentials, then reuse them on other machines. The offensive tool is famous enough to name, Mimikatz. The defenses are Credential Guard, which isolates those secrets in a protected area, LSASS protection, a good EDR, and above all not handing out local admin.

Credentials in memory
  • LSASS process holds logon secrets while you are signed in attackers with admin dump LSASS to steal password hashes and Kerberos tickets
  • tools: Mimikatz (offense)
  • defense: Credential Guard, LSASS protection, EDR, least admin

The registry

The registry is one large database of settings, split into hives: HKLM for the whole machine, HKCU for the current user. It matters for security because it is where programs arrange to start automatically, in so-called run keys. Attackers add an entry there so their code runs at every login, which is persistence. Defenders monitor the autorun locations with tools like Autoruns and Sysmon, and restrict who can write to the machine-wide keys.

Registry and run keys
  • HKLM: machine-wide settings
  • HKCU: per-user settings
  • persistence lives in run keys: ...\CurrentVersion\Run
  • and in services and tasks
  • defense: monitor autorun locations (Autoruns, Sysmon) and lock down who can write

Services and tasks

Services are background programs, the Windows equivalent of daemons, and many run as SYSTEM, the most powerful account. If a service points at a program an attacker can replace, or has an unquoted path with a writable folder along it, the attacker gets their code run as SYSTEM. Scheduled tasks are Windows cron and are abused the same way. Defenders keep service binaries properly permissioned and signed, fix unquoted paths, and run services with the least privilege they need.

Services and scheduled tasks
  • services run in the background, often as SYSTEM
  • a service with a weak path or weak file permissions can be hijacked to run attacker code as SYSTEM
  • scheduled tasks = cron for Windows, also abused
  • fix: strong perms, signed binaries, least privilege

Built-in protections

Windows ships with strong protections, and the job is to turn the right ones on. Microsoft Defender provides antivirus and, in its paid tier, full EDR. SmartScreen warns on unknown downloads and sites. BitLocker encrypts the whole disk, so a stolen laptop is useless. The firewall is on by default. And attack surface reduction rules, with controlled folder access, block many ransomware and malware techniques outright. Part twelve manages these across a fleet with device management.

Use what Windows gives you
  • Microsoft Defender Antivirus + EDR (Defender for Endpoint)
  • SmartScreen: warns on unknown downloads and sites
  • BitLocker: full-disk encryption
  • Windows Firewall: on by default
  • Controlled Folder Access + ASR rules cut ransomware and common attack techniques

Where attackers hide

Two themes recur in Windows attacks. First, stealing credentials from LSASS and reusing them on other machines, which Part seven covers as pass the hash. Second, persistence: run keys, services, scheduled tasks and WMI subscriptions. Attackers also live off the land, using built-in tools like PowerShell so there is no new file for antivirus to catch. Defenders answer with EDR, detailed PowerShell and process logging through Sysmon, and the single biggest lever, not giving users local admin.

Common Windows attacker moves
  • steal creds from LSASS, reuse them (pass-the-hash, next part)
  • persist via run keys, services, scheduled tasks, WMI
  • living off the land: PowerShell, wmic, built-in tools, so no new file to flag
  • defense: EDR, PowerShell logging, least admin, Sysmon

Hardening a Windows host

A short hardening list removes most of the risk. Take local admin away from everyday users, which alone blocks a huge share of attacks. Turn on Credential Guard and LSASS protection. Enable BitLocker and SmartScreen. Switch on attack surface reduction rules and controlled folder access. Patch promptly through Windows Update. Turn on PowerShell and process logging and ship it to a SIEM. And disable ancient protocols like SMB version one. Part twelve applies all of this at scale.

Harden it
  • no local admin for daily users
  • Credential Guard + LSASS protection on BitLocker on, SmartScreen on ASR rules + controlled folders
  • patch promptly (Windows Update)
  • enable PowerShell + process logging, ship to a SIEM
  • disable SMBv1 and old protocols

Common mistakes

Mistakes. Making everyone a local administrator, which turns one phished user into a credential-theft machine. Treating UAC as a security boundary. Leaving LSASS unprotected so credentials are trivial to dump. No disk encryption, so a lost laptop is a breach. No EDR or PowerShell logging, so living-off-the-land attacks are invisible. Unquoted service paths through writable folders. And leaving old protocols like SMB version one enabled for no reason.

Avoid these
  • everyone a local admin
  • trusting UAC as a boundary
  • LSASS unprotected
  • no disk encryption
  • no EDR or PowerShell logging
  • unquoted service paths
  • old protocols left enabled

Say it like this

In the interview: I secure a Windows endpoint by removing local admin from daily users, turning on Credential Guard and BitLocker, enabling attack surface reduction rules and SmartScreen, deploying EDR, and logging PowerShell and process creation to a SIEM. The two threats I design against are credential theft from LSASS, which I counter with Credential Guard and least admin, and persistence through run keys, services and scheduled tasks, which I monitor for.

In the interview
  • "Remove local admin, turn on Credential Guard and BitLocker, enable ASR rules and SmartScreen, deploy EDR, and log PowerShell
  • and process creation to a SIEM.
  • LSASS credential theft and autorun persistence are the threats I design against."

Interview questions

Q1How does Windows identify accounts and apply permissions?

By a unique security identifier (SID), not the account name. At logon Windows builds an access token listing your SID, group memberships and privileges, and every process you launch carries it; permissions are checked against the token.

Q2Is User Account Control a security boundary?

No. Microsoft states UAC reduces accidental use of administrative rights by running even admins with a limited token until they elevate, but it is not designed to stop a determined attacker, so it should not be relied on as a boundary.

Q3Why is the LSASS process important to attackers?

LSASS holds logon secrets, including password hashes and Kerberos tickets, in memory. An attacker with admin rights can dump it (for example with Mimikatz) to steal credentials and reuse them elsewhere, enabling lateral movement.

Q4How do you protect credentials on Windows?

Enable Credential Guard to isolate secrets in a virtualization-based protected area, turn on LSASS protection, deploy EDR, and most importantly avoid granting local administrator rights so credential dumping is not possible in the first place.

Q5Where does Windows persistence commonly hide?

In registry run keys, Windows services, scheduled tasks and WMI event subscriptions. Monitoring autorun locations with tools like Autoruns and Sysmon, and restricting who can write to them, helps detect and prevent it.

Q6Why are Windows services a privilege-escalation risk?

Many run as SYSTEM. A service pointing at a replaceable binary, with weak file permissions, or an unquoted path through a writable directory can be hijacked so an attacker’s code runs as SYSTEM. Fix permissions, sign binaries and quote paths.

Q7What built-in Windows protections should be enabled?

Microsoft Defender antivirus and EDR, SmartScreen, BitLocker full-disk encryption, the Windows Firewall, and attack surface reduction rules with controlled folder access, plus prompt patching through Windows Update.

Q8What is living off the land on Windows?

Attackers using built-in, trusted tools such as PowerShell, wmic and certutil instead of dropping new malware, so there is no new file for antivirus to flag. Defenders counter it with PowerShell and process logging, EDR and behavioural detection.