Skip to content

AppInit_DLLs and AppCertDlls: DLL Load Persistence

How AppInit_DLLs and AppCertDlls make Windows load a DLL into nearly every process, what Secure Boot changes, and how to find and remove a planted entry.

Tactics
Persistence, Privilege escalation
Runs
When a program starts
Set up by
Administrators
Locations
  • HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows
  • HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Windows
  • HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls

How it works

Two machine-wide registry lists make Windows load extra DLLs into processes that never asked for them.

AppInit_DLLs. When user32.dll initialises in a process, it reads the Windows key under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion. If LoadAppInit_DLLs is 1, it calls LoadLibrary on each DLL named in AppInit_DLLs. Almost every program with a window loads user32.dll, and so do many console programs and services, so the DLL ends up in most processes of every session, running as each process's own account, SYSTEM included. 32-bit processes on 64-bit Windows read the same values under WOW6432Node.

ValueTypeMeaning
AppInit_DLLsREG_SZDLLs separated by spaces or commas; a path with spaces must use its short (8.3) form
LoadAppInit_DLLsREG_DWORD1 turns the list on; 0, the default, ignores it
RequireSignedAppInit_DLLsREG_DWORD1: only code-signed DLLs are loaded

Microsoft added the signing value in Windows 7. Since Windows 8, Windows ignores AppInit_DLLs when Secure Boot is on. On machines without Secure Boot, which still include many virtual machines, older hardware and servers, the list works as it always has. Microsoft describes the mechanism as legacy and advises software not to use it. The DLL is loaded while the loader lock is held, so a payload's entry point usually just starts a thread and returns.

AppCertDlls. Each value under HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls names a DLL. A process loads these DLLs when it creates another process through CreateProcess, CreateProcessAsUser, CreateProcessWithLogonW, CreateProcessWithTokenW or WinExec. That is fewer processes than AppInit reaches, but the ones that matter: explorer.exe, cmd.exe, PowerShell, service hosts and installers. Microsoft documents the Secure Boot rule for AppInit_DLLs only.

Where it lives

LocationDefault on Windows 10/11Who can write it
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows: AppInit_DLLs, LoadAppInit_DLLs, RequireSignedAppInit_DLLsAppInit_DLLs empty, LoadAppInit_DLLs 0Administrators, SYSTEM
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Windows: the same values, for 32-bit processesAppInit_DLLs empty, LoadAppInit_DLLs 0Administrators, SYSTEM
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls: one value per DLLThe key does not existAdministrators, SYSTEM

Neither list has a per-user variant: writing them needs administrator rights, and the effect covers every user. The DLL itself can sit anywhere the processes can read. Some older security products, input tools and display utilities used AppInit_DLLs; very little current software does. Windows itself sets no value in either list.

How attackers use it

AppInit gives code execution inside nearly every interactive process, which suits keyloggers, browser hooks and credential theft as much as persistence:

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" /v AppInit_DLLs /t REG_SZ /d "C:\Windows\System32\wincsvc32.dll" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" /v LoadAppInit_DLLs /t REG_DWORD /d 1 /f

Attackers also set RequireSignedAppInit_DLLs to 0, write the 32-bit copy so 32-bit browsers and Office load the DLL too, and append their DLL to an existing list so a vendor's DLL keeps loading. A system-looking name in System32 passes a quick look. The T9000 backdoor, described by Palo Alto Networks Unit 42 in 2016, persisted this way.

AppCertDlls needs a single value and works where Secure Boot has disabled AppInit:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls" /v Default /t REG_EXPAND_SZ /d "C:\ProgramData\Intel\igfxcert.dll" /f

The DLL then loads into the next program that starts another one, which on a workstation happens soon after logon. ATT&CK lists the PUNCHBUGGY loader among its users.

How to check a host

On a live machine:

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" /v AppInit_DLLs
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" /v LoadAppInit_DLLs
reg query "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Windows" /v AppInit_DLLs
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls"
autorunsc -accepteula -a d -s -h

Confirm-SecureBootUEFI, run as administrator on a UEFI machine, says whether Secure Boot is on and therefore whether AppInit is active. tasklist /m igfxcert.dll lists the processes that have a given DLL loaded, and Get-AuthenticodeSignature C:\ProgramData\Intel\igfxcert.dll shows its signer.

Offline, read the SOFTWARE hive at Microsoft\Windows NT\CurrentVersion\Windows (and its WOW6432Node twin) and the SYSTEM hive at ControlSet00n\Control\Session Manager\AppCertDlls, where Select\Current names the control set in use. The Windows key holds other values too, so its last-write time says only that something in it changed. The AppCertDlls key is not there on a stock system: its existence and its creation time are the finding. Sysmon 13 records the registry write and the process that made it; Sysmon 7 shows the same unusual DLL loading into many processes at once; event 4657 records the change where registry auditing is set on the key.

Suspicious: any value at all in AppCertDlls; any AppInit DLL with LoadAppInit_DLLs at 1 and no product on the machine that explains it; a DLL that is unsigned, recently created, or outside Program Files and System32; RequireSignedAppInit_DLLs turned to 0.

What Windows Persistence flags

From the SOFTWARE hive, the tool reads AppInit_DLLs in the native and WOW6432Node Windows keys and splits it on spaces and commas, as Windows does. Each DLL becomes an entry that shows LoadAppInit_DLLs and RequireSignedAppInit_DLLs and is marked enabled only when LoadAppInit_DLLs is 1. It raises AppInit DLL: high when the list is switched on, medium when it is only written.

From the SYSTEM hive, in the current control set, every value of AppCertDlls with data becomes an entry with AppCertDlls entry (high).

Both are machine-wide, so the path and command-line rules run in their system-wide form: System-wide autostart from a writable folder for a DLL under ProgramData, Users or Windows\Temp, Runs from a temporary or public folder, Runs from a network share, Windows program name in the wrong place, Name one letter away from a Windows program and Machine-made name. Across mechanisms, Written date marks a key written in the 7 days before the newest time in the collection, Inside a Defender exclusion (path) a DLL Defender does not scan, and program also runs from mechanisms the same file started some other way. Windows sets no value in either list, so every entry is flagged and the "Hide Windows entries" filter never hides one.

Limits: the tool cannot tell whether Secure Boot is on, so an AppInit entry marked enabled may be inert on that machine. It does not read the DLL, its signature or whether it exists. A bare DLL name is treated as a Windows file, though LoadLibrary searches the program's own folder first.

Cleaning up

  1. Preserve: reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" C:\IR\appinit.reg, the WOW6432Node key and reg export "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls" C:\IR\appcert.reg, plus the DLL and its hash.
  2. AppInit: set the values back rather than deleting them: reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" /v AppInit_DLLs /t REG_SZ /d "" /f, then LoadAppInit_DLLs to 0, in both views. If a legitimate product's DLL shares the list, remove only the attacker's name.
  3. AppCertDlls: reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls" /v Default /f, and the key itself when nothing else is in it.
  4. The DLL is loaded in many running processes, so deleting it fails until they exit. Remove the registry entries, restart the machine, then delete the file.

Afterwards, look for the same DLL behind other mechanisms, such as COM hijacking and services. A DLL loaded into every process saw what users typed into browsers and sign-in prompts: rotate the passwords and tokens used on the machine while it was active.

See also

On Windows Forensics

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