The Windows registry is a database of system and program settings. Defenders review it to harden settings and to spot signs that something unwanted was left behind. This lesson is for inspecting and protecting your own practice VM, from a snapshot.
Registry basics
Open it with regedit. The top-level hives include:
- HKEY_LOCAL_MACHINE (HKLM): settings for the whole computer.
- HKEY_CURRENT_USER (HKCU): settings for the signed-in user.
Settings are keys (folders) containing values with names, types, and data. Editing the wrong value can make Windows unstable, so export a backup first: right-click a key and choose Export, or take a VM snapshot.
Hardening settings stored in the registry
Many Local Security Policy items are really registry values. A few worth knowing:
HKLMSYSTEMCurrentControlSetControlLsawithrestrictanonymousset to 1 limits anonymous enumeration of accounts.HKLMSYSTEMCurrentControlSetControlTerminal ServerwithfDenyTSConnectionsset to 1 turns off Remote Desktop.HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystemholds settings likeEnableLUA(User Account Control). Keep UAC enabled.HKLMSYSTEMCurrentControlSetServicesLanmanServerParameterswithAutoShareWksand related values affects default shares.
Prefer the Local Security Policy or Group Policy tools when they offer a setting, because they are safer and documented. Use the registry when no tool exposes it.
reg query "HKLMSYSTEMCurrentControlSetControlTerminal Server" /v fDenyTSConnections
reg export "HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun" C:run-backup.reg
Persistence locations to review
Unwanted software that wants to survive a reboot often registers itself to run at startup. Defenders check these keys and compare against what should be there:
HKLMSOFTWAREMicrosoftWindowsCurrentVersionRunHKCUSOFTWAREMicrosoftWindowsCurrentVersionRunRunOncekeys in the same locationsHKLMSYSTEMCurrentControlSetServicesfor services that should not exist- Scheduled tasks and the Startup folder, which complement the registry
For each entry ask: do I recognize the program? Is the file path in a normal location (Program Files) or odd one (Temp, Downloads, AppData)? Is the file signed by a known publisher? Unrecognized entries pointing to odd folders deserve investigation.
Handling suspicious findings safely
- Record the key, value name, data, and file path.
- Check the file’s properties and digital signature, and scan it with Microsoft Defender.
- Disable or remove the entry only after confirming it is not needed, keeping your exported backup.
- Check Event Viewer for when it appeared.
Also check permissions on important keys (right-click > Permissions) so ordinary users cannot modify system-wide Run keys. Standard users should not have write access under HKLM.
Check your understanding
1. Which hive holds settings for the whole computer?
- HKCU
- HKLM
- HKCR only
- HKU only
Answer: HKLM. HKCU is per user.
2. What should you do before editing the registry?
- Nothing
- Export a backup or take a snapshot
- Delete the key
- Turn off the firewall
Answer: Export a backup or take a snapshot. This lets you undo a mistake.
3. Which key is a common place to review for programs that start at sign-in?
- CurrentVersionRun
- Fonts
- Desktop wallpaper
- Screen saver colors
Answer: CurrentVersionRun. Programs listed there launch automatically.
4. An unknown Run entry points to a file in a Temp folder. What is a sensible first step?
- Ignore it
- Record it, check the file and signature, then decide
- Give it administrator rights
- Reboot repeatedly
Answer: Record it, check the file and signature, then decide. Investigate before removing.
