dfir
blue team
volatility
memory forensics
defense against the dark arts
This article is meant to serve as a 'how to' guide for Incident Response and Digital Forensics practitioners.
It assumes prior security knowledge and only highlights a methodology that I have personally found useful when conducting investigations.
The go-to methodology to get up and running with forensics is as follows:
The forensics process can broadly be classified into the following steps:
While acquiring evidence, it is important to note the order of volatility as follows:
Fundamental sources of forensics evidence:
System and user information
File analysis
Evidence of execution
Persistence Mechanisms
Event Log Analysis
Registry is a db of key value pairs
Once you've extracted evidence using KAPE, you can find the registry files in windows -> system32 -> config
Users only have settings stored in the system if they logged in interactively - i.e mouse and keyboard
The NTUser.dat file gives you specific info about the user and can be found at Users > IEUser > NTUSER.DAT
The UsrClass.dat file gives you specific info that was in the HKEY_CLASSES_ROOT hive and can be found at Users > IEUser > AppData > Local > Microsoft > Windows > UsrClass.dat
Transcation log files store changes to key and value entries in the registry hives
rip.exe for the cli tool
plugins (-p) include:
Plugin name | Function | Example |
---|---|---|
winver | windows version | rip.exe -r C:\Cases\Analysis\Registry\SOFTWARE -p winver |
timezone | timezone | rip.exe -r C:\Cases\Analysis\Registry\SYSTEM -p timezone |
nic2 | network info | rip.exe -r C:\Cases\Analysis\Registry\SYSTEM -p nic2 |
networklist | gives list of APs | rip.exe -r C:\Cases\Analysis\Registry\SOFTWARE -p networklist |
shutdown | shutdown time | rip.exe -r C:\Cases\Analysis\Registry\SYSTEM -p shutdown |
defender | gives details on Windows defender | rip.exe -r C:\Cases\Analysis\Registry\SOFTWARE -p defender |
For automating regripper, first unhide the user specific registry files i.e the UsrClass.dat and NTUSER.dat through
To automate regripper use a for loop specifying regripper should apply the suitable plugins to each hive and store the output in a corresponding text file as follows:
Some questions to ask relate to:
Item | Description | Hive |
---|---|---|
UserAssist: | Applications opened | NTUSER.dat |
RecentDocs: | Files and folders opened | NTUSER.dat |
Shellbags: | Locations browsed by the user | UsrClass.dat |
Open / Save MRU: | Files that were opened | |
Last-Visited MRU: | Applications used to open files |
User Assist keeps track of every application a user has visited.
Therefore when examining multiple users, you'll have to load each of their NTUSER.dat user hives
MACB timestamp format vs Standard Information format:
Modified m… - Modified on
Accessed .a.. - Last Accessed on
Changed ..c. - Record modified on
Birth (creation) …b - Created on
The Changed refers to the Record Modification of the $MFT
$MFT is the Master File Table. The $MFT stores info on files - this is what we carve to get deleted files.
File Name timestamps are the timestamps created when a file starts to exist.
You can only modify the timestamps in the Standard Information since they are the only ones you have access to through the windows API
When SI(Standard Information) < FN (File Name) there is a possibility that the file has been timestomped i.e the timestamp has been altered.
USN journal - update sequence number journal contains a log of operations that are being applied to files on the system.
Location: $Extend -> $UsnJrnl
The UsnJrnl consists of two alternate data streams:
When you triage with Kape, you'll find these files under $Extend -> $J and $Extend -> $Max
Only exists after Windows 10 v1709 (circa 2018).
It records information about exes that have been run on a sys and stores this info in the system registry hive.
Another way to prove existence of malicious executables.
Registry: SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatCache
The shimcache only gets written upon system shutdown.
A file timestamp is basically a 64 bit value representing the number of 100 nanosecond intervals that have elapsed since Jan 1 1601.
Don't sort the Shimcache list by the Modified Time file timestamp, instead sort by the Cache Entry Position.
AmCache Is a registry hive.
It can be found at the Registry: C:\Windows\AppCompat\Programs\Amcache.hve
Prefetch can be found at the Path: C:\Windows\Prefetch*.pf
Windows stores a prefetch file for every application that is executed.
Consider the persistence mechanisms listed below while investigating.
Registry:
Registry: HKLM\SYSTEM\CurrentControlSet\Services
Registry:
from the regripper output search for taskcache
You can view the services that ran using Autoruns for Sysinternals by Mark Russinovich
Path: C:\Windows\System32\winevt\logs
Event id for logons is 4624
Catch up on 4624 here
We discard a logon type 5 because it is associated with service accounts.
We pay attention to:
Source | EventID | Description |
---|---|---|
Microsoft-Windows-Windows Defender | 5000 | Defender enabled |
5001 | Defender disabled | |
System | 7045 | A new service was installed |
Security | 4624 | An account was successfully logged on |
Windows Powershell | 400 | Engine state changed from none to available (meaning a powershell engine was started) |
Microsoft-Windows-Sysmon | 1 | Process creation |
3 | Network Connection | |
11 | File Create | |
12,13 | Registry Events | |
22 | DNSQuery |
To analyze RAM in Windows, one can opt to use Volatility as summarily described below.
The user hive is the one that contains the classes subkey
Volatility timeline output is recorded as Mactime Bodyfile in Timeline Explorer
Here is a cheatsheet to EZ tools
This serves as an introduction to Windows Forensics in a practical format that you can use to get up and running when you need to carry out a Digital Forensics Investigation.