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:
In practice, any elevated Administrator shell has this privilege available. It is the single most powerful user-mode privilege on Windows.
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
Migrate into SYSTEM Process (Meterpreter)
The fastest path to SYSTEM with SeDebugPrivilege.List SYSTEM Processes
NT AUTHORITY\SYSTEM:
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
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
Detection and Logging
What defenders see when you use SeDebugPrivilege: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