Summery
The Windows Registry is a hierarchical database that stores configuration settings for Windows, users, applications, drivers, and services.
Think of it as a central configuration database for the operating system.
For example, AlwaysInstallElevated is a registry value that controls whether Windows Installer packages can run with elevated privileges.
Registry structure:
- Keys - like folders.
- Values - named settings stored inside keys.
- Data - the value’s actual content, such as
1(enabled) or0(disabled).
Registry values have a type, which determines how their data is stored and interpreted.
Common registry types: REG_SZ (text), REG_DWORD (32-bit integer), REG_QWORD (64-bit integer), and REG_BINARY (binary data). 0x1 is hexadecimal for decimal 1.
In the Windows Registry, root keys are the main branches containing system and application configuration. Each key can contain subkeys and values.
The default registry root keys are:
HKEY_LOCAL_MACHINE (HKLM) - System-wide settings, services, drivers, installed software
HKEY_CURRENT_USER (HKCU) - Settings for the currently logged-in user
HKEY_USERS (HKU) - Settings for all loaded user profiles
HKEY_CLASSES_ROOT (HKCR) - File associations, COM classes, and object registration
HKEY_CURRENT_CONFIG (HKCC) - Current hardware profile configuration
Commands
Basic commands
You can inspect it using reg query in CMD or regedit in the graphical interface.
reg query - Read keys and values
reg add - Create or modify a key/value
reg delete - Delete a key/value
reg export - Export a key to a .reg file
reg import - Import a .reg file
reg save - Save a registry hive to a file
reg load - Load a hive from a file
Writable registry keys
Writable registry keys are keys your account has permission to modify. In pentesting, weak permissions can enable privilege escalation if a privileged service or program trusts a setting you can change.