LSASS

LSASS Processes

The Local Security Authority Subsystem Service (LSASS) is a critical Windows process that handles authentication and security policies. For penetration testers and security professionals, understanding LSASS and how to interact with it can be invaluable for credential extraction during authorized security assessments.

Understanding LSASS

LSASS (lsass.exe) is responsible for several key security functions:

  • Authenticating users for local and remote logons

  • Enforcing local security policies

  • Generating access tokens

  • Writing to Windows security log

  • Handling password changes

  • Caching credentials for domain authentication when the domain controller is unavailable

Most importantly for security professionals, LSASS caches credentials in memory, making it a high-value target during security assessments.

LSASS Process Information

LSASS runs as a Windows system process with the following characteristics:

  • Process name: lsass.exe

  • Default location: C:\Windows\System32\lsass.exe

  • Runs as NT AUTHORITY\SYSTEM

  • Process is protected by various Windows security features in modern systems

Dumping LSASS Memory

There are several methods to extract credentials from LSASS memory. All of these methods require administrative privileges.

Method 1: Task Manager

The simplest (but most detectable) method uses Windows Task Manager:

  1. Open Task Manager (right-click Taskbar → Task Manager or Ctrl+Shift+Esc)

  2. Navigate to the "Details" tab

  3. Find lsass.exe in the list

  4. Right-click → "Create dump file"

  5. The dump will be saved to %TEMP%\lsass.DMP

Method 2: Process Explorer

Sysinternals Process Explorer provides a similar but more feature-rich option:

  1. Find lsass.exe in the process list

  2. Right-click → "Create Dump" → "Create Full Dump"

Method 3: Using PowerShell

PowerShell can be used to create memory dumps with the Debug-Processarrow-up-right cmdlet:

Where 672 is the process ID of LSASS from the first command. This technique is commonly used because it leverages built-in Windows components.

Method 4: Using Mimikatz

Mimikatzarrow-up-right is a specialized tool for extracting credentials:

Method 5: Procdump from Sysinternals

Microsoft's ProcDumparrow-up-right can create process dumps while avoiding many security detections:

Extracting Credentials from LSASS Dumps

Once you have the memory dump, you need to extract the credentials.

Using Mimikatz

Example output:

Using pypykatz (Linux)

pypykatzarrow-up-right is a Python implementation of Mimikatz that works on Linux systems:

Example output:

Types of Credentials in LSASS

LSASS stores various types of credentials:

  1. NTLM Hashes: The primary format for Windows password storage

  2. Kerberos Tickets: Used for Single Sign-On in domains

  3. Plaintext Passwords: In some configurations, plaintext passwords may be recoverable

  4. Cached Domain Credentials: Stored for offline domain authentication

  5. Service Account Credentials: For background services and scheduled tasks

Defensive Measures Against LSASS Credential Dumping

Windows Built-in Protections

Modern Windows systems include several protections against LSASS credential theft:

  1. LSA Protection (RunAsPPL): Prevents direct memory access to LSASS

  2. Credential Guard: Uses virtualization-based security to isolate secrets

  3. Protected Process Light (PPL): Enhanced process protection

Detection Strategies

Security teams often monitor for these indicators of LSASS dumping:

  1. Process access monitoring for lsass.exe

  2. Creation of dump files

  3. Use of tools like Mimikatz, ProcDump, or Task Manager dump functionality

  4. Unusual handle creation to LSASS

  5. Command-line monitoring for suspicious parameters

Bypassing LSASS Protections

During authorized penetration tests, you might encounter systems with LSASS protections. Here are some bypass techniques (use only with permission):

Bypassing RunAsPPL

Using Direct Physical Memory Access

Remote Access

Attack-Defense Scenario

To illustrate the importance of LSASS protection, consider this example scenario:

  1. Initial Access: Attacker gains administrator access to a workstation

  2. Credential Harvesting: Dumps LSASS memory using rundll32.exe technique

  3. Defensive Monitoring: Security team detects the LSASS memory access

  4. Lateral Movement: Attacker uses harvested domain credentials to move laterally

  5. Defensive Response: Security team isolates affected systems

  6. Remediation: Domain-wide password reset to invalidate stolen credentials

Best Practices for Security Testing

When performing authorized LSASS credential extraction:

  1. Document all activities: Keep detailed records of all credential extraction

  2. Handle with care: Treat extracted credentials as highly sensitive

  3. Clean up: Remove dump files after analysis

  4. Report findings: Document the ability to extract credentials in your report

  5. Recommend mitigations: Suggest appropriate protections like Credential Guard

LSASS Protection Verification

To verify if LSASS protection is enabled on a system:

Conclusion

LSASS credential extraction remains a critical technique in penetration testing and security assessments. Understanding how LSASS stores credentials, the methods to extract them, and the protective measures available helps security professionals evaluate an organization's security posture against credential theft attacks.

Remember that LSASS credential dumping should only be performed with proper authorization during security assessments. Unauthorized extraction of credentials is illegal and unethical.

Last updated