Windows Users, UAC & ACLs
Every time a program opens a file, a registry key or another process, Windows decides whether to allow it. The decision is made in the kernel by the Security Reference Monitor, and it always compares two things: who is asking (an access token) and what the object allows (a security descriptor). This lesson walks through both, explains User Account Control and integrity levels, and compares the model with Linux users, groups and capabilities.
Security identifiers (SIDs)
Windows doesn't identify users and groups by name but by a SID, a variable-length ID such as S-1-5-21-3623811015-3361044348-30300820-1001. Renaming an account keeps its SID, so its permissions survive.
S-1-5-21-3623811015-3361044348-30300820-1001
| | | | \_________________________________/ \__/
| | | | machine or domain ID RID (relative ID): 500 = Administrator,
| | | +- 21: "a normal account or group" 501 = Guest, 1000+ = users you create
| | +--- 5: NT Authority
| +----- revision 1
+------- "this is a SID"Some SIDs are well-known and the same on every machine:
| SID | Name |
|---|---|
S-1-1-0 |
Everyone |
S-1-5-18 |
Local System (NT AUTHORITY\SYSTEM) |
S-1-5-19 / S-1-5-20 |
Local Service / Network Service |
S-1-5-32-544 |
Administrators (built-in group) |
S-1-5-32-545 |
Users |
S-1-5-11 |
Authenticated Users |
S-1-16-8192 / S-1-16-12288 |
Medium / High integrity level |
Linux uses plain numbers: a UID for the user and GIDs for groups, with UID 0 being root. Names come from /etc/passwd and /etc/group.
Access tokens
When you sign in, lsass.exe checks your password (or PIN, or Windows Hello) and builds an access token: your user SID, the SIDs of all your groups, your privileges and an integrity level. Every process you start gets a copy. You can see yours with whoami (sample output — yours will differ):
C:\Users\ada>whoami /user /groups /fo list | findstr /c:"SID" /c:"Group Name"
SID: S-1-5-21-3623811015-3361044348-30300820-1001
Group Name: Everyone
Group Name: NT AUTHORITY\Local account and member of Administrators group
Group Name: BUILTIN\Administrators
Group Name: BUILTIN\Users
Group Name: NT AUTHORITY\INTERACTIVE
Group Name: NT AUTHORITY\Authenticated Users
Group Name: Mandatory Label\Medium Mandatory Level
C:\Users\ada>whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ==================================== ========
SeShutdownPrivilege Shut down the system Disabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeUndockPrivilege Remove computer from docking station Disabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
SeTimeZonePrivilege Change the time zone DisabledPrivileges are rights that aren't about one object: SeShutdownPrivilege, SeBackupPrivilege (read any file for backup), SeDebugPrivilege (open any process), SeTakeOwnershipPrivilege. They are the Windows cousin of Linux capabilities (CAP_SYS_BOOT, CAP_DAC_READ_SEARCH, CAP_SYS_PTRACE, CAP_CHOWN), which split root's power into pieces.
Security descriptors and ACLs
Every securable object has a security descriptor holding:
- the owner SID (the owner can always change the permissions),
- the DACL (discretionary access control list): who may do what,
- the SACL (system ACL): what to audit, plus the object's integrity label.
A DACL is an ordered list of ACEs (access control entries). Each ACE says allow or deny, names a SID and carries an access mask of rights (read, write, execute, delete, …). ACEs can be explicit (set on this object) or inherited from the parent folder.
icacls shows and changes file ACLs (sample output — yours will differ):
C:\Users\ada>icacls C:\Projects\report.docx
C:\Projects\report.docx NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)
TAD\ada:(I)(M)
BUILTIN\Users:(I)(RX)
Successfully processed 1 files; Failed processing 0 files
C:\Users\ada>icacls C:\Projects\report.docx /deny TAD\intern:(W)
processed file: C:\Projects\report.docx
Successfully processed 1 files; Failed processing 0 files(I) marks an inherited ACE; F = full, M = modify, RX = read & execute, W = write. In PowerShell, Get-Acl and Set-Acl do the same with objects.
How an access check works
When a thread asks to open an object with a set of rights, the kernel walks the DACL in order:
- No DACL at all (a null DACL) → everything is allowed. An empty DACL → nothing is allowed.
- For each ACE whose SID is in the caller's token: a deny ACE that covers any still-wanted right → access denied, stop. An allow ACE → mark its rights as granted.
- When every wanted right is granted → access allowed, stop.
- End of the list with rights still missing → access denied.
Because the walk stops at the first decision, order matters. Windows tools keep ACLs in canonical order: explicit deny, explicit allow, inherited deny, inherited allow. That's where "deny wins" comes from: deny ACEs come first, so they are seen first.
READ, WRITE, EXECUTE, DELETE = 1, 2, 4, 8
NAMES = {READ: "read", WRITE: "write", EXECUTE: "execute", DELETE: "delete"}
def rights(mask):
return "+".join(n for bit, n in NAMES.items() if mask & bit) or "none"
def canonical(acl):
rank = {(False, "deny"): 0, (False, "allow"): 1, (True, "deny"): 2, (True, "allow"): 3}
return sorted(acl, key=lambda ace: rank[(ace["inherited"], ace["type"])])
def access_check(token, acl, wanted):
if acl is None:
return True, "null DACL: everything allowed"
granted = 0
for ace in acl:
if ace["sid"] not in token:
continue
if ace["type"] == "deny" and ace["mask"] & wanted & ~granted:
return False, f"denied by ACE deny {ace['sid']} {rights(ace['mask'])}"
if ace["type"] == "allow":
granted |= ace["mask"]
if granted & wanted == wanted:
return True, f"granted after allow {ace['sid']}"
return False, f"end of DACL, missing {rights(wanted & ~granted)}"
acl = [
{"type": "allow", "sid": "Users", "mask": READ | EXECUTE, "inherited": True},
{"type": "allow", "sid": "ada", "mask": READ | WRITE | DELETE, "inherited": False},
{"type": "deny", "sid": "intern", "mask": WRITE | DELETE, "inherited": False},
]
acl = canonical(acl)
for ace in acl:
flag = "(I)" if ace["inherited"] else " "
print(f" {ace['type']:<5} {ace['sid']:<7} {rights(ace['mask']):<18} {flag}")
ada = {"ada", "Users", "Everyone"}
intern = {"intern", "Users", "Everyone"}
guest = {"guest", "Everyone"}
for who, token, wanted in [("ada", ada, READ | WRITE), ("intern", intern, READ),
("intern", intern, READ | WRITE), ("guest", guest, READ)]:
ok, why = access_check(token, acl, wanted)
print(f"{who:<6} wants {rights(wanted):<10} -> {'ALLOW' if ok else 'DENY ':<5} {why}")
print(access_check(guest, None, READ))
print(access_check(ada, [], READ)) deny intern write+delete
allow ada read+write+delete
allow Users read+execute (I)
ada wants read+write -> ALLOW granted after allow ada
intern wants read -> ALLOW granted after allow Users
intern wants read+write -> DENY denied by ACE deny intern write+delete
guest wants read -> DENY end of DACL, missing read
(True, 'null DACL: everything allowed')
(False, 'end of DACL, missing read')
The intern is denied write even though Users would allow read, and the guest is denied simply because no ACE matches: there is no "default allow".
UAC and the split token
If an administrator ran every program with full rights, any malicious download would own the machine. User Account Control (UAC) fixes this with a split token: when an admin signs in, lsass.exe creates two tokens:
- a filtered token: the
Administratorsgroup is marked deny-only, most privileges are removed, integrity Medium. Explorer and everything you start normally use this one. - a full token: all groups and privileges, integrity High. It's used only after an elevation prompt ("Do you want to allow this app to make changes to your device?"), which runs on the secure desktop so other programs can't click it.
Standard users get a credential prompt instead and must type an admin's password. sudo on Linux is the same idea; since Windows 11 24H2 there is even a sudo command for Windows that runs one command elevated.
C:\Users\ada>net session
System error 5 has occurred.
Access is denied.The same command in an elevated prompt ("Run as administrator") succeeds; whoami /groups there shows Mandatory Label\High Mandatory Level.
Integrity levels
Mandatory Integrity Control adds a check before the DACL: every process has an integrity level (Low, Medium, High, System) and every object has a label (Medium if not set). The default policy is no write up: a process can't modify an object labelled higher than itself, whatever the DACL says. Browsers run their renderers at Low (or in an AppContainer), so a compromised tab can't write into your Documents folder even though the DACL allows you.
LEVELS = {"Low": 1, "Medium": 2, "High": 3, "System": 4}
def mic_check(process_level, object_level, write):
if write and LEVELS[process_level] < LEVELS[object_level]:
return "DENY (no write up)"
return "continue to DACL check"
for proc, obj in [("Low", "Medium"), ("Medium", "Medium"), ("Medium", "High"), ("High", "Medium")]:
print(f"{proc:>6} process writes {obj:<6} object: {mic_check(proc, obj, write=True)}")
print(f" Low process reads Medium object: {mic_check('Low', 'Medium', write=False)}") Low process writes Medium object: DENY (no write up)
Medium process writes Medium object: continue to DACL check
Medium process writes High object: DENY (no write up)
High process writes Medium object: continue to DACL check
Low process reads Medium object: continue to DACL check
The Linux side
Linux checks permissions with the file's owner UID, group GID and the rwx bits (Linux Users & Permissions), with optional POSIX ACLs (getfacl/setfacl) and capabilities for privileged operations. This runs in the Linux sandbox:
id -un
id -u
printf 'quarterly numbers\n' > report.txt
chmod 640 report.txt
stat -c '%A %U %n' report.txt
grep -E '^Cap(Prm|Eff)' /proc/self/statuslearner
1000
-rw-r----- learner report.txt
CapPrm: 0000000000000000
CapEff: 0000000000000000
The two capability masks are zero: a normal user's process holds none of root's special powers, the same way a filtered UAC token holds almost no privileges.
| Concept | Windows | Linux |
|---|---|---|
| User / group identity | SIDs | UIDs / GIDs |
| Super-user | Administrators group + SYSTEM | root (UID 0) |
| Per-process identity | access token | credentials (uid, euid, groups, capabilities) |
| Fine-grained powers | privileges (SeDebugPrivilege) |
capabilities (CAP_SYS_PTRACE) |
| Object permissions | DACL with allow/deny ACEs and inheritance | rwx mode bits (+ optional POSIX ACLs) |
| Elevation | UAC prompt, sudo (24H2+), Run as administrator |
sudo, su, pkexec |
| Mandatory control | integrity levels, AppContainer | SELinux, AppArmor |
| Account database | SAM hive / Active Directory | /etc/passwd, /etc/shadow, LDAP/SSSD |
Learn more: Linux Users & Permissions · The Windows Registry · User Mode & Kernel Mode
Go further: Security Principals, SIDs, Tokens and Integrity Levels shows how a domain token is built and how UAC works in a domain.
Test yourself
An ACL has deny intern write followed by allow Users read+write. The intern (a member of Users) asks for read+write. What happens?
- Allowed, because Users allows write
- Denied, because the deny ACE is reached first and covers a wanted right
- Allowed for read only
- An error: deny and allow conflict
What does UAC give an administrator at sign-in?
- One token with all privileges
- A filtered Medium-integrity token for normal use and a full High-integrity token used after elevation
- A guest token
- Kernel-mode access
Which Linux feature is closest to Windows privileges such as SeDebugPrivilege?
- umask
- capabilities
- the sticky bit
- /etc/group