Skip to main content

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

If the state shows Disabled, enable it from an elevated context:
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 calls OpenProcess(), the kernel checks:
  1. The requested access mask (e.g., PROCESS_ALL_ACCESS)
  2. The DACL on the target process
  3. The caller’s token privileges
Normally, even Administrators cannot open SYSTEM processes because the DACL denies them. SeDebugPrivilege bypasses step 2 entirely — the kernel skips the DACL check and grants whatever access was requested. This means with SeDebugPrivilege enabled, you can:
  • 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
The kernel enforces this in 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.
By PID:
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

One-liner with PowerShell PID resolution:

Evade Command-Line Logging

Copy comsvcs.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 hooks MiniDumpWriteDump, use these.

nanodump

Uses direct syscalls to avoid API hooking. Creates a valid minidump without calling MiniDumpWriteDump.
Signature-based evasion — write an invalid signature (fix later):
Fix the signature offline:

HandleKatz

Clones an existing handle to LSASS instead of opening a new one. Avoids OpenProcess 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:
  1. Open Task Manager as Administrator
  2. Go to the Details tab
  3. Right-click lsass.exeCreate dump file
  4. Dump saved to C:\Users\%USERNAME%\AppData\Local\Temp\lsass.DMP
Transfer the dump to your attacker machine for offline parsing.

Parse Dumps Offline

pypykatz (Linux/macOS/Windows)

Extract only NTLM hashes:
Parse and grep for hashes:

Mimikatz (Windows / Offline)

Extract specific credential types:

What You Get from LSASS


Migrate into SYSTEM Process (Meterpreter)

The fastest path to SYSTEM with SeDebugPrivilege.

List SYSTEM Processes

Look for processes running as NT AUTHORITY\SYSTEM:

Migrate

After migration:
Never migrate into lsass.exe — if your payload crashes, the entire system goes down. Use winlogon.exe or services.exe instead.

Inject Shellcode — CreateRemoteThread

Classic process injection. Open a SYSTEM process, allocate memory, write shellcode, execute via remote thread.

PowerShell PoC

Generate the shellcode on your attacker machine:

Inject Shellcode — NtCreateThreadEx (Stealth)

CreateRemoteThread is heavily monitored by EDR. NtCreateThreadEx is the underlying syscall and bypasses user-mode hooks.

C# Implementation

Compile on attacker machine:
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:
Then inject the Donut shellcode using CreateRemoteThread or NtCreateThreadEx as shown above.

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

Common SYSTEM parent targets:

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:
Or dump the KeePass process directly:

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 only
  • PROCESS_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 NtCreateThreadEx instead of CreateRemoteThread
  • For PPID spoofing, target svchost.exe instead of winlogon.exe — less anomalous parent-child relationship