Windows System Enumeration

Gather artifacts

reg save HKLM\SAM [LOCATION]\SAM 
reg save HKLM\SYSTEM [LOCATION]\SYSTEM
reg save HKLM\SECURITY [LOCATION]\SECURITY
reg save HKLM\SOFTWARE [LOCATION]\SOFTWARE

System and User information

get-computerinfo
echo %DATE% %TIME%
date /t
time /t
reg query "HKLM\System\CurrentControlSet\Control\TimeZoneInformation"
systeminfo
wmic computersystem list full
wmic /node:localhost product list full /format:csv
wmic softwarefeature get name,version /format:csv
wmic softwareelement get name,version /format:csv
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /s
echo %PATH%
(gci env:path|Select -exp Value).split(';')
SET
wmic bootconfig get /all /format:List
wmic computersystem get name, domain, manufacturer, model, numberofprocessors,primaryownername,username,roles,totalphysicalmemory /format:list
wmic timezone get Caption, Bias, DaylightBias, DaylightName, StandardName
wmic recoveros get /all /format:List
wmic os get /all /format:list
wmic partition get /all /format:list
wmic logicaldisk get /all /format:list
wmic diskdrive get /all /format:list
fsutil fsinfo drives

(psinfo requires sysinternals psinfo.exe):

Model of motherboard and hardware information:

Installed Updates

(WMI Quick Fix Engineering)

Installed Software/Packages

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

User and admin information

User accounts and logon information

Logon information

NT Domain/Network Client Information

Group and access information

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

Hosts file and service>port mapping

cmd history

Linux Subsystem for Windows 10 may have history in a location such as:

Check group policies

Obtain mode settings for ports

Service information

View Named Pipes

File Information

Obtain list of all files on a computer

Pagefile information

Cookies

RecentDocs Information

Special thanks Barnaby Skeggs

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

More information on recent documents may be found:

Recent execution of programs

  • Prefetch Located at : %SystemRoot%\Prefetch\

  • RecentFileCache.bcf Located at : %SystemRoot%\AppCompat\Programs\

  • Amcache.hve (reg hive) Located at : %SystemRoot%\AppCompat\Programs\

Or query a lot of run programs from program compatibility assistant:

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

Files greater than a 10mb

Temp files greater than 10mb

Alternate Data Streams

List Alternate Data Streams in current Dir and view them

List Alternate Data Streams in text files within AppData

Use Alternate Data Streams to find download location

Firewall and AV

Firewall Information

Firewall Changes

Start-up/Autoruns

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.

Scheduled task/job information

Powershell:

File hash and location of all scheduled tasks

From System32 Directory:

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” or ‘/f’ 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

Registry

Powershell: Query Registry Keys

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

Network Connections

Network connections

(tcpvcon requires sysintenals tcpvcon.exe):

Routing table and ARP cache

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

Contents of DNS resolver

(useful for recent web history)

Currently connected Access Point name (WiFi)

Previously connected Access Point names (WiFi)

Current surrounding Access Point names (WiFi)

Extended network adapter configuration information

RDP

RDP Cache images

This can be used to display some fragments of images which a user could see when operating on a server using the Windows RDP. The cache files are located: %USERPROFILE%\AppData\Local\Microsoft\Terminal Server Client\Cache\

These can be parsed using BMC-Tools

RDP (Terminal Services) Activity

RDP (Terminal Services) Configuration

Check if Terminal Services Enabled

Check if one session per user has been modified

Check if port number has been modified

DLL Information

Extract Module (DLL, SYS and EXE) information from WDAC Audit Events

Obtain unsigned DLL information loaded by processes

Obtain DLLs in use by processes

Determine handles on a file

DNS

Obtain TXT records from recently resolved domains

Active Directory

Active Directory Investigation

Note: Live information can be found using DSQuery or Netdom.

NT Directory Services Directory Information Tree File (ntds.dit)

Active Directory Database file containing all schema, domain, configuration information (e.g. users, IP, computers, domain trusts etc)

  • %SystemRoot%\NTDS\ntds.dit

  • %SystemRoot%\System32\ntds.dit

    • File created only when promoting certain OS to a DC, and seldom used.

Edb.log

10MB transaction log used to store temporary data before it is sent to the ntds.dit database.

  • %SystemRoot%\NTDS\Edb.log

Edbxxxxx.log

Additional transaction log files if the main edb.log file gets larger than 10MB without being flushed to ntds.dit.

  • %SystemRoot%\NTDS\edbxxxxx.log

Edb.chk

Checkpoint file used to determine how much of the transaction logs have been sent to the ntdis.dit database.

  • %SystemRoot%\NTDS\edb.chk

Resx.log/Resx.jrs

Reserved log files in case the hard drive fills up, at which point these files will be used (ideally they should never be used).

  • %SystemRoot%\NTDS\res1.log

  • %SystemRoot%\NTDS\res2.log

Temp.edb

Temporary file to store information during in progress transactions.

  • %SystemRoot%\NTDS\temp.edb

Schema.ini

Initialises the ntds.dit file when the domain controller is created, and is then never used again.

  • %SystemRoot%\NTDS\schema.ini

Investigation of ntds.dit

Obtaining this file can be done using any of the following and also requires the SYSTEM hive to decrypt (note: ntdsutil may not work on older AD servers).

(Output will be under C:\Audit)

ntdsutil

vssadmin

Other ‘less legitimate’ replication methods can be found detailed on the AD Security Blog by Sean Metcalf

Repair the file if required:

Analyzing this file offline can be done with tactics such as: