Domain 4PrivEsc & Password AttacksCORE

Windows Privilege Levels

Deep dive into Windows privilege hierarchy, integrity levels, UAC token filtering, and how understanding privilege levels enables escalation.

Domain: Domain 4: Privilege Escalation & Password Attacks•Updated: 2026-09-01
#privileges#integrity-levels#uac#tokens#windows-security

Windows Privilege Levels

The Windows Security Model

Before diving into privilege levels, you need to understand the foundation of Windows security. Everything in Windows security revolves around five core concepts:

Objects

An object is anything in Windows that can be protected: files, directories, registry keys, processes, threads, services, mutexes, named pipes, and more. Every object has an Owner and a Discretionary Access Control List (DACL).

Access Tokens

An access token is created when a user logs on. It contains:

  • The user’s SID (identity)
  • All group SIDs the user belongs to
  • All privileges granted to the user
  • The token’s integrity level
  • The token’s authentication ID

Every process runs with exactly one access token. The token determines what the process can and cannot do.

SIDs (Security Identifiers)

A SID is a unique identifier for a security principal. See the User and Group Enumeration topic for deep SID coverage. Key SIDs for privilege levels:

SID Name Privilege Level
S-1-5-18 LOCAL SYSTEM Highest
S-1-5-21-*-500 Built-in Administrator Administrator
S-1-5-32-544 Administrators group Administrator
S-1-5-32-545 Users group Standard User
S-1-5-32-546 Global Users Standard User
S-1-5-32-547 Guests Guest

ACLs and ACEs

  • DACL (Discretionary Access Control List): Attached to every securable object. Contains a list of ACEs.
  • SACL (System Access Control List): Audit settings — what access attempts to log.
  • ACE (Access Control Entry): A single entry in a DACL. Specifies:
    • Who (SID)
    • What (ALLOW or DENY)
    • Which rights (Read, Write, Execute, Full Control, etc.)

Access Check Flow:

graph LR
    A[Process requests access] --> B[OS checks token SIDs]
    B --> C[OS evaluates DACL]
    C --> D{DENY ACE matches?}
    D -->|Yes| E[ACCESS DENIED]
    D -->|No| F{ALLOW ACE matches?}
    F -->|Yes| G{Integrity Level OK?}
    F -->|No| E
    G -->|Yes| H[ACCESS GRANTED]
    G -->|No| E

Privilege Hierarchy

Full Hierarchy (Highest to Lowest)

graph TD
    A["👑 SYSTEM<br/>(S-1-5-18)"] -->|"Above all"| B["🔑 Administrator<br/>(S-1-5-21-*-500)"]
    B -->|"More than"| C["⚡ Power Users<br/>(S-1-5-32-547 on older Windows)"]
    C -->|"More than"| D["👤 Standard User<br/>(S-1-5-32-545)"]
    D -->|"More than"| E["🚪 Guest<br/>(S-1-5-32-546)"]
    
    style A fill:#ff6666,stroke:#cc0000,stroke-width:3px
    style B fill:#ffaa66,stroke:#cc6600,stroke-width:2px
    style C fill:#ffdd66,stroke:#cc9900,stroke-width:2px
    style D fill:#aaffaa,stroke:#009900,stroke-width:2px
    style E fill:#cccccc,stroke:#666666,stroke-width:2px

SYSTEM (NT AUTHORITY\SYSTEM)

  • SID: S-1-5-18
  • Capabilities:
    • Full control over the operating system
    • Can access any object (files, registry, processes) regardless of ACL
    • Can load/unload kernel drivers
    • Can modify any service
    • Can read any process memory (including lsass.exe for credential dumping)
    • No integrity level restrictions
    • Cannot be restricted by DACLs
  • How processes get SYSTEM: Services running as SYSTEM, scheduled tasks configured to run as SYSTEM, exploitation of vulnerabilities
  • Privesc target: This is the ultimate goal of most Windows privilege escalation attacks

Administrator

  • SID: S-1-5-21-*-500 (built-in admin) or any member of S-1-5-32-544 (Administrators group)
  • Capabilities:
    • Full control over most system objects
    • Can install software and drivers
    • Can modify user accounts and groups
    • Can manage services
    • Can access most files and registry keys
    • BUT: On Vista+, subject to UAC filtering by default
  • UAC Impact: By default, admin processes run with a filtered token at High IL, not full SYSTEM-level access
  • Getting from Admin to SYSTEM: psexec -s cmd.exe, service exploitation, scheduled task exploitation

Power Users (Legacy)

  • SID: S-1-5-32-547 (note: this RID was reassigned in modern Windows)
  • Capabilities (Windows XP/2003 era):
    • Install most software
    • Create and manage local users and groups (but not admins)
    • Modify and delete files created by others
    • Create, manage, and delete local printer queues
    • Add, configure, and remove network printers
  • Modern Windows: The Power Users group exists but has very few privileges. Microsoft deprecated this model.
  • Privesc relevance: Rarely seen on modern targets, but worth knowing for legacy systems

Standard User

  • SID: Member of S-1-5-32-545 (Users group)
  • Capabilities:
    • Run installed applications
    • Create and modify own files
    • Change own password
    • Access network resources (if permitted)
    • Cannot: Install system-wide software, modify system files, access other users’ files, modify services
  • Privesc relevance: This is your typical starting point on OSCP Windows boxes. All escalation techniques aim to break out of this level.

Guest

  • SID: S-1-5-21-*-501
  • Capabilities:
    • Very limited — log on locally or via network
    • Cannot change password
    • Cannot install software
    • Restricted file access
  • Privesc relevance: Rarely a target. If you’re Guest, focus on escalating to a standard user first.

User Account Control (UAC) — Deep Dive

What Is UAC?

User Account Control (UAC) was introduced in Windows Vista as a security mechanism to prevent unauthorized changes to the operating system. Its primary purpose is to ensure that even administrators operate with reduced privileges by default.

How UAC Works

When an administrator logs on, Windows creates two tokens:

  1. Filtered Token (Default): Contains only basic user SIDs and privileges. This is the token used for normal operations. Runs at High Integrity Level.
  2. Elevated Token (Hidden): Contains all administrator SIDs and privileges. This token is stored but not used by default.
graph TD
    A[Admin User Logs On] --> B[Windows Creates Two Tokens]
    B --> C["Filtered Token<br/>(High IL, reduced privileges)"]
    B --> D["Elevated Token<br/>(High IL, full admin privileges)"]
    C --> E["Used for all normal processes<br/>Explorer, Browser, etc."]
    D --> F["Hidden — only used when elevation requested"]
    F --> G{Elevation Trigger}
    G -->|Consent Prompt| H["User clicks 'Yes'"]
    G -->|No Interaction Needed| I["Auto-elevation for trusted processes"]
    H --> J[Process runs with Elevated Token]
    I --> J

Admin Approval Mode

When UAC is enabled, administrators operate in Admin Approval Mode:

  • All processes start with the filtered token
  • When a process needs elevation, a consent prompt appears
  • The user clicks “Yes” to approve
  • A new process is launched with the elevated token
  • The original process continues with the filtered token

UAC Levels

Windows supports different UAC levels (configurable via Group Policy):

Level Setting Behavior
Highest Always notify when apps try to make changes Consent prompt on secure desktop, even for Microsoft-signed binaries
High (Default) Notify only when apps try to make changes (do not dim desktop) Consent prompt on secure desktop for unsigned, notification for signed
Medium Notify only when apps try to make changes (dims desktop) Consent prompt on secure desktop
Low Notify only when apps try to make changes (does not dim desktop) Consent prompt on normal desktop
Lowest Never notify UAC effectively disabled — dangerous

Filtered vs. Elevated Tokens — Detailed Comparison

Property Filtered Token Elevated Token
Integrity Level High High
Admin SID Present but restricted Present and active
Privileges Reduced set Full admin privileges
Virtualization Enabled (file/registry) Disabled
Used by default Yes No
Access method Normal process creation Consent prompt, runas, bypass

Token Virtualization

When a filtered token tries to write to a protected location (e.g., C:\Program Files), Windows redirects the write to the user’s virtual store:

  • File Virtualization: C:\Program Files\App\file.dll → C:\Users\USER\AppData\Local\VirtualStore\Program Files\App\file.dll
  • Registry Virtualization: HKLM\SOFTWARE\App → HKCU\SOFTWARE\Classes\VirtualStore\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\App

Exam Tip: Virtualization only works for 32-bit processes on 64-bit Windows and is disabled in Windows 8+/Server 2012+ by default. Don’t rely on it.

Why UAC Matters for Privesc

  1. UAC Bypass is a Separate Attack Vector: Even if you have admin credentials, you may need a UAC bypass to get an elevated shell
  2. Token Manipulation: Understanding filtered vs. elevated tokens is key for token theft attacks
  3. Integrity Level: UAC determines your starting integrity level, which affects what objects you can access

Integrity Levels — Deep Dive

What Are Integrity Levels?

Integrity Levels (IL) are a Windows security feature introduced in Vista that implements Mandatory Integrity Control (MIC). They add a mandatory access control layer on top of the discretionary ACL system.

Key principle: A process at a given integrity level can:

  • Read and write objects at its own level or lower
  • Read objects at a higher level (but NOT write)
  • NOT write objects at a higher level

Integrity Level Values

Level SID Hex Value Decimal Typical Processes
Untrusted S-1-16-0 0x00000000 0 Rarely used, some sandboxed processes
Low S-1-16-4096 0x00001000 4096 IE Protected Mode, Chrome/Edge sandboxed processes, Windows Defender scanner
Medium S-1-16-8192 0x00002000 8192 Standard user processes (Explorer, cmd, PowerShell), most user applications
Medium-Plus S-1-16-8448 0x000020FF 8448 Processes that need slightly elevated access
High S-1-16-12288 0x00003000 12288 Elevated admin processes, services running as admin, RDP sessions
High-Plus S-1-16-12544 0x000030FF 12544 Processes needing slightly above High
System S-1-16-16384 0x00004000 16384 SYSTEM processes, critical services (svchost, lsass, services.exe)
Protected Process S-1-16-20480 0x00005000 20480 Windows Defender, BitLocker, DRM processes
Secure Process S-1-16-28672 0x00007000 28672 Highest level, used by security-critical processes

Integrity Level Access Matrix

graph TD
    U[Untrusted IL] -->|"Can write to"| U
    L[Low IL] -->|"Can write to"| L
    L -->|"Can write to"| U
    M[Medium IL] -->|"Can write to"| M
    M -->|"Can write to"| L
    M -->|"Can write to"| U
    H[High IL] -->|"Can write to"| H
    H -->|"Can write to"| M
    H -->|"Can write to"| L
    H -->|"Can write to"| U
    S[System IL] -->|"Can write to"| S
    S -->|"Can write to"| H
    S -->|"Can write to"| M
    S -->|"Can write to"| L
    S -->|"Can write to"| U
    
    style S fill:#ff6666
    style H fill:#ffaa66
    style M fill:#aaffaa
    style L fill:#cccccc
    style U fill:#eeeeee

How IL Affects Object Access

Every file, registry key, and process has an integrity label. When access is requested:

  1. Write access: The process IL must be >= the object IL
  2. Read access: Generally allowed across levels (with some exceptions)
  3. Process creation: A parent process can only create child processes at its own IL or lower (with exceptions for elevation)

Practical implications:

  • A Medium IL process cannot write to C:\Windows\System32\ (High IL)
  • A Medium IL process cannot modify registry keys at HKLM\SYSTEM (High IL)
  • A Low IL process (like a browser in protected mode) cannot write to the user’s Documents folder (Medium IL)
  • A High IL process can write to almost anything a user owns

How to Check Your Current Integrity Level

# Method 1: whoami /groups
whoami /groups

Look for the Mandatory Label entry:

Mandatory Label\Medium Mandatory Level   Label   S-1-16-8192
Mandatory Label\High Mandatory Level      Label   S-1-16-12288
Mandatory Label\Low Mandatory Level       Label   S-1-16-4096
Mandatory Label\System Mandatory Level    Label   S-1-16-16384
# Method 2: PowerShell
$tokenHandle = [IntPtr]::Zero
$procHandle = (Get-Process -Id $pid).Handle
[System.IntPtr]$size = 0

# Get token information class size
[SysNative]::GetTokenInformation($tokenHandle, 19, [System.IntPtr]::Zero, 0, [System.IntPtr]&size)

# Method 3: Check process token directly
whoami /groups | findstr /i "Mandatory"

Mandatory Integrity Control (MIC)

MIC is the enforcement mechanism for integrity levels. Key behaviors:

  1. Process Creation: A process can only create child processes at its own IL or lower. Exceptions:

    • Processes with SE_CREATE_GLOBAL_NAME privilege
    • Processes that trigger UAC elevation
    • Services (created by the Service Control Manager at appropriate IL)
  2. Object Access: Write access to an object requires the process IL >= object IL

  3. Process Memory: A lower-IL process cannot open a higher-IL process for anything other than identification

  4. Registry: Registry keys created by a process inherit the process’s IL. A Medium IL process creating a key at HKLM will create it at Medium IL, and a High IL process cannot modify it back (interesting edge case)

  5. Named Pipes: A lower-IL process cannot connect to a higher-IL named pipe (with some exceptions)


Token Types and Impersonation Levels

Token Types

Type Description Creation Privesc Relevance
Primary Main token for a process Created at logon Stealing a SYSTEM primary token = SYSTEM access
Impersonation Token for acting on behalf of a client Created when server impersonates client Potato exploits convert these to primary tokens
Linked Token linked to another token Internal Windows mechanism Low privesc relevance
Virtualized Token with virtualization enabled Created for filtered admin tokens Affects file/registry write locations

Impersonation Levels

Level Value Description What You Can Do
Anonymous 0 No identity information Nothing useful
Identification 1 Query identity only Get username/SID, but cannot impersonate
Impersonation 2 Impersonate client locally Key level — Potato exploits work here
Delegation 3 Impersonate client remotely Highest — can impersonate across network

How impersonation levels affect privesc:

  • Anonymous/Identification: Cannot be used for token theft
  • Impersonation: Can duplicate the token and create a primary token (this is what JuicyPotato/RoguePotato exploit)
  • Delegation: Everything Impersonation can do, plus remote impersonation (even more powerful)

Logon Types and Why They Matter

Windows assigns a logon type to every session. This affects what tokens are created and what attacks are possible.

Type Name Description Privesc Impact
2 Interactive User logged on at the console (keyboard/display) Full token, can use GUI-based attacks, UAC prompts work
3 Network User authenticated over the network (SMB, shares) Limited token — no local group SIDs, no privileges. Many privesc techniques won’t work.
4 Batch Scheduled task or batch job Full token, depends on task configuration
5 Service Service logon Full token, depends on service account
7 Unlock User unlocked their workstation Same as interactive
8 NetworkCleartext Network logon with clear-text credentials Same as Network (Type 3) but credentials transmitted in clear
9 NewCredentials Run-as with different credentials (RDP with /admin, runas /netonly) Split token — local identity is yours, network identity is different. Affects credential dumping.
10 RemoteInteractive RDP session Full token, High IL, can use GUI attacks
11 CachedInteractive Interactive logon using cached credentials Same as interactive, but offline authentication

Why Logon Type Matters for Privesc

Type 3 (Network) is the most important to understand:

When you connect via SMB (e.g., using psexec, or accessing a share), you get a Type 3 logon. This creates a limited token:

  • No local group SIDs (you won’t see BUILTIN\Users, etc.)
  • No privileges (SeImpersonatePrivilege won’t appear)
  • Cannot access many local resources
# Check your logon type
whoami /groups | findstr /i "LOGON"

Output examples:

CONSOLE LOGON                              S-1-2-1         (Type 2 - Interactive)
REMOTE LOGON                               S-1-2-4         (Type 10 - RDP)
NETWORK LOGON                              S-1-5-2         (Type 3 - Network)

Exam Tip: If you gained access via SMB/psexec and whoami /priv shows no useful privileges, you likely have a Type 3 logon. Try to get an interactive shell (Type 2 or 10) instead, or use a different attack path.


Practical Examples

Example 1: Identifying Your Privilege Context

# You get a shell on a Windows box. Run:
whoami /all

Analysis of output:

user name: WORKGROUP\student                    ← Standard user, workgroup (not domain)
groups: BUILTIN\Users (S-1-5-32-545)            ← Standard user group
        BUILTIN\Performance Log Users           ← Minor group, limited value
privileges: SeImpersonatePrivilege Enabled      ← ⭐ KEY FINDING — Potato exploit possible!
            SeChangeNotifyPrivilege Enabled     ← Normal, bypass traverse checking
integrity: Medium Mandatory Level (S-1-16-8192) ← Standard user IL
logon: CONSOLE LOGON (S-1-2-1)                  ← Interactive session — full token

Conclusion: Standard user with SeImpersonatePrivilege at Medium IL. Attack path: JuicyPotato/RoguePotato → SYSTEM.

Example 2: Admin with UAC Filtering

user name: WORKGROUP\admin
groups: BUILTIN\Administrators (S-1-5-32-544)   ← Admin group!
privileges: SeDebugPrivilege Enabled            ← Can debug processes
            SeImpersonatePrivilege Enabled      ← Can impersonate
integrity: High Mandatory Level (S-1-16-12288)  ← High IL — elevated

Conclusion: Admin with elevated token. Can use psexec -s cmd.exe to get SYSTEM, or use SeDebugPrivilege for mimikatz.

Example 3: Network Logon Limitations

user name: WORKGROUP\student
groups: (very few groups listed)                ← Limited token
privileges: (minimal or none)                   ← Network logon limitation
logon: NETWORK LOGON (S-1-5-2)                 ← Type 3 — limited

Conclusion: Network logon. Many local privesc techniques won’t work. Need to establish an interactive session first.


Mermaid: Privilege Escalation Pathways

graph TD
    subgraph "Starting Points"
        A["Low Priv User<br/>(Medium IL)"]
        B["Admin User<br/>(High IL, Filtered)"]
        C["Admin User<br/>(High IL, Elevated)"]
    end
    
    subgraph "Attack Vectors"
        D["SeImpersonatePrivilege<br/>→ JuicyPotato/RoguePotato"]
        E["Service Exploitation<br/>→ Insecure Permissions/Unquoted Path"]
        F["UAC Bypass<br/>→ Elevated Token"]
        G["Kernel Exploit<br/>→ SYSTEM"]
        H["Token Theft<br/>→ SYSTEM Primary Token"]
        I["Scheduled Task<br/>→ Writable Binary as SYSTEM"]
    end
    
    subgraph "Goal"
        J["🎯 SYSTEM Access"]
    end
    
    A --> D
    A --> E
    A --> G
    A --> H
    A --> I
    B --> F
    F --> C
    C --> J
    D --> J
    E --> J
    G --> J
    H --> J
    I --> J
    
    style J fill:#99ff99,stroke:#009900,stroke-width:3px
    style D fill:#ffdd99
    style G fill:#ff9999

Common Mistakes

Mistake 1: Confusing Integrity Level with Privilege Level

Integrity Level (Medium, High, System) is NOT the same as privilege level (User, Admin, SYSTEM). A High IL process can still be a standard user. A Medium IL process can have SeImpersonatePrivilege.

Mistake 2: Assuming Admin = SYSTEM

On modern Windows, even administrators run with filtered tokens by default. Being in the Administrators group does NOT automatically give you SYSTEM-level access. You still need to escalate.

Mistake 3: Not Understanding Network Logon Limitations

Type 3 (Network) logons have severely limited tokens. If your enumeration shows few groups and no privileges, check your logon type before spending time on techniques that require a full token.

Mistake 4: Ignoring Integrity Level Restrictions

A Medium IL process cannot write to High IL objects. If a technique requires writing to C:\Windows\System32\, you need at least High IL first.


Quick Reference

# Check everything at once
whoami /all

# Check integrity level specifically
whoami /groups | findstr /i "Mandatory"

# Check logon type
whoami /groups | findstr /i "LOGON"

# Check current user and groups
whoami /groups

# Check privileges
whoami /priv

# PowerShell: Get token info
[System.Security.Principal.WindowsIdentity]::GetCurrent()