Windows Live DFIR

System Information

Kill & Remove Services

Resolve Device PublicIP /w Powershell

Obtain list of all files on a computer

Local Temp Cache Folders

Registry Stuff

  • Export the IniFileMapping key and saves to IniFileMapping.reg

User and admin information

Logon information

NT Domain/Network Client Information

Running Processes - Remote IP/Port & PID

Hunt a Process/Service/Product

Uninstall Service

Kill malicious process

Firewall Information

Firewall Changes

Pagefile information

Group and access information

(Accesschk requires accesschk64.exe or accesschk.exe from sysinternals):

Cookies

RecentDocs Information

*Note: Run with Powershell, get SID and user information with ‘wmic useraccount get name,SID’

More information on recent documents may be found:

Startup process information

Startup process information by path/file name

Note: This will search common persistence areas but not all of them, change the $Malware variable value to a term of your choosing.

Startup process information by path/file name

Note: This will search common persistence areas but not all of them, change the $Malware variable value to a term of your choosing.

Scheduled task/job information

Powershell:

Remediate malicious scheduled tasks

Powershell:

UAC Bypass Fodhelper

Persistence and Automatic Load/Run Reg Keys

Replace: “reg query” with “Get-ItemProperty -Path HK:" in Powershell*

e.g.: Get-Item -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

User Registry (NTUSER.DAT HIVE) - Commonly located at:

*Note: These are setup for querying the current users registry only (HKCU), to query others you will need to load them from the relevant NTUSER.DAT file and then query them.

Local Machine (SOFTWARE HIVE)

Don’t be afraid to use “findstr” to find entries of interest, for example file extensions which may also invoke malicious executables when run, or otherwise.

Local Machine (SYSTEM HIVE)

Note: This not only contains services, but also malicious drivers which may run at startup (these are in the form of “.sys” files and are generally loaded from here: \SystemRoot\System32\drivers)

Note: Some useful commands to show relevant service information

MITRE ATT&CK Persistence

TO DO - Automate enumeration

T1015 Accessibility Features

T1098 Account Manipulation

https://attack.mitre.org/techniques/T1098/

T1182 AppCert DLLs

https://attack.mitre.org/techniques/T1182/

T1103 AppInit DLLs

https://attack.mitre.org/techniques/T1103/

T1138 Application Shimming

https://attack.mitre.org/techniques/T1138/

T1197 BITS Jobs

https://attack.mitre.org/techniques/T1197/

https://ired.team/offensive-security/persistence/t1197-bits-jobs

T1067 Bootkit

Note: This exists below the OS in the Master Boot Record or Volume Boot Record. The system must be booted through Advanced Startup Options with a Command Prompt, or through a recovery cd.

Extra: If your boot configuration data is missing or contains errors the below can fix this.

If you’re thinking of a bootkit more as malicious system drivers you can go with the below.

Unsigned Drivers

Unload malicious filter driver

https://attack.mitre.org/techniques/T1067/

T1176 Browser Extensions

Chrome

Firefox

Edge

Internet Explorer

https://attack.mitre.org/techniques/T1176/

T1109 Component Firmware

Note: This is incredibly rare, and doesn’t have an easy detection/remediation mechanism. Using the Windows CheckDisk utility, System File Checker, or Deployment Image Servicing and Management may assist but isn’t guaranteed.

https://attack.mitre.org/techniques/T1109/

T1122 Component Object Model (COM) Hijacking

Note: This involves replacing legitimate components with malicious ones, and as such the legitimate components will likely no longer function. If you have a detection based on DLLHost.exe with /Processid:{xyz}, you can match xyz with the CLSID (COM Class Object) or AppID mentioned below to check for any malicious EXE or DLL.

Example analysis:

Queries:

Get list of all COM Objects

{Original by Jeff Atwood](https://stackoverflow.com/questions/660319/where-can-i-find-all-of-the-com-objects-that-can-be-created-in-powershell)

https://attack.mitre.org/techniques/T1122/

T1136 Create Account

https://attack.mitre.org/matrices/enterprise/windows/

T1038 DLL Search Order Hijacking

https://attack.mitre.org/techniques/T1038/

T1133 External Remote Services

T1044 File System Permissions Weakness

https://attack.mitre.org/techniques/T1044/

T1158 Hidden Files and Directories

https://attack.mitre.org/techniques/T1158/

T1179 Hooking

Finding EasyHook Injection

More Material:

https://attack.mitre.org/techniques/T1179/

T1062 Hypervisor

T1183 Image File Execution Options Injection

https://attack.mitre.org/techniques/T1183/

https://ired.team/offensive-security/privilege-escalation/t1183-image-file-execution-options-injection

T1037 Logon Scripts

https://attack.mitre.org/techniques/T1037/

https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1037/T1037.md

T1177 LSASS Driver

https://attack.mitre.org/techniques/T1177/

T1031 Modify Existing Service

https://attack.mitre.org/techniques/T1031/

https://pentestlab.blog/2020/01/22/persistence-modify-existing-service/

T1128 Netsh Helper DLL

https://attack.mitre.org/techniques/T1128/

https://ired.team/offensive-security/persistence/t1128-netsh-helper-dll

T1050 New Service

https://attack.mitre.org/techniques/T1050/

https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1050/T1050.md

T1137 Office Application Startup

https://attack.mitre.org/techniques/T1137/

T1034 Path Interception

T1013 Port Monitors

https://attack.mitre.org/techniques/T1013/

T1504 PowerShell Profile

https://attack.mitre.org/techniques/T1504/

T1108 Redundant Access

T1060 Registry Run Keys / Startup Folder

https://attack.mitre.org/techniques/T1060/

T1053 Scheduled Task

https://attack.mitre.org/techniques/T1053/

T1180 Screensaver

https://attack.mitre.org/techniques/T1180/

T1101 Security Support Provider

https://attack.mitre.org/techniques/T1101/

T1505 Server Software Component

T1058 Service Registry Permissions Weakness

https://attack.mitre.org/techniques/T1058/

T1023 Shortcut Modification

https://attack.mitre.org/techniques/T1023/

T1198 SIP and Trust Provider Hijacking

https://attack.mitre.org/techniques/T1198/

T1209 Time Providers

https://attack.mitre.org/techniques/T1209/

T1078 Valid Accounts

T1100 Web Shell

https://attack.mitre.org/techniques/T1100/

T1084 Windows Management Instrumentation Event Subscription

Get WMI Namespaces

https://attack.mitre.org/techniques/T1084/

Query WMI Persistence

T1004 Winlogon Helper DLL

https://attack.mitre.org/techniques/T1004/

Other Persistence

Winsock Persistence

Check disabled task manager (often from malware)

Review Hivelist

Locate all user registry keys

Load all users registry keys from their ntuser.dat file (perform above first)

Query all users run key

Unload all users registry keys

Remediate Automatic Load/Run Reg Keys

Powershell:

Check Registry for IE Enhanced Security Modification

Check Registry for disabling of UAC (1=UAC Disabled)

Review Software Keys for malicious entries

Scan Registry keys for specified text

Persistent file locations of interest

Search lnk,bat,dll's

You can scan these directories for items of interest e.g. unusual exe, dll, bat, lnk etc files with:

Locate LNK Files with a particular string (Special thanks to the notorious)

Master File Table

The Master File Table is an incredibly important artifact; however, this can only be read or obtained using low level disk reading. This contains an entry for every file or directory on the filesystem including metadata about these files, and may provide evidence on files which have been removed (MFT entries marked as ‘free’). More information can be found on MS Docs (https://docs.microsoft.com/en-us/windows/win32/fileio/master-file-table)

Determine Timestomping

Within the Master File Table (Located at the Win root) there are 2 elements, $STANDARD_INFORMATION and $FILE_NAME, both of which have values for a file being created, modified, accessed and written.

These are known as MACB times (Modified, Accessed, Changed, Birth). The $STANDARD_INFORMATION element can be modified from a malicious process, but the $FILE_NAME element is left intact and cannot without some extra trickery.

These discrepancies generally indicate Timestomping with the $FILE_NAME entry being the source of truth. This can be determined by obtaining the MFT (e.g. using a tool such as Rawcopy), and comparing timestamps on the file (e.g. using a tool such as MFTExplorer).

Rawcopy

MFTExplorer

Enable Date Accessed Timestamps

Remove BITSAdmin Persistence

Check system directories for executables not signed as part of an operating system release

Locate Possible Trickbot

Determine if user Trusted a doc/spreadsheet etc and ran a macro

Note: Don’t forget to load in user hives.

Note: This will show the file name/location and metadata in Hex. If the last lot of hex is FFFFFF7F then the user enabled the macro.

Check Office Security Settings

Prevent CVE-2017-11882, CVE-2018-0802, CVE-2018-0804, CVE-2018-0805, CVE-2018-0806, CVE-2018-0807 (EQNEDT32.EXE) Exploitation

Note: This is the “Equation Editor” exploit, either patch or mitigate. More information on the below process.

64-Bit Windows:

32-Bit Windows:

Determine if user opened a document

Prevent Executable from Running.

Note: Load in hives and add particular SID to prevent users running named files, helps prevent for example your IIS service account from running cmd.exe or powershell.exe

Show known file extensions and hidden files (excluding OS hidden files)

Open File Extension (e.g. scripts) with certain application (elevated cmd)

Disable Command Prompt

Note: A legitimate clean executable can be used to run malicious DLLs based on how the software searches for them.

More information on Microsoft Docs

Search order for desktop applications:

If SafeDllSearchMode is enabled (is by default), the search order is as follows:

  • The same directory from which the executable is run.

  • The System Directory (Usually C:\Windows\System32).

  • The 16-bit System Directory.

  • The Windows Directory (Usually C:\Windows).

  • The Current Directory (From the process which executed the executable).

  • The directories that are listed in the PATH environment variable.

If SafeDllSearchMode is disabled (SafeDllSearchMode has a reg value of 0), the search order is as follows:

  • The same directory from which the executable is run.

  • The Current Directory (From the process which executed the executable).

  • The System Directory (Usually C:\Windows\System32).

  • The 16-bit System Directory.

  • The Windows Directory (Usually C:\Windows).

  • The directories that are listed in the PATH environment variable.

Locate Possible Dll Side Loading

Note: A legitimate clean executable can be used to run malicious DLLs based on issues with a manifest file used by the application to load DLLs.

By placing a malicious DLL in the below locations legitimate binaries may have been used to sideload these malicious DLLs.

  • C:\Windows\WinSxS

  • C:\Windows\SXS

Unique Sideload DLL hashes (may take some time)

Unsigned or Invalid Sideload DLLs (there will be a lot)

Unsigned Sideload DLLs (Less noise)

Hash of Unsigned Sideload DLLs

Find files without extensions

Remediate malicious files

Powershell:

Detect Persistent WMI Subscriptions

Remediate Persistent WMI Subscriptions

Mimikatz/Credential Extraction Detection

The below represent registry keys which make it more difficult for Mimikatz to work. Modification of these keys may indicate an attacker trying to execute Mimikatz within an environment if they were set to their more secure state. Always test prior to changing registry keys such as these in a production environment to ensure nothing breaks.

The Mimikatz Yara rule may also prove useful.

Some techniques may involve loading lsasrv.dll or wdigest.dll to extract credentials and may be caught if this is loaded legitimately using:

You may be able to detect changes to the below registry keys which can be used to load an arbitrary DLL and extract credentials, more information from Adam Chester

An adversary may also tamper with the number of cached logons a system holds (default of 10).

NetNTLM Downgrade Attack Detection

DanderSpritz eventlogedit

Putty Detection

Installed Updates

(WMI Quick Fix Engineering)

Installed Software/Packages

Powershell: Full List for all users using uninstall keys in registry

Process information

(pslist requires sysinternals pslist.exe):

PowerShell Module to show Process Tree

Current Process execution or module loads from temporary directories

Note: This will likely have some false positives as it’s just a wildcard. So in this case using ‘temp’ can come up in words such as ‘ItemProvider’.

Current Process execution or module loads from temporary directories + hash

Scan for malware with Windows Defender

Note: Types are as follows

  • 1: Quick scan

  • 2: Full system scan

  • 3: File and directory custom scan

Check Windows Defender for excluded files and default actions

Delete Windows Defender excluded files

Check and Set Access Control Lists

Change ACE for “everyone” on folder and subfiles/folders

Grant everyone full access

Remove ACE entries for “everyone”

Make multiple files visible and remove ‘superhidden’

Check Security Descriptor Definition Language (SDDL) and Access Control Entries (ACE) for services

More information on ACE Strings and the level of access they can provide.

Kill “Unstoppable” Service/Process

Obtain hash for all running executables

Issues with spaces in names but supports CMD.exe

Powershell (Special thanks Lee Holmes)

My less efficient powershell

Obtain hash and established network connections for running executables with dns cache

Obtain hash and listening network connections for running executables

Obtain hash and possible tunneled network connections for running executables

Obtain workstation name for tunneled authentication

Obtain hash of DLLs currently loaded by processes

Obtain processes running which are running a DLL

Obtain hash of unsigned or invalid DLLs currently loaded by processes

Obtain list of unsigned DLLs currently loaded by processes

Obtain DLL information ListDLLs

Obtain unsigned DLL information loaded by processes

Obtain DLLs in use by processes

Determine handles on a file

Verify EternalBlue Patch (MS17-010) is installed - Microsoft

Note: This impacts the SMB 1.0 Server Driver, if you don’t have the below, then it’s not installed. If you do you can use the above to determine patch level.

Obtain TXT records from recently resolved domains

Check all Appdata files for unsigned or invalid executables

Check for execuables in Local System User Profile and Files

Investigate WMI Usage

Note: Requires Strings

Find executables and scripts in Path directories ($env:Path)

Find files created/written based on date

Check running executables for malware via VirusTotal

Note: VT Has a rate limit for the Public API so this won’t work if you are using the Public API. All 1 liners require VTAPIKey to be set as your VirusTotal API key

This query uses a 15 second timeout to ensure only 4 queries are submitted a minute

This query uses a 15 second timeout to ensure only 4 queries are submitted a minute and only unique hashes are queried

Scan systems for IOA/IOC (Yara)

Loki Scanner

Crowdresponse Scanner

IREC Tactical

Yara

Yara Linux

Last updated

Was this helpful?