SANSDFIR1
SANSDFIR1
Results in Seconds
at the Command Line
FOR518 FOR585 FOR610 SEC504
Mac and iOS Forensic Smartphone Forensic Reverse-Engineering Hacker Tools,
Analysis and Analysis In-Depth Malware: Malware Analysis Techniques, Exploits,
Incident Response GASF Tools and Techniques and Incident Handling
GREM GCIH
DFPS_Command-Line_v1.2_01-21
digital-forensics.sans.org
With the wealth of data stored on Windows computers it is often difficult to know where Options Definition
-d Dir to process
to start. If you encounter a sizable hard drive, it could be hours or even days before you’re -f File to process
-q Quiet mode
ready to even start your investigation, never mind reporting the results. Using the EZ tools --dt Custom date/Time format
--mp Higher precision timestamps are displayed and will also be reflected in any exported data
provides scriptable, scalable, and repeatable results with astonishing speed and accuracy. --csv --json --html Data can be exported to several formats. You can request multiple formats at the same time.
--debug Shows debug info during tool execution (more info)
Go from one investigation a week to several per day. This type of performance is common --trace Shows trace info during tool execution (most info) can be run with debug (--debug --trace)
--sync Sync updates from GitHub for KAPE targets & module updates. For evtxecmd map updates
with the command line versions of EZ Tools. This poster will show you how. -vss Process Volume Shadow Copies – Supported in EvtxECmd, MFTECmd, PECmd,and RECmd
AppCompatCacheParser – Shimcache Parser Key Data Returned bstrings – Extract Text From Binary Files Advanced Usage
Processed Shimcache data in CSV, XML, or JSON format is available. The columns --lr Regular Expression searches bstrings and also contains over a dozen
Type of Artifact of most significance are typically the “Path” (the location and name of the Type of Artifact built-in regular expression patterns for things like credit card numbers, social
executable), “LastModifiedTimeUTC” (the last written time of the executable) security numbers, IP addresses, email addresses, and more.
Application Compatibility Cache (also known as Shimcache) is part of the Bstrings can be used to search any type of file for potentially valuable
and “Executed” (whether the executable was run). The most common mistake
Windows capability to provide backwards compatibility for programs meant to information. -p shows a list of built-in regular expressions. When using a built-in expression,
made by forensicators is that they’ll assume that the LastModifiedTimeUTC
run on older versions of Windows. When an executable is found by Windows, use the value in the Name column. For example, to look for email addresses,
value refers to the execution of the file. Don’t fall into this trap!
the operating system determines how best to run the program. As a byproduct Basic Usage use this command:
of this, the AppCompatCache stores information about those executables. bstrings.exe -f <file>
Advanced Usage bstrings.exe -f <some file> --lr email
AppCompatCache can be leveraged to assist forensic investigators in
determining what executables were run on Windows. PRO TIP: Watch for changes at the start of the “Path”. Anything that shows Option/Switch Use Example bstrings also allows searching for several strings or regular expressions at
“SYSVOL” ran from the host’s OS volume. Other volumes will be recorded by their once using the --fr and --fs switches.
--Is Search for string bstrings -f suspect.exe --Is password
Basic Usage drive letter.
--Ir Search with regular expression bstrings -f suspect.exe --Is (ntos|win32k) In addition to Unicode strings, bstrings looks for strings encoded using
AppCompatCacheParser takes the SYSTEM registry hive as input and interprets the Path Last Modified Time UTC Executed Western (1252) code page. Use the --cp switch to search in any other code page
--p List builtin regular expressions bstrings -p
data stored therein. The SYSTEM hive must be specified using the -f parameter SYSVOL\Windows\System32\notepad.exe 8/22/2019 11:00:12 Yes supported by .net.
--Ir XX The XX represents a builtin regex bstrings -f suspect.exe --Ir ipv4
to indicate that the command is to be run over that registry hive only.
E:\TACTICAL Subject\f-response-tacsub.exe 8/12/2019 19:21:00 Yes --fr Read file containing regex’s to use in search bstrings -f suspect.exe -fr DFIR_RegExs.txt
In the example command below, AppCompatCacheParser is being run against -h List all options bstrings -h
a SYSTEM registry hive stored on an evidence file mounted as a disk (E:). PRO TIP: As a file’s last written time does not change when a file is moved, A full listing of available code pages is available at
--cp Use a different ANSI code page bstrings -f Powershell.evtx --Is download --cp 1201
Output is stored on the G: drive to the “AppCompatCache” folder. The renamed or copied, it may be possible to track the same executable across https://goo.gl/ig6DxW
AppCompatCacheParser application will create an output file (CSV in this case) a single or even multiple systems, as a new entry will be created in the note: Windows Event Log require the 1201 specific code page for bstrings to find the search string
with the date and time that the AppCompatCacheParser was executed and in AppCompatCache when the file is executed from a different location or with
a different name. The table below shows the same executable being run in Interesting options and switches:
the detected version operating system, in the file name.
different scenarios. We know they are all the same executable because they bstrings.exe -f <file> --ls “password”
AppCompatCacheParser.exe -f E:\Windows\System32\config\SYSTEM
share the same last written time.
--csv G:\AppCompatCache Use the -x and -m switches to set maximum and minimum string lengths.
Path Last Modified Time UTC Executed Use --off to show the offset for each search hit.
SYSVOL\Windows\System32\spinlock.exe 10/23/2019 14:27:18 Yes
SYSVOL\Users\SRogers\AppData\Local\Temp\spinlock.exe 10/23/2019 14:27:18 Yes
The most trusted source for EZ Tools are free resources for
cybersecurity training, certifications, the DFIR community. Development
degrees, and research @sansforensics sansforensics dfir.to/MAIL-LIST
is funded in part by the SANS Institute. sans.org/eztools
RBCmd – Recycle Bin Artifact Parser In the next example, RBCmd is being run against a single $I (information) file on a JLECmd – JumpList Explorer Command Line Key Data Returned
mounted drive (E:). The output is displayed in the window where the command The JLECmd output contains two important categories of data, evidence of
was run. Edition execution and evidence of file knowledge. The table below shows some of the
Type of Artifact
RBCmd.exe -f E:\$Recycle.Bin\S-1-5-21-718126207-1171771683- more significant columns to include in your review.
Windows stores information relating to user deletions on a per user basis in the Type of Artifact
Recycle Bin. Windows XP used a file named “INFO2” to track the deletions. This file 1750804747-1001\$I7YQ28P.jpg Column Name Forensic Value
Jumplists store critical information about files and folders that have been
included the original location and time that each file was deleted. That behavior Source file: .\$IG1VEXX.xls interacted with using various GUI applications in Windows. Among other things, AppIdDescription Human readable name for AppID
changed in Windows Vista when each deleted file was tracked on its own. Now, Jumplists contain information about the application used to open target files
when a file is deleted, it is renamed. For example, if cat.jpg was deleted, the Version: 1 (Pre-Windows 10) DestListVersion Used with MRU to detemine most recentely opened file in the Jump List
File size: 16384 (16KB) and folders and store metadata specific to those target items. Those metadata
deleted file would have a name such as $R7YQ28P.jpg. The $R prefix means that File name: C:\Users\Donald\SkyDrive\Documents\WACC Calc Spreadsheet -SECRET.xls contain details such as file name and location, dates and times, etc. Parsing the
MRU Used with DestListVersion to detemine most recentely opened file in the Jump List
it contains the content (Resource) of the original file. In addition to the $R file, a Deleted on: 2013-10-21 18:32:52.5320000 Jumplist data can be difficult and time-consuming as they are stored in a format
Path Location and name of file opened
new corresponding $I (Information) file is created in the Recycle Bin. So every known as MS OLE Structured Storage files. JLECmd makes parsing this data TargetCreated Creation Timestamp of file referenced in JL
deleted file has both a $R and $I file with a matching random string for the rest In the final example, RBCmd is being run against the parent folder of the $I file
simple and quick. TargetModified Modification Timestamp of file referenced in JL
of the file name. The $I file contains the information about the original location above, thereby parsing all of the $I files. This time, the output is stored in a CSV
of the file and the date and time of deletion. RBCmd takes this data and presents stored in G:\RBFiles with the date and time in the file name. Use of the -q switch
prevents all of the output from being sent to the window, making processing Basic Usage Advanced Usage
it in a human-readable format. PRO TIP: Watch for changes in the “DriveType”, “VolumeSerialNumber” and
faster. JLECmd takes either a single Jumplist file (relating to a specific application) or
a directory of Jumplists as input. If parsing a single Jumplist, use the -f option. “VolumeLabel” columns as the data in these columns can indicate whether files
Basic Usage RBCmd.exe -d F:\$Recycle.Bin\S-1-5-21-718126207-1171771683-
If parsing a directory of Jumplists, use the -d option. It is also suggested that have been opened from external devices. In the example below, the change in
In the example command below, RBCmd is being run against an INFO2 file stored 1750804747-1001 --csv G:\RBFiles -q these columns shows that a file was opened from the USB device named “FILES”.
the -q switch be used to avoid dumping all results to the screen (which can
on an evidence file mounted as a disk (E:). When running this command the dramatically slow down JLECmd’s execution time). Additionally, the local path may show the same drive letter for multiple
output is shown in the window running the command (command line window
In the example command below, JLECmd is being run against a single Jumplist removable devices (e.g., F:\) but you should also review the volume serial
or PowerShell). Note that because the INFO2 file may contain information about
stored on an evidence file mounted as a disk (E:) Output is stored on the G: number and the volume label to determine if the drive letter is associated with
several deleted items, it may be best served to output to a CSV for review (see
drive to the “Jumplists” folder. JLECmd will create an output file (CSV in this case) the same or different devices.
third example below). Key Data Returned
with the date and time in the file name.
RBCmd.exe -f E:\RECYCLE\S-1-5-21-3001495921- Processed Recycle Bin data is either output to the screen (if no output file is Target Drive Type Volume Serial Volume Label Local Path
Modified Number
1769015868-3887507880-1001\INFO2 specified) or in a standardized CSV, XML, or JSON. The screenshot below shows JLECmd.exe -f E:\Users\Donald\AppData\Microsoft\Windows\Recent\
an example of the output when run against a single file. The source file is AutomaticDestinations\ff103e2cc310d0d.automaticDestinations-ms 9/1/2018 Fixed storage media 7E58AAB0 Windows10_OS C:\Users\srogers\Documents\NETFLIX SEC
16:53 (Hard drive) Filings\SEC-NFLX-1193125-12-53009.pdf
shown, as is the file size, original file name and location and date of deletion. --csv G:\Jumplists -q
9/27/2018 Fixed storage media 7E58AAB0 Windows10_OS C:\Users\srogers\Documents\Netflix 3Q13
In the example command below, JLECmd is being run against all automatic 17:42 (Hard drive) Conference Call Announcement 09 30 13.pdf
Advanced Usage jumplist files stored for the user “Donald”. Output is stored in the same folder as 9/3/2018 Removable storage B0A9FE90 FILES F:\Forms\fy08-form-10k.pdf
before. JLECmd will create an output file (CSV in this case) with the date and time 14:13 media (Floppy, USB)
PRO TIP: Running RBCmd on a mounted drive will work, but remember that when
in the file name. 9/1/2018 Fixed storage media 7E58AAB0 Windows10_OS C:\Users\srogers\Documents\NETFLIX SEC
doing so, Windows does not see deleted files, so RBCmd won’t pick them up. It 16:43 (Hard drive) Filings\SEC-NFLX-1065280-13-8.pdf
is often worth extracting deleted $I files using another tool and then running JLECmd.exe -d E:\Users\Donald\AppData\Microsoft\Windows\Recent\
RBCmd over those recovered files. AutomaticDestinations --csv G:\Jumplists -q
A mapping of app_ids to app name can be found at
https://for500.com/appid.
AmcacheParser – Amcache Parser volume the executable was run), MFT Entry number and Sequence numbers (used
to determine if the executable was run from an NTFS volume) and information
about the internal metadata of the executable itself.
Type of Artifact
Amcache is part of the Application Experience Service in Windows. The
RECmd – Registry Explorer Command Line Edition Keys collection – Each entry consists of:
File Description Contents • Version: A version number that should be incremented as changes happen A mapping of app_ids to app name can be found at
$MFT Index of each file and folder on volume File name timestamps, and other metadata • Id: A unique (across all other batch files) GUID (Global Unique Identifier) that https://for500.com/appid.
$Boot Volume boor record Volume serial nbr, volume signature, nbr of sectors identifies this batch file
$SDS File ownership Contains a list of all the Security Descriptors on the volume
$J USN Journal Transaction log of all changes to a file A few moments later, both files are deleted as the $Recycle.bin is emptied.
(write, delete, rename, etc.) (file change journal)
$Logfile Transaction Log File Used by NTFS to maintain the integrity of the filesystem in
the event of a crash (metadata change journal) LECmd – LNK File Explorer Advanced Usage
PRO TIP: Taking the data from key columns not only tells a forensic investigator
The $SDS file allows us determine file ownership. For example, in the first
Basic Usage Type of Artifact when the file was opened, but may also provide details about the number of
screenshot below we see output from the parsed $MFT loaded into Timeline
MFTECmd takes a $MFT, $J, $SDS, $Logfile or $Boot as input. These input files Explorer. Looking at the NTUSER.DAT Shortcut files (*.lnk) are shell items and, as such, not entirely human-readable.
times a user accessed a file with that name. In the table below, the first row
can be in the form of an exported copy of the file(s) or by referencing them from of results indicates that the file was only opened once, as SourceCreated and
entry we can see that the Security ID Lnk files are most frequently created when a user opens a non-executable file
within a mounted image. The example command below shows MFTECmd being SourceModified contain the same time. The second instance indicates that the
for this file is 8271. by double-clicking. These shortcut files are stored under the user profile that
run against a $MFT file that has been exported from an evidence file and the data file has been opened at least twice, as the SourceCreated occurred around seven
opened the file and contain information relating to the opened target file. This
being saved to a CSV file. If we then go to the $SDS output and hours before the SourceModified. We also see that the Target dates are identical,
includes information such as the target file dates and times (at the time when
search for that same Security ID, we find that the NTUSER.DAT file is owned by suggesting that the file has not been changed since it was created. The last
MFTECmd.exe -f ‘G:\Exports\$MFT’ --csv G:\MFT_Output the user with the Relative ID of 1001. If needed, we can take the SID and tied it
the file was opened), file name and path, the drive type, volume serial number,
row indicates that the file was only opened once, since the Source entries are
volume label and more. LECmd takes this data and presents it in a human-
In the next example MFTECmd is run against a $MFT file stored on a mounted to a username via the SAM Registry Hive. identical, However, the TargetModified precedes the TargetCreated, indicating
readable format.
disk (E:) and outputting the data as a CSV file. In order to run this command, it that the file has been copied to the F: drive from another location.
is recommended to mount the evidence using Arsenal Image Mounter as write-
temporary. Basic Usage
LECmd takes, as input, either a single lnk file or a folder containing several such Source Source Target Target Path (Combined from Local Path and
MFTECmd.exe -f ‘E:\$MFT’ --csv G:\MFT_Output files.
Created Modified Created Modified Common Path)
Advanced Usage 9/1/2018 9/1/2018 8/27/2018 9/6/2018 C:\Users\Donald\Documents\NETFLIX SEC Filings\
Note the command line syntax for referencing the alternate data streams PRO TIP: It is important to remember that NTFS stores two sets of dates In the example command below, LECmd is being run against a single lnk file 16:53 16:53 09:24 14:43 SEC-NFLX-1193125-12-53009.pdf
$UsnJrnl and $Secure. and times in each $MFT entry. These are known as the Standard Information stored on an evidence file mounted as a disk (E:). When running this command 9/27/2018 9/27/2018 9/27/2018 9/27/2018 C:\Users\srogers\Documents\Netflix 3Q13
MFTECmd.exe -f ‘E:\$Extend\$UsnJrnl:$MFT’ --csv G:\USN_Output Attributes (SIA) and the FILENAME attributes. This means that each file and the output is shown in the window running the command (command line 10:42 17:37 10:28 10:28 Conference Call Announcement 09 30 13.pdf
folder will have timestamps in both groups. These dates and times behave window or PowerShell). 9/3/2018 9/3/2018 9/3/2018 9/1/2018 F:\Forms\fy08-form-10k.pdf
MFTECmd.exe -f ‘E:\$Secure:$SDS’ --csv G:\SDS_Output differently and can indicate when a file was truly created, not just what Windows 14:13 14:13 14:11 18:19
LECmd.exe -f E:\Users\srogers\AppData\Microsoft\Windows\Recent\
reports. For example, in the table below we see a number of files stored under
Key Data Returned Peggy.jpg.lnk
the Windows directory. The Created0x10 is the created date and time as stored in PRO TIP: LNK facts to keep in mind:
The columns of most significance are highly dependent on the type of the SIA and Created0x30 relates to those stored in the FILENAME attributes. In the next example, LECmd is being run against a folder of lnk files stored on the
• The target file name extension is not always provided in the LNK name.
investigation and the reason for parsing the files in the first place. For example, same mounted evidence file as above. This time, the output is stored in a CSV
As can be seen in the table, both dates and times are the same for the first
the dates and times in the $MFT could provide an indication as to the copying stored in G:\LnkFiles. • T
he LNK file points to the last file of that name. Meaning, if there were two
two entries, but the third entry shows a FILENAME creation date that is much
of files from external devices. If the written/modification time precedes the files named exactly the same, the link files point to the last one opened.
later than the creation date stored in the SIA. This may be an indication of LECmd.exe -f E:\Users\srogers\AppData\Microsoft\Windows\Recent
creation time, there is a high degree of probability that the file was copied
manipulation of the SIA timestamp for the syncmon.exe file and would warrant --csv G:\LnkFiles -q
from another volume.
further investigation.
In the example below, the $MFT has been parsed to CSV and loaded into Key Data Returned
Created0x10 Created0x30 Path (combined from Parent Path and File Name)
Timeline Explorer. In each row the Last Modified time precedes the Created time.
Column Name Forensic Value
3/18/2019 09:17 3/18/2019 09:17 C:\Windows\System32\cmd.exe
3/18/2019 09:18 3/18/2019 09:18 C:\Windows\System32\mountvol.exe AppIdDescription Human readable name for AppID
3/18/2019 09:19 8/18/2019 01:12 C:\Windows\System32\syncmon.exe DestListVersion Used with MRU to detemine most recentely opened file in the Jump List
MRU Used with DestListVersion to detemine most recentely opened file in the Jump List
PRO TIP: When an evidence file is mounted as a drive MTFECmd can also dive into Path Multiple Path Columns: Location and name of source and target files
the volume shadow copies and retrieve previous versions of the $MFT, the $J
SourceCreate Creation Timestamp of the LNK itself
and $SDS files. This can be done by virtue of the switches --vss and --dedupe as
SourceModified Modification Timestamp of the LNK itself
demonstrated in the command below. The --vss switch tells MFTECmd to search
This is a clear indication that these files were copied from another volume. in the volume shadow copies and the --dedupe switch stops MFTECmd from TargetCreated Creation Timestamp of target file the LNK points to
reporting duplicate entries found in the volume shadow copies. TargetModified Modification Timestamp of target file the LNK points to
The processed $J data can be used to determine the date and time that specific
DriveType Network, fixed loal, ior Removable
actions were taken on a file. These actions include (but are not limited to) MFTECmd.exe -f ‘E:\$Extend\$UsnJrnl:$J’ --csv G:\MFT_Output
creating a new file, making changes to a file, deleting a file, overwriting a file, --vss --dedupe VolumeSerialNumber MFT Entry Number
and renaming a file. The $LogFile tracks changes to the information found in the MFT Nbr & Seq nbr MFT - Seg nbr - If present then Voluome is NTFS
The most trusted source for This poster was created by Mark Hallman and
cybersecurity training, certifications, Lee Whitfield with support from the SANS DFIR Faculty
degrees, and research sans.org/eztools ©2021 Mark Hallman and Lee Whitfield. All rights reserved.