Skip to main content

Overview

The Token Privileges check enumerates the privileges assigned to the current process token and identifies dangerous privileges that can be abused for privilege escalation. Even if these privileges are in a “disabled” state, they can often be enabled programmatically and exploited.
Token privileges are powerful Windows security features that allow specific operations. When improperly assigned, they create serious privilege escalation opportunities.

How It Works

SharpUp queries the current process token and checks for these dangerous privileges: Dangerous Privileges:
  • SeSecurityPrivilege - Manage auditing and security log
  • SeTakeOwnershipPrivilege - Take ownership of files/objects
  • SeLoadDriverPrivilege - Load and unload device drivers
  • SeBackupPrivilege - Backup files (bypass ACLs for read)
  • SeRestorePrivilege - Restore files (bypass ACLs for write)
  • SeDebugPrivilege - Debug programs (access any process memory)
  • SeSystemEnvironmentPrivilege - Modify firmware environment values
  • SeImpersonatePrivilege - Impersonate authenticated users
  • SeTcbPrivilege - Act as part of the operating system

Example Output

Interpretation:
  • SeImpersonatePrivilege is currently enabled - can be abused immediately
  • SeDebugPrivilege is enabled and is in the default set
  • SeBackupPrivilege is disabled but can be enabled programmatically

Exploitation

SeImpersonatePrivilege - Potato Exploits

SeDebugPrivilege - Process Injection

SeBackupPrivilege - Copy Protected Files

SeRestorePrivilege - Modify Protected Files

SeLoadDriverPrivilege - Load Malicious Driver

SeTakeOwnershipPrivilege - Take File Ownership

Remediation

1

Review Token Privileges

2

Remove Unnecessary Privileges

Open Local Security Policy or Group Policy:
  1. Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment
  2. Remove users/groups from:
    • Debug programs (SeDebugPrivilege)
    • Impersonate a client after authentication (SeImpersonatePrivilege)
    • Load and unload device drivers (SeLoadDriverPrivilege)
    • Take ownership of files (SeTakeOwnershipPrivilege)
    • Back up files and directories (SeBackupPrivilege)
    • Restore files and directories (SeRestorePrivilege)
3

Use Managed Service Accounts

4

Minimize LocalSystem Services

Detection

Defensive Monitoring

Detection Strategies

  • Monitor Event ID 4672 for privilege assignments
  • Alert on dangerous privileges assigned to non-admin users
  • Track privilege elevation events
  • Detect privilege abuse patterns

Real-World Scenarios

Context: IIS application pool running with default identity (ApplicationPoolIdentity) has SeImpersonatePrivilege.Attack Path:
  1. Compromise web application (SQL injection, file upload, etc.)
  2. Execute code in context of application pool
  3. Use Juicy Potato to escalate to SYSTEM
  4. Complete server compromise
Prevention:
  • Use least privileged application pool identities
  • Implement application whitelisting
  • Network segmentation
  • Monitor for Potato exploits
Context: SQL Server running as domain account with SeImpersonatePrivilege and SeDebugPrivilege.Impact:
  • xp_cmdshell execution leads to privilege escalation
  • Can impersonate any authenticated user
  • Can access any process memory (including LSASS)
  • Domain credential theft possible
Solution:
  • Use gMSA for SQL Server
  • Disable xp_cmdshell
  • Remove unnecessary privileges
  • Implement least privilege
Context: User is member of Backup Operators group, granting SeBackupPrivilege and SeRestorePrivilege.Attack Path:
  1. User with backup privileges logs on
  2. Uses privileges to copy NTDS.dit and SYSTEM hive
  3. Extracts all domain password hashes offline
  4. Complete domain compromise
Fix:
  • Strictly limit Backup Operators membership
  • Monitor file access by backup operators
  • Implement Just-In-Time access
  • Use LAPS for privilege escalation auditing

Prevention Best Practices

Principle of Least Privilege

Only assign necessary privileges. Most accounts don’t need any special privileges.

Use Managed Service Accounts

gMSA and sMSA automatically manage privileges appropriately.

Avoid LocalSystem

Run services with minimal required accounts, not LocalSystem.

Regular Audits

Periodically review which accounts have dangerous privileges.

Common Privilege Abuse Tools

Be aware of these tools commonly used to exploit token privileges:
  • Juicy Potato - SeImpersonatePrivilege exploitation (Windows Server 2016 and earlier)
  • Rogue Potato - SeImpersonatePrivilege exploitation (Windows Server 2019+)
  • PrintSpoofer - SeImpersonatePrivilege exploitation via Print Spooler
  • Mimikatz - Uses SeDebugPrivilege to dump credentials from LSASS
  • Process Hacker - Uses SeDebugPrivilege for process manipulation
  • Capcom.sys - Vulnerable driver loaded via SeLoadDriverPrivilege

Modifiable Services

Services that can be reconfigured

Registry AutoLogons

Plaintext credentials in registry

AlwaysInstallElevated

MSI installation with elevated privileges

Remediation Guide

Comprehensive remediation guidance

References

Microsoft Docs

Windows Privilege Constants

MITRE ATT&CK

T1134 - Access Token Manipulation

Potato Exploits

Windows Privilege Escalation via Potato Exploits