Skip to content

LSA Packages: Windows Persistence Inside LSASS

How attackers load DLLs into lsass.exe with authentication packages, password filters and security support providers, and how to find and remove them.

Tactics
Persistence, Privilege escalation, Credential access
Runs
At boot
Set up by
Administrators
Locations
  • HKLM\SYSTEM\CurrentControlSet\Control\Lsa
  • HKLM\SYSTEM\CurrentControlSet\Control\Lsa\OSConfig
  • HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders
  • HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest
  • C:\Windows\System32

How it works

The Local Security Authority Subsystem Service (lsass.exe) runs as SYSTEM and handles every logon, password change and authentication protocol on the machine. It is built to be extended: at boot it reads lists of DLL names in the SYSTEM hive and loads each DLL into its own process. A DLL on one of those lists runs inside the most sensitive process on Windows, at every boot, and sees credentials as they pass through.

Three lists matter, plus one setting:

ValueWhat LSASS does with itATT&CK
Lsa\Authentication PackagesLoads each package at boot; packages take part in logons (msv1_0 handles NTLM and local accounts)T1547.002
Lsa\Notification PackagesLoads each password filter at boot and calls it with the new password, in clear text, whenever a password is set or changedT1556.002
Lsa\Security Packages, Lsa\OSConfig\Security Packages, SecurityProviders\SecurityProvidersLoads each security support provider (SSP) at boot; SSPs implement Kerberos, NTLM, Schannel or CredSSP and handle credentials during authenticationT1547.005
SecurityProviders\WDigest\UseLogonCredentialWhen 1, the WDigest SSP keeps a reusable clear-text copy of each password in LSASS memory—

Entries are DLL names, normally without the .dll extension (Microsoft's instructions for password filters say so), and the DLL sits in C:\Windows\System32. A change to a list takes effect at the next boot. An SSP can also be loaded into a running LSASS with the AddSecurityPackage API, which avoids the reboot.

WDigest is the exception: since Windows 8.1 and Server 2012 R2 it no longer keeps clear-text passwords unless UseLogonCredential is 1, and that value is absent by default. It is read at logon, so setting it needs no reboot, only a new interactive logon.

LSA protection (Lsa\RunAsPPL, 1 with a UEFI lock, 2 without one on Windows 11 22H2 and later) runs LSASS as a protected process. LSASS then loads only plug-ins signed by Microsoft, which stops most malicious packages. Windows 11 22H2 and later turn it on by default for new installations that are enterprise-joined and capable of HVCI; elsewhere it is off unless configured.

Where it lives

All values are under HKLM\SYSTEM\CurrentControlSet\Control, stored in the SYSTEM hive (C:\Windows\System32\config\SYSTEM) as ControlSet001 or whichever set Select\Current names.

ValueTypeStock Windows 10 and 11
Lsa\Authentication PackagesREG_MULTI_SZmsv1_0
Lsa\Notification PackagesREG_MULTI_SZscecli (some servers also list Microsoft's rassfm)
Lsa\Security PackagesREG_MULTI_SZ"", an empty entry
Lsa\OSConfig\Security PackagesREG_MULTI_SZMicrosoft's packages: kerberos, msv1_0, schannel, wdigest, tspkg, pku2u…
SecurityProviders\SecurityProvidersREG_SZ, comma-separatedcredssp.dll
SecurityProviders\WDigest\UseLogonCredentialREG_DWORDabsent, which means 0

Only administrators and SYSTEM can write these keys, and only administrators can drop a DLL into System32. There is no per-user or 32-bit variant: LSASS is a single 64-bit process on 64-bit Windows.

How attackers use it

A security package that logs passwords. Mimikatz ships mimilib.dll, which works as an SSP. Copied to System32 and added to Security Packages, it writes the credentials of every later logon to C:\Windows\System32\kiwissp.log once LSASS has loaded it. PowerSploit's Install-SSP automates the copy and the registry change. Mimikatz's misc::memssp patches a running LSASS instead: nothing in the registry, gone at the next reboot.

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "Security Packages" /t REG_MULTI_SZ /d "mimilib" /f

A password filter on a domain controller. A filter on a domain controller is told every domain password change in clear text. MITRE ATT&CK lists Strider (ProjectSauron), which registered its persistence module as a password filter on domain controllers, as well as OilRig and MirrorFace. Registration appends a name to the list:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "Notification Packages" /t REG_MULTI_SZ /d "scecli\0pwfilter" /f

An authentication package. Rarer: a DLL that exports the LSA authentication package interface (LsaApInitializePackage) and is appended to Authentication Packages. It runs as SYSTEM from every boot, which is the persistence; access to logons comes with it.

WDigest switched back on. Not code but a setting, common in hands-on intrusions before credential dumping: set UseLogonCredential to 1, wait for a new interactive logon (or lock the workstation so the user types the password again), then dump LSASS memory.

reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /d 1 /f

The DLLs get names that read like Microsoft's (msv1_1, kerberosx, scecli32), sit in System32 next to the real ones, and often carry copied timestamps.

How to check a host

On a live machine, from an elevated prompt:

reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "Authentication Packages"
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "Notification Packages"
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "Security Packages"
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\OSConfig" /v "Security Packages"
reg query "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders"
reg query "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest" /v UseLogonCredential
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL

Autoruns shows the lists on its LSA Providers tab. For each name that is not Microsoft's, check the file: Get-AuthenticodeSignature C:\Windows\System32\pwfilter.dll, its hash, and its creation time.

Offline, read the same values from the SYSTEM hive of the collection. The Lsa key holds other values that Windows writes itself, so its last-write time often shows the last boot rather than the change; the DLL's creation time in System32 is a better date.

Useful events:

  • Security log 4610 (authentication package loaded), 4614 (notification package loaded) and 4622 (security package loaded), written at boot when "Audit Security System Extension" is enabled. Every name in them should be one you expect.
  • Security log 4657 when auditing is set on the Lsa key; Sysmon event 13 for the value change and event 7 for lsass.exe loading a DLL not signed by Microsoft.
  • Code Integrity Operational log 3033 and 3063 when LSA protection refused a plug-in, 3065 and 3066 when audit mode would have.

Suspicious: any name outside the stock lists, a DLL in System32 not signed by Microsoft, a recent creation time, UseLogonCredential set to 1, RunAsPPL at 0 where your baseline turns it on, and files such as kiwissp.log.

What Windows Persistence flags

parseLsa reads the current control set of the SYSTEM hive: Authentication Packages, Notification Packages, both Security Packages values, SecurityProviders and WDigest's UseLogonCredential. It lists one entry per name ("Security package: kerberos"), resolves a bare name to C:\Windows\System32\<name>.dll, and marks password filters as firing at authentication and the other packages at boot.

Names in Windows' stock lists are marked as Windows defaults (the security package list also accepts other Microsoft names such as negoexts and cloudap); "Hide Windows entries" hides them unless something else flags them. Every other name raises:

  • Extra LSA authentication package (high): anything but msv1_0.
  • Extra password filter (high): anything but scecli and rassfm.
  • Extra security support provider (high): a name outside Microsoft's packages in either Security Packages value, or a provider other than credssp.dll and pwdssp.dll in SecurityProviders.
  • WDigest keeps passwords in clear text (high): UseLogonCredential is 1.

The path rules run on the resolved DLL: System-wide autostart from a writable folder, Runs from a temporary or public folder, Windows program name in the wrong place, Name one letter away from a Windows program, Machine-made name and Runs from a network share. Cross-checks add Written date when the key changed in the 7 days before the newest time seen on that host, Inside a Defender exclusion (exclusion), and program also runs from mechanisms for DLLs outside Windows' folders.

Limits: the check is on names, not files. A malicious DLL saved under a stock name, or a Microsoft DLL replaced on disk, passes. The tool does not read RunAsPPL, and it cannot see an SSP loaded only in memory (memssp, AddSecurityPackage). WDigest is flagged only for an explicit 1; on Windows 7 and Server 2008 R2, where a missing value can still mean clear-text caching, nothing is raised.

Cleaning up

  1. Preserve: reg export "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" lsa.reg and the same for SecurityProviders, then copy the DLL with its timestamps, hash it, and keep any log file it wrote.

  2. Remove only the added name and keep Microsoft's entries. Deleting msv1_0, kerberos or scecli breaks logons or password policy. In PowerShell:

    $k = 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa'
    $v = (Get-ItemProperty $k).'Notification Packages' | Where-Object { $_ -ne 'pwfilter' }
    Set-ItemProperty $k -Name 'Notification Packages' -Value $v -Type MultiString
    
  3. Delete UseLogonCredential or set it to 0.

  4. Reboot. The DLL stays loaded in LSASS, and locked on disk, until then; delete it afterwards.

  5. Treat every credential that went through LSASS since the DLL arrived as stolen: reset the passwords of everyone who logged on and of service accounts. On a domain controller with a password filter, that means every domain password changed since, and the krbtgt account twice.

  6. Look for the rest of the intrusion: whoever installed an LSA package had administrator rights. Turning on LSA protection afterwards blocks unsigned packages.

See also

On Windows Forensics

The artifacts behind this technique, in the Windows Forensics reference: