Hacktricks-skills windows-forensics
Perform Windows forensic analysis by extracting and analyzing artifacts from Windows systems. Use this skill whenever the user needs to investigate Windows systems, analyze user activity, track file access, examine registry data, parse event logs, or conduct digital forensics on Windows machines. This includes tasks like finding deleted files, tracking USB devices, analyzing email artifacts, examining program execution history, or investigating security events.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/generic-methodologies-and-resources/basic-forensic-methodology/windows-forensics/windows-forensics/SKILL.MDWindows Forensics Analysis
A comprehensive guide for conducting forensic analysis on Windows systems. This skill helps you systematically extract and analyze artifacts to understand user activity, system changes, and potential security incidents.
Quick Reference: Artifact Locations
| Artifact Type | Primary Location | Key Tools |
|---|---|---|
| Notifications | | SQLite tools |
| Timeline | | WxTCmd, TimeLine Explorer |
| Recycle Bin | | Rifiuti |
| Shadow Copies | | ShadowCopyView |
| LNK Files | | LinkParser, LECmd |
| Jumplists | | JumplistExplorer |
| Prefetch | | PECmd |
| Amcache | | AmcacheParser |
| Event Logs | | EvtxECmd, Event Viewer |
| Registry | | Registry Explorer, RegRipper |
Investigation Workflow
1. Initial Assessment
Before diving into artifacts, understand the scope:
- What are you investigating? (data exfiltration, malware, unauthorized access, etc.)
- What time period? (helps prioritize artifacts)
- What users? (focus on specific user profiles)
- What evidence is needed? (timeline, file access, network activity)
2. Artifact Collection Priority
Collect artifacts in this order for most investigations:
- Event Logs - Most volatile, overwritten first
- Prefetch/Amcache - Program execution evidence
- LNK Files/Jumplists - File access history
- Registry - System configuration and user activity
- Email/Communication - User communications
- Browser/Network - Internet activity
- Shadow Copies - File recovery
3. Timeline Analysis
Build a chronological view of events:
- Extract timestamps from multiple artifact sources
- Normalize to UTC for comparison
- Look for gaps or anomalies
- Correlate events across different artifact types
Artifact Analysis Guide
Windows Notifications
Location:
\Users\<username>\AppData\Local\Microsoft\Windows\Notifications\
Files:
(pre-Windows Anniversary)appdb.dat
(post-Windows Anniversary)wpndatabase.db
What to look for:
- Notification table contains XML-formatted notifications
- May contain sensitive data, URLs, or application activity
- Timestamps of when notifications were received
Analysis:
# Open with SQLite sqlite3 wpndatabase.db "SELECT * FROM Notification;"
Timeline (ActivitiesCache.db)
Location:
\Users\<username>\AppData\Local\ConnectedDevicesPlatform\<id>\ActivitiesCache.db
What it contains:
- Chronological history of web pages visited
- Edited documents
- Executed applications
Tools:
- WxTCmd - Generates files for TimeLine Explorer
- TimeLine Explorer - Visual timeline analysis
Analysis:
# Use WxTCmd to extract timeline data WxTCmd.exe -i ActivitiesCache.db -o timeline_output/
Alternate Data Streams (ADS)
What to look for:
stream indicates download source (intranet, internet, etc.)Zone.Identifier- Browsers may store download URLs in ADS
Analysis:
# Check for ADS on a file streams -s filename.exe # View ADS content more < filename.exe:Zone.Identifier
Recycle Bin
Location:
C:\$Recycle.bin\
Structure:
- File information (deletion date)$I{id}
- File content$R{id}
Tools:
- Rifiuti - Extracts original path and deletion date
Analysis:
# Use Rifiuti for Vista-Win10 rifiuti-vista.exe C:\$Recycle.bin\
Volume Shadow Copies
Location:
\System Volume Information\
What it contains:
- Backup copies/snapshots of files and volumes
- Can include files that were later deleted
Tools:
- ShadowCopyView - Inspect and extract from shadow copies
- ArsenalImageMounter - Mount forensic images
Registry:
- Files excluded from backupHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore
- Shadow copy configurationHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VSS
LNK Files (Recent Documents)
Locations:
- Win7-Win10:
C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Recent\ - Office:
C:\Users\<user>\AppData\Roaming\Microsoft\Office\Recent\
What they contain:
- File or folder type
- MAC times (Modified, Accessed, Created)
- Volume information
- Target folder path
- Link Created = First time original file was used
- Link Modified = Last time original file was used
Tools:
- LinkParser - GUI analysis
- LECmd - Command-line parsing
Analysis:
# Parse LNK files to CSV LECmd.exe -d C:\Path\To\LNKs --csv C:\Path\To\Output\
Timestamps:
- File timestamps: Modified, Accessed, Creation (of the target file)
- Link timestamps: Modified, Accessed, Creation (of the LNK file itself)
Jumplists
Locations:
- Automatic:
C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations\ - Custom:
C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Recent\CustomDestinations\
Format:
{id}.automaticDestinations-ms (ID = application ID)
What they contain:
- Recent files per application
- Created time = First access
- Modified time = Last access
- Custom jumplists indicate important/favorited files
Tools:
- JumplistExplorer - Parse and analyze jumplists
USB Device Tracking
Artifacts to check:
- Windows Recent Folder
- Microsoft Office Recent Folder
- Jumplists
- Registry keys (see Registry section)
- Search for "Section start"C:\Windows\inf\setupapi.dev.log- WPDNSE folder (temporary USB file copies)
Tools:
- USBDetective - Comprehensive USB device analysis
Plug and Play Cleanup:
- Location:
C:\Windows\System32\Tasks\Microsoft\Windows\Plug and Play\Plug and Play Cleanup - Removes drivers inactive for 30 days
- May delete USB device driver evidence
Email Artifacts
Windows Mail App
Locations:
- Emails:
(.dat files)\Users\<user>\AppData\Local\Comms\Unistore\data\3\ - Metadata/Contacts:
\Users\<user>\AppData\Local\Comms\UnistoreDB\store.vol
Analysis:
- Rename
to.vol.edb - Use ESEDatabaseView to open
- Check
table for emailsMessage
Microsoft Outlook
Locations:
- PST files:
%USERPROFILE%\AppData\Local\Microsoft\Outlook\ - Registry:
HKEY_CURRENT_USER\Software\Microsoft\WindowsNT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook
MAPI Headers:
- Send timeMapi-Client-Submit-Time
- Thread informationMapi-Conversation-Index
- Message identifierMapi-Entry-ID
- Read/unread, responded, etc.Mappi-Message-Flags
Tools:
- Kernel PST Viewer - Open PST files
- Kernel OST Viewer - Open OST files (IMAP/Exchange)
Thunderbird
Location:
\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles\
Format: MBOX files
Email Attachments
Recovery locations:
- IE10:
%APPDATA%\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook - IE11+:
%APPDATA%\Local\Microsoft\InetCache\Content.Outlook
Thumbnail Cache
Locations by OS:
- XP/8-8.1:
in foldersthumbs.db - 7/10 (network):
via UNC pathsthumbs.db - Vista+:
%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_xxx.db
Tools:
- Thumbsviewer - View thumbnail cache
- ThumbCache Viewer - Extract thumbnails
Registry Analysis
Hive Locations:
:HKEY_LOCAL_MACHINE%windir%\System32\Config\
:HKEY_CURRENT_USER%UserProfile%\NTUSER.DAT- Backups:
(Vista+)%Windir%\System32\Config\RegBack\ - User Class:
%UserProfile%\AppData\Local\Microsoft\Windows\USERCLASS.DAT
Tools:
- Registry Editor - Built-in GUI
- Registry Explorer - Load hives, bookmarks for interesting keys
- RegRipper - Plugins for automated analysis
- Windows Registry Recovery - Extract deleted keys
Key Artifacts:
- SAM - User accounts, password hashes (requires SYSTEM hive)
- Last Write Time - When each key-value was modified
- Deleted Keys - Can be recovered until space is reused
Program Execution Artifacts
Prefetch
Location:
C:\Windows\Prefetch\
Format:
{program_name}-{hash}.pf
What it contains:
- Program execution evidence (file presence = execution)
- Execution count
- Execution dates
- Files opened by program
- Layout.ini - Index of all prefetch files
Limits:
- XP/Vista/Win7: 128 files
- Win8/Win10: 1024 files
Tools:
- PECmd - Parse prefetch files
Analysis:
PECmd.exe -d C:\Path\To\Prefetch --html "C:\Path\To\Output"
Superprefetch
Location:
C:\Windows\Prefetch\Ag*.db
What it contains:
- Program name
- Execution count
- Files opened
- Volume accessed
- Complete path
- Timeframes and timestamps
Tools:
- CrowdResponse - Parse superprefetch databases
SRUM (System Resource Usage Monitor)
Location:
C:\Windows\System32\sru\SRUDB.dat
What it contains:
- AppID and Path
- User who executed
- Sent/Received bytes
- Network interface
- Connection duration
- Process duration
- Updated every 60 minutes
Tools:
- srum_dump - Extract SRUM data
Analysis:
srum_dump.exe -i SRUDB.dat -t SRUM_TEMPLATE.xlsx -o output_folder
AppCompatCache (ShimCache)
Registry Locations:
- XP:
(96 entries)SYSTEM\CurrentControlSet\Control\SessionManager\Appcompatibility\AppcompatCache - Win7/8/10:
(512-1024 entries)SYSTEM\CurrentControlSet\Control\SessionManager\AppcompatCache\AppCompatCache
What it contains:
- Full file path
- File size
- Last Modified time
- Last Updated time
- Process Execution Flag
Tools:
- AppCompatCacheParser - Parse ShimCache
Amcache
Location:
C:\Windows\AppCompat\Programs\Amcache.hve
What it contains:
- Recently executed processes
- Executable paths
- SHA1 hashes
Tools:
- AmcacheParser - Parse Amcache.hve
Analysis:
AmcacheParser.exe -f Amcache.hve --csv output_folder
Key Output:
Amcache_Unassociated file entries CSV
RecentFileCache
Location:
C:\Windows\AppCompat\Programs\RecentFileCache.bcf (Win7 only)
Tools:
- RecentFileCacheParser - Parse cache file
BAM (Background Activity Moderator)
Location:
SYSTEM\CurrentControlSet\Services\bam\UserSettings\{SID}
What it contains:
- Applications executed by each user
- Execution timestamps
Windows Recent Apps
Location:
NTUSER.DAT\Software\Microsoft\Current Version\Search\RecentApps
What it contains:
- Application executed
- Last execution time
- Launch count
Scheduled Tasks and Services
Scheduled Tasks:
- Location:
orC:\Windows\TasksC:\Windows\System32\Tasks - Format: XML files
- Can be read directly
Services:
- Location:
SYSTEM\ControlSet001\Services - Shows what will be executed and when
Windows Store Applications
Locations:
- Installed:
\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd - Registry Installed:
Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications\ - Registry Uninstalled:
Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deleted\
What to look for:
- Application ID, PackageNumber, Display Name
- Sequential IDs can reveal uninstalled applications
Windows Event Logs
Event Log Locations
- Pre-Vista:
(binary format)C:\Windows\System32\config\ - Vista+:
(XML format, .evtx extension)C:\Windows\System32\winevt\Logs\
Registry:
HKLM\SYSTEM\CurrentControlSet\services\EventLog\{Application|System|Security}
Tools:
- Event Viewer (
) - Built-ineventvwr.msc - Event Log Explorer - GUI analysis
- Evtx Explorer/EvtxECmd - Command-line parsing
Security Event IDs
Location:
C:\Windows\System32\winevt\Security.evtx
Authentication Events
| Event ID | Description |
|---|---|
| 4624 | Successful logon |
| 4625 | Failed logon |
| 4634/4647 | Logoff |
| 4672 | Administrative privileges |
Logon Types (Event 4624/4625)
| Type | Description |
|---|---|
| 2 | Interactive (direct login) |
| 3 | Network (shared folders) |
| 4 | Batch (scheduled tasks) |
| 5 | Service |
| 6 | Proxy |
| 7 | Unlock |
| 8 | Network Cleartext (IIS) |
| 9 | New Credentials |
| 10 | Remote Interactive (RDP) |
| 11 | Cache Interactive |
| 12 | Cache Remote Interactive |
| 13 | Cached Unlock |
Failed Logon Status Codes (Event 4625)
| Code | Meaning | Investigation |
|---|---|---|
| 0xC0000064 | User doesn't exist | Username enumeration |
| 0xC000006A | Wrong password | Brute force attempt |
| 0xC0000234 | Account locked | After brute force |
| 0xC0000072 | Account disabled | Unauthorized access attempt |
| 0xC000006F | Outside allowed time | Policy violation |
| 0xC0000070 | Workstation restriction | Unauthorized location |
| 0xC0000193 | Account expired | Expired account access |
| 0xC0000071 | Password expired | Outdated password |
| 0xC0000133 | Time sync issue | Pass-the-ticket attack |
| 0xC000015b | Denied logon type | Unauthorized logon type |
Critical Events
| Event ID | Description | Significance |
|---|---|---|
| 4616 | Time change | Timeline manipulation |
| 6005 | System startup | System timeline |
| 6006 | System shutdown | System timeline |
| 1102 | Log cleared | Evidence destruction |
USB Device Events
| Event ID | Description |
|---|---|
| 20001/20003/10000 | USB first connection |
| 10100 | USB driver update |
| 112 | USB insertion time |
Event Log Recovery
Best practice: Power down by unplugging (don't shutdown)
Tools:
- Bulk_extractor - Recover deleted .evtx files
Attack Indicators
Brute Force:
- Multiple Event 4625 followed by Event 4624
Time Manipulation:
- Event 4616 (time change)
Evidence Destruction:
- Event 1102 (log cleared)
Common Investigation Scenarios
Data Exfiltration
- Check Prefetch/Amcache for data transfer tools
- Review SRUM for network activity
- Examine email artifacts for attachments
- Check USB device tracking
- Review event logs for data access
Malware Investigation
- Analyze Prefetch for unknown executables
- Check AppCompatCache for executed files
- Review scheduled tasks for persistence
- Examine registry run keys
- Check BAM for execution history
Unauthorized Access
- Review Security.evtx for failed logons (4625)
- Check successful logons (4624) for unusual types
- Examine LNK files for accessed resources
- Review jumplists for accessed files
- Check USB device events
User Activity Timeline
- Extract ActivitiesCache.db timeline
- Parse LNK file timestamps
- Review jumplist timestamps
- Correlate with event log timestamps
- Build chronological view
Best Practices
Evidence Preservation
- Create forensic images before analysis
- Work on copies never originals
- Document everything - tools used, commands run, findings
- Maintain chain of custody
- Hash all evidence before and after analysis
Analysis Order
- Volatile first - Event logs, RAM
- System artifacts - Registry, prefetch
- User artifacts - LNK, jumplists, browser
- File system - Shadow copies, deleted files
Correlation
- Cross-reference timestamps across artifacts
- Look for patterns in execution history
- Correlate user activity with system events
- Build timelines from multiple sources
Tool Summary
| Tool | Purpose | Input |
|---|---|---|
| PECmd | Prefetch analysis | .pf files |
| LECmd | LNK file parsing | .lnk files |
| AmcacheParser | Amcache analysis | Amcache.hve |
| srum_dump | SRUM extraction | SRUDB.dat |
| WxTCmd | Timeline extraction | ActivitiesCache.db |
| Rifiuti | Recycle bin analysis | $Recycle.bin |
| ShadowCopyView | Shadow copy inspection | Volume shadow copies |
| EvtxECmd | Event log parsing | .evtx files |
| RegRipper | Registry analysis | Registry hives |
| Bulk_extractor | File carving | Disk images |
Next Steps
After initial analysis:
- Document findings with timestamps and evidence
- Create timeline of key events
- Identify gaps in evidence
- Correlate findings across artifact types
- Prepare report with supporting evidence
For deeper analysis, consider:
- Memory forensics (if RAM captured)
- Network forensics (if packet captures available)
- Malware analysis (if suspicious executables found)
- Advanced timeline analysis with multiple data sources