15 - Critical Registry Paths
Topics
Introduction to the Windows Shells
Windows Permissions
Reverse Shells in Windows
SeImpersonatePrivilege Exploitation
On Cross Compilation
Windows Services
Weak Service Permissions
Unquoted Service Path
DLL Hijacking
Always Install Elevated
Files with Sensitive Data
Windows Hashes
Stored Credentials and the Windows Vault
Scheduled Task
Critical Registry Paths
Useful Tools
AMSI Bypass
Registry Hives
The Windows registry is a hierarchical database used to store configuration settings and options. It is organized into hives, each containing multiple keys and values. These hives are critical for system operations and can serve as Indicators of Compromise (IOC) for malware analysis.
The main registry hives and their corresponding file locations are:
HKEY_CLASSES_ROOT
HKCR
C:\Windows\System32\Config\Software
HKEY_LOCAL_MACHINE
HKLM
C:\Windows\System32\Config\SYSTEM
HKEY_USERS
HKU
C:\Windows\System32\Config\DEFAULT
HKEY_CURRENT_USER
HKCU
C:\Users\<UserName>\NTUSER.DAT
HKEY_CURRENT_CONFIG
HKCC
C:\Windows\System32\Config\SystemProfile
Critical Registry Paths
Certain registry paths can present security risks if misconfigured. These paths are commonly targeted for privilege escalation or persistence by attackers.
HKLM\SYSTEM\CurrentControlSet\Services
This registry path is used to configure services. By modifying the ImagePath
value, attackers can hijack a service to execute malicious binaries.
Modify Service Binary Path:
Relevant attack techniques include:
Weak Service Permissions
Unquoted Service Paths
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
This key specifies DLLs to be loaded into every user-mode process using the Windows GUI. It has historically been abused for DLL injection by malware.
Modify AppInit_DLLs:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
The Run
key specifies programs to start automatically at login.
HKLM: Affects all users. Requires admin privileges to modify.
HKCU: Affects only the current user. Can be modified without admin privileges.
Modify Startup Applications:
RunOnce Keys: Used for programs that should run only once after the next reboot.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
This key configures logon behavior in Windows.
Common Values:
Shell: Sets the default shell.
Userinit: Specifies the user initialization executable.
Other Resources
Registry Hives Documentation: Microsoft Docs - Registry Hives
The Windows Registry Adventure: Google Project Zero
Mysteries of the Registry: Scorpio Software Blog
Disclaimer
❗ Never use tools and techniques on real IP addresses, hosts or networks without proper authorization!❗
Last updated