11 - Files with Sensitive Data
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
System Logs
PowerShell commands and system logs are valuable for tracking user activity and investigating security incidents. This guide details key concepts such as command history, transcript logs, and sensitive Windows files like the SAM and registry hives.
Command History
PowerShell maintains a history of executed commands, which can be retrieved in the following ways:
Retrieve Commands from Memory:
Retrieve History File Location:
Default History File Paths:
Windows:
Linux:
PowerShell Transcript
A PowerShell transcript records all executed commands and their output to a file. While useful for audits, mishandling transcripts may expose sensitive data.
Start Transcript:
Stop Transcript:
Security Accounts Manager (SAM + SYSTEM)
The Security Accounts Manager (SAM) file stores local user credentials, including usernames, password hashes, and security identifiers (SIDs).
Location:
The SAM file is locked by the operating system, but backup copies may sometimes be accessible.
Dumping SAM with SeBackupPrivilege
SeBackupPrivilege
The SeBackupPrivilege
allows privileged users or processes to bypass file security restrictions and back up system files.
Grant Privilege to a User:
Save SAM and SYSTEM Files:
Using Mimikatz to Dump LSASS
Mimikatz
can extract hashes stored in the Local Security Authority Subsystem Service (LSASS).
Command:
Sample Output:
Registry Hives
The Windows registry stores system and application settings. It is divided into hierarchical registry hives, each with specific roles and locations.
Common Registry Hives:
HKEY_CLASSES_ROOT (HKCR):
HKEY_LOCAL_MACHINE (HKLM):
HKEY_USERS (HKU):
HKEY_CURRENT_USER (HKCU):
HKEY_CURRENT_CONFIG (HKCC):
Registry Analysis with regipy
regipy
Use the regipy
Python package to analyze registry hives:
Example Python script for listing registry keys:
Extra System Files
Configuration Files
Applications often store configuration data in the following locations:
%AppData%
%LocalAppData%
Paging File
The paging file (pagefile.sys
) is used by Windows for virtual memory.
Location:
Hibernation File
When hibernation is enabled, Windows saves the RAM contents to hiberfil.sys
.
Location:
Other Resources
Disclaimer
❗ Never use tools and techniques on real IP addresses, hosts or networks without proper authorization!❗
Last updated