Overview
SeDebugPrivilege allows a process to open any other process on the system with PROCESS_ALL_ACCESS, regardless of the security descriptor on that process. This means full read/write/execute access to SYSTEM-level processes like lsass.exe, winlogon.exe, and services.exe.
Who has it by default:
| Account | Has SeDebugPrivilege |
|---|---|
| Administrators | Yes (disabled by default, enabled on elevation) |
| SYSTEM | Yes |
| Standard users | No |
| Service accounts | No (unless explicitly granted) |
Check if Enabled
Even when
whoami /priv shows SeDebugPrivilege as Disabled, any elevated Administrator process can enable it programmatically. Disabled does not mean removed — it means not yet activated in the current token.How It Works Technically
Windows process security is enforced by the kernel through security descriptors on process objects. When a thread callsOpenProcess(), the kernel checks:
- The requested access mask (e.g.,
PROCESS_ALL_ACCESS) - The DACL on the target process
- The caller’s token privileges
- Read memory of any process (
ReadProcessMemory) - Write memory into any process (
WriteProcessMemory) - Create threads in any process (
CreateRemoteThread,NtCreateThreadEx) - Duplicate handles from any process (
DuplicateHandle) - Duplicate tokens from any process (
OpenProcessToken+DuplicateTokenEx) - Terminate any process
SeAccessCheck — when SeDebugPrivilege is present and enabled in the token, the access check against the process DACL is skipped entirely, and PROCESS_ALL_ACCESS is granted.
Dump LSASS — ProcDump
Microsoft-signed Sysinternals tool. Often whitelisted by AV.Modern EDR flags
procdump targeting lsass.exe by name. Use the PID instead, or rename the binary.Dump LSASS — comsvcs.dll (LOLBin)
No tools needed. Uses a built-in Windows DLL.Find LSASS PID
Dump
Evade Command-Line Logging
Copycomsvcs.dll to avoid detection rules matching the original path:
Dump LSASS — EDR Bypass Tools
When LSASS is protected by PPL (Protected Process Light) or when EDR hooksMiniDumpWriteDump, use these.
nanodump
Uses direct syscalls to avoid API hooking. Creates a valid minidump without callingMiniDumpWriteDump.
HandleKatz
Clones an existing handle to LSASS instead of opening a new one. AvoidsOpenProcess detection.
PPLdump
Bypasses Protected Process Light by exploiting a known DLL loading behavior in PPL processes.PPLKiller / PPLFault
Disables PPL protection entirely by exploiting Windows Error Reporting or kernel driver:Dump LSASS — Task Manager (GUI)
If you have RDP or GUI access:- Open Task Manager as Administrator
- Go to the Details tab
- Right-click
lsass.exe→ Create dump file - Dump saved to
C:\Users\%USERNAME%\AppData\Local\Temp\lsass.DMP
Parse Dumps Offline
pypykatz (Linux/macOS/Windows)
Mimikatz (Windows / Offline)
What You Get from LSASS
| Credential Type | When Available |
|---|---|
| NTLM hashes | Always (all logged-in users) |
| Plaintext passwords | WDigest enabled (Win 2012 R2 and older, or if forced on) |
| Kerberos tickets | Active TGT/TGS in memory |
| DPAPI master keys | Per-user encryption keys |
Migrate into SYSTEM Process (Meterpreter)
The fastest path to SYSTEM with SeDebugPrivilege.List SYSTEM Processes
NT AUTHORITY\SYSTEM:
| Process | PID (varies) | Notes |
|---|---|---|
winlogon.exe | — | Stable, always running |
lsass.exe | — | Risky — can crash |
services.exe | — | Stable |
svchost.exe | — | Many instances |
Migrate
Inject Shellcode — CreateRemoteThread
Classic process injection. Open a SYSTEM process, allocate memory, write shellcode, execute via remote thread.PowerShell PoC
Inject Shellcode — NtCreateThreadEx (Stealth)
CreateRemoteThread is heavily monitored by EDR. NtCreateThreadEx is the underlying syscall and bypasses user-mode hooks.
C# Implementation
For maximum stealth, combine
NtCreateThreadEx with direct syscalls (SysWhispers) to avoid ntdll hooking entirely. The above still imports from ntdll.dll which EDR can hook.Process Hollowing into SYSTEM Process
Create a SYSTEM process in a suspended state, hollow out its memory, replace with your payload, and resume.Flow
C# Implementation
Using Donut + Process Hollowing
Generate shellcode from any .NET assembly:Duplicate SYSTEM Token
Instead of injecting into a SYSTEM process, steal its token and impersonate it.PowerShell
Meterpreter — Incognito
Metasploit — steal_token
Parent PID Spoofing
Create a new process whose parent is a SYSTEM process (winlogon.exe, lsass.exe). The child inherits the parent’s token.
PowerShell — psgetsystem
Manual — PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
C# — Full Implementation
| Process | PID Stability | Notes |
|---|---|---|
winlogon.exe | Stable | Best target — always SYSTEM, always running |
lsass.exe | Stable | Works but risky if your process crashes |
services.exe | Stable | Good alternative |
csrss.exe | Stable | Protected on newer Windows |
Read Memory of Any Process
SeDebugPrivilege lets you read the memory of any running process. Useful for extracting credentials from applications that store them in memory.Browser Credentials (Chrome)
Chrome stores decryption keys and cookies in memory:KeePass — CVE-2023-32784
Extract the master password from KeePass process memory:Windows Credential Manager / DPAPI
Dump credential blobs from memory:Quick Reference
| Technique | Tools Needed | Detection Risk | SYSTEM Access |
|---|---|---|---|
| LSASS dump (procdump) | procdump.exe | Medium — signed but flagged by name | No (credential theft) |
| LSASS dump (comsvcs.dll) | None (built-in) | Medium — LOLBin, command-line logged | No (credential theft) |
| LSASS dump (nanodump) | nanodump.exe | Low — direct syscalls | No (credential theft) |
| LSASS dump (HandleKatz) | HandleKatz.exe | Low — handle duplication | No (credential theft) |
| LSASS dump (PPLdump) | PPLdump.exe | Medium — bypasses PPL | No (credential theft) |
| LSASS dump (Task Manager) | None (GUI) | High — very visible | No (credential theft) |
| Meterpreter migrate | Meterpreter | Medium — well-known | Yes |
| CreateRemoteThread injection | Custom code | High — heavily hooked by EDR | Yes |
| NtCreateThreadEx injection | Custom code | Low — bypasses user-mode hooks | Yes |
| Process hollowing | Custom code | Low-Medium — no new threads | Yes |
| Token duplication | Custom code or Incognito | Medium | Yes |
| PPID spoofing | psgetsystem or custom | Low — legitimate API usage | Yes |
| Memory reading (browsers) | Custom code | Low — passive read | No (credential theft) |
| Memory reading (KeePass) | keepass-password-dumper | Low — offline on dump | No (credential theft) |
Detection and Logging
What defenders see when you use SeDebugPrivilege:| Event ID | Log | What It Catches |
|---|---|---|
| 4672 | Security | Special privileges assigned to new logon (SeDebugPrivilege) |
| 4688 | Security | Process creation (shows parent PID, command line) |
| 10 | Sysmon | Process access (TargetImage: lsass.exe, GrantedAccess: 0x1FFFFF) |
| 8 | Sysmon | CreateRemoteThread detected |
| 1 | Sysmon | Process creation with parent PID anomalies |
| 25 | Sysmon | Process tampering (process hollowing) |
Evasion Notes
- Avoid
PROCESS_ALL_ACCESS(0x1FFFFF) — request minimum required access instead PROCESS_VM_READ | PROCESS_QUERY_INFORMATION(0x0410) for memory reading onlyPROCESS_CREATE_THREAD | PROCESS_VM_WRITE | PROCESS_VM_OPERATION(0x002A) for injection- Use direct syscalls (SysWhispers2/3) to bypass ntdll hooks
- Unhook ntdll in your process before calling APIs
- Use
NtCreateThreadExinstead ofCreateRemoteThread - For PPID spoofing, target
svchost.exeinstead ofwinlogon.exe— less anomalous parent-child relationship