8.5 Windows File System, Share & Registry Permissions

Key Takeaways

  • NTFS security descriptors combine an owner SID, a DACL of allow/deny ACEs and a SACL for auditing; deny ACEs are evaluated before allow ACEs.
  • When a resource is reached over SMB the effective permission is the most restrictive of the share permission and the NTFS permission.
  • A standard user who holds Write or Modify on a service executable, or FullControl on its containing directory, can replace the binary and escalate to SYSTEM.
  • Weak ACLs on the HKLM\SYSTEM\CurrentControlSet\Services keys let a low-privileged user rewrite a service's ImagePath and gain SYSTEM.
  • icacls, accesschk and Get-Acl are the tools that expose these ACLs; effective-access analysis must account for group membership and inheritance.
Last updated: September 2026

8.5 Windows File System, Share & Registry Permissions

Syllabus item B13 pairs Unix and Windows: "File permission attributes within Unix and Windows file systems and their security implications", plus "Analysing registry ACLs." Section 9.1 handled the Unix side; this section is the Windows half. It is also where a great many real privilege-escalation findings live, because Windows permissioning is intricate enough that misconfigurations are common and easy to miss.


1. The NTFS Security Model

Every securable object on NTFS — file, directory, registry key, service, printer — carries a security descriptor containing:

  • an Owner SID (the owner can always change the object's permissions, regardless of the DACL);
  • a DACL (Discretionary Access Control List), an ordered list of ACEs (Access Control Entries) that grant or deny rights to specific security principals (SIDs);
  • a SACL (System Access Control List) that specifies which access attempts are audited;
  • a group SID (largely vestigial, present for POSIX compatibility).

ACE Evaluation Order

This is precise and examinable:

  1. An explicit Deny ACE always wins.
  2. Otherwise the system accumulates matching Allow ACEs until the requested access is fully granted.
  3. Explicit ACEs take precedence over inherited ACEs; within each class, deny precedes allow.
  4. If, after processing the whole DACL, the requested access is not fully granted, access is denied.

A null DACL (no DACL at all) grants everyone full control — very different from an empty DACL (a DACL with zero ACEs), which denies everyone.

Standard and Special Permissions

The friendly permissions in the GUI are masks over 14 special rights:

Standard permissionNotable special rights it includes
ReadReadData, ReadAttributes, ReadEA, ReadPermissions
Read & ExecuteRead + ExecuteFile / Traverse
WriteWriteData, AppendData, WriteAttributes, WriteEA
ModifyRead & Execute + Write + Delete
Full ControlEverything, including WriteDAC (change permissions) and WriteOwner (take ownership)

WriteDAC and WriteOwner are the dangerous ones: a principal holding either can grant itself any other right, so they are effectively equivalent to Full Control from an attacker's point of view.


2. Share Permissions vs NTFS Permissions

When a file is accessed locally, only the NTFS DACL applies. When it is accessed over SMB, two independent checks apply and the more restrictive wins:

   Share permission   NTFS permission     Effective over the network
   ----------------------------------------------------------------
   Everyone: Full      Users: Read         Read   (NTFS is tighter)
   Everyone: Read      Users: Full         Read   (share is tighter)
   Authenticated:Change Users: Modify      Modify/Change

The classic misconfiguration is Share = Everyone: Full Control, left as a default with the reasoning that "NTFS will protect it". That works only until the NTFS side is also loose, and it means the share permission provides no defence in depth. Legacy Everyone: Full Control shares combined with permissive NTFS ACLs are how an unauthenticated or low-privileged user reads payroll data or drops a malicious file into a scripts directory.

Enumerate shares and their permissions with:

Get-SmbShare | Get-SmbShareAccess
net share
# From an attacker host
smbclient -L //10.20.30.52 -N
crackmapexec smb 10.20.30.0/24 -u user -p pass --shares

Writable shares are a first-class finding: they enable malware staging, DLL planting, and tampering with scripts that run with higher privilege.


3. NTFS Permissions as a Privilege-Escalation Vector

Two patterns recur:

Weak permissions on a service executable. If a service runs as LocalSystem but a standard user has Modify or Write on its .exe, the user replaces the binary with a payload and restarts the service (or waits for a reboot) to run code as SYSTEM.

# Find the binary path, then check who can write it
Get-CimInstance Win32_Service | Select Name,PathName,StartName
icacls "C:\Program Files\VulnApp\service.exe"
# BUILTIN\Users:(M)  <-- Modify for all users: escalation
accesschk.exe -quvw "C:\Program Files\VulnApp\service.exe"

Weak permissions on the containing directory. Even if the .exe itself is protected, Write/FullControl on its directory lets an attacker rename the original and drop a replacement, or exploit an unquoted service path (covered in 8.4) by planting C:\Program.exe. WriteDAC anywhere in the chain lets the attacker simply grant themselves the missing rights.

Enumerate the whole class quickly:

accesschk.exe -uwcqv "Authenticated Users" *      # writable services
accesschk.exe -uwdqs Users c:\                     # writable dirs for Users
accesschk.exe -uwdqs "Authenticated Users" c:\

4. Analysing Registry ACLs

The registry is a securable-object tree exactly like the file system, and its keys carry DACLs with the same ACE model. Registry-based escalation is a staple of Windows privilege escalation and is named explicitly in the syllabus.

The Service Keys

Each service is defined under HKLM\SYSTEM\CurrentControlSet\Services\<name>, and its ImagePath value is the command line Windows runs as the service account. If a low-privileged principal can write to a service's key, they can point ImagePath at their own payload:

reg query "HKLM\SYSTEM\CurrentControlSet\Services\VulnSvc"
# check the key ACL
Get-Acl "HKLM:\SYSTEM\CurrentControlSet\Services\VulnSvc" | Format-List
accesschk.exe -kvuqsw hklm\System\CurrentControlSet\Services
# if writable:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\VulnSvc" /v ImagePath /t REG_EXPAND_SZ /d "C:\temp\payload.exe" /f

Autostart and Elevation Keys

  • Run / RunOnce under HKLM\...\CurrentVersion\Run — writable HKLM Run keys give code execution in the context of the next user to log on, including administrators.
  • AlwaysInstallElevated — if both HKLM and HKCU copies of SOFTWARE\Policies\Microsoft\Windows\Installer\AlwaysInstallElevated are 1, any user can install a crafted MSI as SYSTEM (covered in 8.4; the point here is that it is a registry ACL / value finding).
  • HKLM\SAM and HKLM\SECURITY — normally readable only by SYSTEM. If their ACLs are loosened, or the hive files are readable on disk or in a backup, offline credential extraction follows (see 8.3).

Reading and Reasoning About Registry ACLs

# Effective rights on a key, expanded
(Get-Acl "HKLM:\SYSTEM\CurrentControlSet\Services\VulnSvc").Access |
  Format-Table IdentityReference,RegistryRights,AccessControlType,IsInherited

When you read any ACL — file, share or registry — reason about effective access, not just the literal ACEs: expand group memberships (a user in BUILTIN\Users inherits everything granted to Users), account for inheritance from parent keys, and remember that WriteDAC/WriteOwner are silently equivalent to full control. accesschk -uwqs "Users" and PowerShell's Get-Acl are the everyday tools; automated privilege-escalation enumerators (WinPEAS, PowerUp's Invoke-AllChecks) apply exactly these checks at scale.


5. Reporting Permission Findings

A good permission finding names the object, the principal, the excessive right, and the concrete escalation it enables — for example: "BUILTIN\Users holds Modify (M) on C:\\Program Files\\VulnApp\\service.exe, which runs as LocalSystem; any interactive user can replace the binary and obtain SYSTEM at the next service start." The remediation is equally concrete: remove the excessive ACE, apply least privilege (Users should have Read & Execute at most on program directories), enable inheritance from a correctly-permissioned parent, and audit changes to service keys via a SACL. Vague advice to "tighten permissions" is not actionable; the specific ACE and the specific escalation are what let the client fix it.

Test Your Knowledge

A file's NTFS DACL contains an explicit Deny Write ACE for the group 'Contractors' and an explicit Allow Full Control ACE for the group 'Engineering'. A user belongs to both groups and attempts to write to the file. What happens and why?

A
B
C
D
Test Your Knowledge

A share is configured with the share permission 'Everyone: Full Control', while the underlying folder's NTFS permission grants 'Domain Users: Read'. What is the effective permission for a domain user connecting to the folder across the network?

A
B
C
D
Test Your Knowledge

During a Windows host audit, accesschk shows that BUILTIN\Users holds Modify on C:\Program Files\Backup\svc.exe, which the service configuration runs as LocalSystem. Why is this a privilege-escalation finding?

A
B
C
D
Test Your Knowledge

An assessor finds that a low-privileged user can write to HKLM\SYSTEM\CurrentControlSet\Services\VulnSvc. What is the most direct escalation this enables?

A
B
C
D