Skip to content

Network Provider DLLs: Password Capture at Logon

How a rogue network provider DLL receives each user's password at logon through mpnotify.exe, how attackers register one, and how to find and remove it.

MITRE ATT&CK
T1556.008
Tactics
Persistence, Credential access, Defense evasion
Runs
At authentication
Set up by
Administrators
Locations
  • HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order
  • HKLM\SYSTEM\CurrentControlSet\Services\*\NetworkProvider
  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
  • C:\Windows\System32

How it works

Windows lets several network providers work side by side through the Multiple Provider Router (MPR, mpr.dll): the SMB client (LanmanWorkstation), WebDAV (webclient), Remote Desktop's drive redirection (RDPNP). Each provider is a DLL that implements the Network Provider API from npapi.h. A provider registered as a credential manager also gets told about logons.

At an interactive logon, Winlogon hands the logon to mpnotify.exe over RPC. mpnotify.exe, running as SYSTEM, loads every provider in the provider order and calls its NPLogonNotify function with the user name, the domain and the password from the logon (MSV1_0_INTERACTIVE_LOGON or KERB_INTERACTIVE_LOGON structures). NPPasswordChangeNotify receives the old and the new password when a user changes it. A provider DLL is therefore persistence (loaded by a SYSTEM process at every logon) and a credential tap at once. Providers are also loaded into processes that use the WNet functions, such as Explorer when it maps a drive.

The public proof of concept is NPPSpy, published by Grzegorz Tworek in 2020; MITRE ATT&CK tracks the technique as T1556.008. Microsoft marks NPLogonNotify as deprecated but it still works.

Windows 11 changed the defaults. Since Windows 11 22H2, the policy "Configure the transmission of the user's password in the content of MPR notifications sent by winlogon" (value EnableMPR under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System) decides whether the password is included. Microsoft documents that from build 25216 onwards, Winlogon sends the notification with an empty password field when the policy is disabled or not configured. On those builds a rogue provider still loads at every logon, but it gets the password only if the policy is enabled, which an attacker with administrator rights can do. Windows 10 sends the password.

Where it lives

LocationWhatStock Windows 10 and 11
HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order, ProviderOrderComma-separated service names, in call orderRDPNP,LanmanWorkstation,webclient, plus P9NP where WSL is installed
HKLM\SYSTEM\CurrentControlSet\Services\<name>\NetworkProviderProviderPath (the DLL), Name (display name), Classdrprov.dll, ntlanman.dll, davclnt.dll in System32
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System, EnableMPRWhether providers receive the password (Windows 11)Not set

Class is a bit mask: 1 for a network provider, 2 for a credential manager. A provider needs the credential manager bit to receive logon notifications. Virtualisation tools, VPN clients and single sign-on products register providers of their own for the same purpose, so a third name is not proof of compromise; an unexplained one is.

Only administrators and SYSTEM can write these keys. There is no per-user or 32-bit variant of the order list. The keys are in the SYSTEM hive (C:\Windows\System32\config\SYSTEM) and the policy value in SOFTWARE.

How attackers use it

The NPPSpy pattern, from an elevated prompt after copying the DLL to System32:

reg add HKLM\SYSTEM\CurrentControlSet\Services\nppspy\NetworkProvider /v Class /t REG_DWORD /d 2 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\nppspy\NetworkProvider /v Name /t REG_SZ /d nppspy /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\nppspy\NetworkProvider /v ProviderPath /t REG_EXPAND_SZ /d C:\Windows\System32\nppspy.dll /f
reg add HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order /v ProviderOrder /t REG_SZ /d "RDPNP,LanmanWorkstation,webclient,nppspy" /f

From the next logon, the DLL receives each user's credentials and writes them to a file or sends them out. No service is created: the Services\nppspy key exists only to hold the NetworkProvider subkey, so service listings show nothing.

MITRE notes that attackers favour machines with many logons, such as servers and domain controllers; terminal servers and jump hosts are obvious targets. Variants that blend in:

  • A name that looks like a stock one (LanmanWorkstation2, RDPNP1) and a DLL named like a Windows file.
  • Changing ProviderPath of an existing provider instead of adding a name, so the order list stays untouched.
  • On recent Windows 11, enabling the MPR password policy as well.

How to check a host

On a live machine:

$order = (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order).ProviderOrder -split ','
foreach ($p in $order) {
  Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\$p\NetworkProvider" |
    Select-Object @{n='Provider';e={$p}}, Name, Class, ProviderPath
}
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableMPR
Get-AuthenticodeSignature C:\Windows\System32\nppspy.dll

Autoruns lists providers on its Network Providers tab. Every provider should map to software you know is installed, with a signed DLL.

Offline, read Select\Current in the SYSTEM hive to find the current control set, then Control\NetworkProvider\Order and each Services\<name>\NetworkProvider. A provider created by an attacker has a NetworkProvider subkey whose last-write time is the installation time; the Order key's time is when the list last changed. Compare both with the DLL's creation time in System32.

Events and telemetry:

  • Sysmon event 13 for a change to ProviderOrder or ProviderPath, event 11 for the DLL written to System32, event 7 for mpnotify.exe loading a DLL not signed by Microsoft.
  • Security log 4657 when auditing is set on these keys.
  • On recent Windows 11, any change to EnableMPR that no administrator made.

Suspicious: a provider no installed product explains, a credential manager class on an unknown name, a DLL without a valid signature, and a recent change to the order list on a server.

What Windows Persistence flags

parseNetworkProviders reads ProviderOrder in the current control set and, for each name, ProviderPath and Name under Services\<name>\NetworkProvider. It lists one entry per provider, as firing at authentication, with the whole order in the details.

RDPNP, LanmanWorkstation, webclient, P9NP, CSC, PRNP and VMware's vmhgfs are treated as Windows defaults when their DLL is in Windows' folders; "Hide Windows entries" hides them unless something else flags them. Any other provider, or a stock name whose DLL lives elsewhere, raises Unknown network provider: medium when the DLL is in Windows' folders, high otherwise, including when ProviderPath is missing.

From the SOFTWARE hive, EnableMPR set to 1 under Microsoft\Windows\CurrentVersion\Policies\System is an entry of its own, EnableMPR policy switched on (medium): on Windows 11 build 25216 and later it is what lets providers receive the password, so it matters most next to an unknown provider.

The path rules run on the 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 (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.

Limits: only names in ProviderOrder are read; MPR ignores the others too. The tool does not read Class, and it does not hash or verify DLLs, so a stock name whose ProviderPath points to another DLL inside System32 passes as a default. Single sign-on products that register providers will be flagged, by design: confirm them against the installed software.

Cleaning up

  1. Preserve: export HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider and the provider's Services\<name> key with reg export, copy the DLL with its timestamps, hash it, and keep any file it wrote credentials to.
  2. Rewrite ProviderOrder without the rogue name, keeping the others in their order. Removing LanmanWorkstation breaks file sharing; removing RDPNP breaks Remote Desktop drive redirection.
  3. Delete Services\<name>\NetworkProvider, and the whole Services\<name> key if it was created only for this. If an existing provider's ProviderPath was changed, restore the original DLL path instead.
  4. Reboot (or at least sign everyone out), then delete the DLL.
  5. Disable the MPR password policy if your organisation did not set it.
  6. Reset the password of every account that signed in interactively, including through Remote Desktop, since the DLL arrived. Start with administrators and service accounts used on that machine.
  7. Look for the rest of the intrusion: registering a provider needed administrator rights.

See also

On Windows Forensics

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