Skip to main content

The Mindset

The registry is a hierarchical database storing settings for the OS, applications, users, and hardware. For a pentester it’s valuable for three reasons:
  • Persistence — autostart keys (Run, RunOnce, services) that launch programs at boot or logon
  • Stored credentials — autologon passwords, saved VNC/PuTTY/SNMP secrets, sometimes plaintext
  • Configuration intel — installed software, security settings, what’s enabled and what isn’t

Structure — Hives, Keys, and Values

The registry is organized into hives (top-level roots), which contain keys (like folders), which contain values (the actual data).

The Five Root Hives

HKLM is where most of the pentest-relevant data lives — services, autostart entries, and system security settings. HKCU matters for per-user persistence and stored application secrets.

Value Types

Each value has a data type. The ones you’ll encounter:

Querying the Registry

reg query — From CMD

From PowerShell


Persistence Keys — Where Autostart Lives

These keys launch programs automatically. Attackers plant entries here for persistence; you check them to find both attacker footholds and escalation opportunities (a writable autostart entry that runs as admin).

The Run Keys

If a Run entry points to a program in a path you can write to, you can replace that program with your payload — it’ll execute the next time the relevant user logs on. If that user is an administrator, you’ve escalated. This is the registry version of the writable-script attack.

Other Autostart Locations Worth Checking


Stored Credentials in the Registry

The registry sometimes holds credentials in cleartext or weakly protected — a direct pillaging win.
Autologon (DefaultPassword in the Winlogon key) is the classic registry credential find — when a machine is configured to log in automatically, the password is often stored there in plaintext. Always check it.

The SAM, SYSTEM, and SECURITY Hives

The most sensitive registry hives are stored as files on disk and hold the local password hashes. Reading them is a primary credential-theft technique (requires admin or SeBackupPrivilege).
Then extract the hashes offline with impacket on your Linux box:
This is why SeBackupPrivilege (from the System Enumeration privileges table) is so valuable — it lets you read these hives even without full admin, handing you every local hash on the machine.

Next: Windows Pillaging — automated enumeration, hunting sensitive files, and the data-exfiltration endgame.