- Identifying Suspicious Processes
- Identifying Suspicious Network Activity
- Identifying Suspicious Services
- Identifying Suspicious Registry ASEPs/Autostart Folders
- Identifying Suspicious Account Activity
- Identifying Suspicious Scheduled Tasks
- Identifying Suspicious Log Entries
- Identifying Suspicious SMB Activity
- Miscellaneous
- C:> taskmgr.exe = invokes the Task Manager GUI.
- C:> tasklist = Displays a list of currently running processes on the local computer or on a remote computer.
- C:> tasklist /v = Displays verbose task information in the output. ( PID , memory usage status, User name)
- C:> tasklist /m = Lists all tasks with PID and DLL modules loaded that match the given pattern name. If the module name is not specified, this option displays all modules loaded by each task.
- C:> tasklist /fi = Specifies the types of processes to include in or exclude from the query.examples below
- C:> tasklist /v /fi "pid eq 555"
- C:> tasklist /m /fi "pid eq 555"
- C:> Tasklist /v | findstr Teams.exe
- C:> Tasklist /m | findstr Teams.exe
Wmic is even more powerful than Tasklist.
- C:> wmic process list brief = brief list of the currently running processes
- C:> wmic process list full = full list of the currently running processes
- C:> wmic process get Name,Commandline,Description,ProcessID,ParentProcessID = specify only which fields you want to grab
- C:> wmic process where processid=600 list full = full info of the process running with pid=600
- C:> wmic process where Name=Teams.exe get ProcessID,ParentProcessID = full list of the process running with Name=teams.exe but return only the Pid and Ppid values
- C:> wmic process where ProcessID=555
Watch out for:
- Is this a new or unrecognized process? ( ideally you would want to cross reference your findings with a baseline image -if you have. It will make the whole task of identifying what stands out from "normal activity" easier)
- Is the name of the Process random-looking ( e.g hJoIuG.exe or whatever)
- Does the new/suspicious process has a name that is similar to a legit process? e.g sCvhost instead of sVChost
- Is it unsigned? ( especially for microsoft since the sign pretty much everything)
- Does the process has a digital signature that doesn't match the identified publisher? ( stolen developers digital key)
- Is it running from a non-standard path ( e.g C:\Temp , C:\Downloads , C:\Music etc)
- Is the parent suspicious ( child process might be legit but parent process not)
- Is the Parent-Child relationship suspicious? ( e.g lsass.exe spawning a cmd.exe or IEX spawning a Powershell.exe etc)
- Is the process tied to suspicious activity? ( e.g a process communicating with well known malicious IP/URL/host/domain etc)
- Encoded in Base64 ?
- A process can be used for benign and malicious purposes at the same time. ( e.g PSEXEC )
- Suspicious does not necessarily mean Malicious.
- Most processes start by the SYSTEM,LOCAL SERVICE or NETWORK SERVICE accounts.keep that in mind.
- C:> netstat -abno ( this is pretty much all you need)
- C:> netstat -abno -n 5 = Automatically refresh the output every 5 seconds.
-n = addresses and port numbers are expressed numerically and no attempt is made to determine names. -a = Displays all active TCP connections and the TCP and UDP ports on which the computer is listening -b = shows the EXE using that port and the DLLs that it has loaded to interact with that port. -o = shows the owner ProcessID associated with the port
You can redirect the outpout into a .txt file if it helps you analyze the results better e.g netstat -abno > C:\Users\McL0vin\Desktop\netstat.txt
Watch out for:
- Network activity that is abnormal for the associated Process (e.g Notepad outbound/inbound connections to a Public IP etc)
- Network activity that is abnormal for your environment/Business Unit/Organization ( e.g lots of traffic during weekends, late hours, holidays etc, long running HTTP/HTTPS sessions etc) ( 2 ways to spot this kind of activity- either have a baseline image of Business as usual activity or know VERY WELL your environment/org/BU)
- Network activity from/to well known Malicious IPs/Domains/URLs/Hosts ( leverage Threat Intel & OSINT to identify those IOCs e.g alienvault , abuseipdb , virustotal, hybrid-analysis)
- services.msc = spawns the services control panel GUI . shows various services and their Description, Status, Startup Type, Log on as. shows ALL services (running/not running)
- net start = shows a list of ONLY running services.
- sc query | more = vast amount of information for each service . can be chaotic. ONLY running services
- tasklist /svc = shows which services are running out of each process on your system along with their PIDs. maps running processes to services ( maps services-to-processes)
Watch out for:
- New services / Deleted services / Stopped Services ( ideally you would want to cross reference your findings with a baseline image -if you have. Otherwise talk with your Sys Admins. )
- Path to Executable looks abnormal( run services.msc --> right click on a service --> Properties)
Windows has numerous registry and file locations that can be used to start software without a user taking a specific action.These locations are called Autostart Extensibility Points (ASEPs).
The majority of malware manipulates the same registry keys in order to establish persistence and survive a reboot.Those are:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
HKEY_CURENT_USER\Software\Microsoft\Windows\CurrentVersion\Run HKEY_CURENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce HKEY_CURENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
- C:> regedit = spawns the Registry Editor -GUI to manually browse through the registry hive/keys
- C:> reg query HKLM\Software\microsoft\windows\currentversion\run = displays the settings for the specified registry key
- C:> taskmgr.exe = Task Manager GUI. go to Startup tab
These registry keys are responsible for executing programs when a system boots up or when a user logs on (Easiest way to establish persistence.Usually attackers map their backdoors there in order to survive reboot)
Autostart folders associated with users.These programs are automatically invoked each time the given user logs on to the system and are sometimes altered by malware
- C:> dir \s \b "C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup = lists the contents of a user's autostart folder
- C:> start msconfig.exe = spawns a small GUI that displays Startup selection, Boot location/options , startup items
- C:> wmic startup list full = displays autostart programs.
- Right click on Tray bar --> Task Manager --> Startup = displays a GUI with autostart programs and info such as Name, Publisher, Status.
Watch out for:
- c:> lusrmgr.msc = spawns a GUI which can be used to check the users and groups defined on the machine
- C:> net user = displays a list of users
- C:> net localgroup administrators = shows who is in the group you specify ( in that case accounts in the administrators group)
Watch out for:
- C:> schtasks = shows scheduled tasks and details about them such as Folder, Task Name, Next Run Time and Status (can be chaotic depending on your environment . you can export it to a .txt file for easier reading or use | findstr if you know what you are looking for )
- C:> taskschd.msc = brings up the Task Scheduler GUI.lots of info such as triggers,actions,conditions etc. much easier to work with
- PS C:> Get-ScheduledTask = Powershell commands that lists scheduled taks on the system with info about Taskpath,Taskname,State.
- PS C:> Get-ScheduledTask -TaskName "THIS IS SPARTA" if you know the Taskname of the scheduled task you are looking for, use this
Watch out for:
1)Unusual scheduled tasks ( especially those that run as SYSTEM, as a user in administrators group or have a blank username) 2)Scheduled Tasks
- Cl>eventvwr.msc = spawns the GUI Event Viewer ( the most eye-friendly way lol)
- C:> wevtutil qe Security /f:text = inspect the Windows EveNt Logs category you specified(in this case Security) . can be chaotic, you can output the content by using > C:\xx\xx\something.txt if you want.
- PS C:> Get-EventLog -LogName Security | Format-List -Property * = the equivalent of the above command but in Powershell this time and with a cooler blue background ( lol)
Watch out for:
- Any indication that event log service was stopped
- Any indication that Windows File Integrity Checker ( Windows File Protection) was disabled
- Large number of failed logons about a specific account following a successful logon for that account
- Small number of failed logons across many accounts ( Password Spray Attack) ( usually between 1-3 password tries per account to avoid account lockout threshold)
- Large number of failed logons for a specific account ( Brute Force Password Attack)
When your machine is acting as a client and want to see the outbound SMB activity
- C:> net use = displays the target machine and the share to which you are connected
- C:> net use \192.168.1.1 /del = drops the SMB session
- C:>net use * /del = drops all outbound SMB sessions
When your machine is acting as a server and want to see the inbound SMB activity
- C:>net session = list the inbound sessions
- C:>net session \192.168.1.1 /del = drops the inbound SMB session
Alternatively you can run via cmd compmgmt.msc -> navigate to "Shared forlders" and there you can see Shares,Sessions and Open files
Watch out for:
- The ability to drop individual SMB sessions (either inbound or outbound) can be useful because this can temporarily stop an attacker from using the SMB session. This way you can buy some time or interrupt a data exfiltration in progress.
- Don't expose your TCP/UDP 135,136,137,138,139,445 ports to the internet. Shut them down or if there is a legit business purpose put them behind firewalls with ACLs enforcing access to authorized IPs only.
- most of them time SMB traffic is between a client and a Server.if you see client-to-client smb activity or excessive server-to-server smb activity without a valid business purpose,then that should be investigated.
Get hashes
- C:> certutil -hashfile malfile.exe MD5 = Calculates the MD5 Hash of a file on Windows.
- PS C:> Get-FileHash -Algorithm MD5 malfile.exe - Calculates the MD5 hash of a file on Windows leveraging powershell.
Detect alternate data streams
- C:> DIR /r = look for alternate data streams.
- PS :> Get-Item * -Stream * = look for alternate data streams with Powershell.
- PS:> Get-ChildItem -recurse | ForEach { Get-Item $_.Filename -stream * } | Where stream -ne ':$DATA' = search all subdirectories for ADS.
Collect Metadata on files
Use exiftool for Windows.Watch out for Size,Timestamps ( Access,Creation,Modification),File type and File Type extension(It's pretty common for attackers to change the extension of their scripts into something trivial such as .bmp / .jpg etc in order to avoid detection),File permissions etc
DeepBlueCLI
DeepBlueCLI - a PowerShell Module for Threat Hunting via Windows Event Logs. It can work with the below Windows event logs:
- Windows Security
- Windows System
- Windows Application
- Windows PowerShell
- Sysmon
- More info see: https://github.com/sans-blue-team/DeepBlueCLI
Regshot = snapshot tool for Windows.Allows you to record a snapshot of the registry and optionally file system at two points in time and then highlights the differences between the two. Provides a high level summary of the changes,showing registry keys that were added/deleted/modified as wel as any files that were added/deleted/modified Super easy to run in 5 steps
- Start Regshot and configure the options.By default Regshot is not going to record file system.You can specifiy that if you want by checking the Scan dir box and stating the directory you are interested in ( C:\ for example)
- Once you are done with the configuration of the tool and you got everything ready take the first snapshot
- Run the malware
- Use Regshot to take a second snapshot
- Once finished , click on Compare and Regshot will give you back the results after a few minutes
TaskManager Procmon / Process Monitor = shows file system,registry,network and process activity in real-time.Ideal for detonating malicious files/scripts in a sandbox and see live the changes on your system Procexplorer / Process Explorer = gives in depth information about running processes Strings = extracts and displays bot ASCII and 16-bit little endian Unicode strings C:> strings malfile.exe TCPView = maps listening TCP/UDP port back to owning processes SRUMdump FTK Imager /Volexity / Volatility (Remember . Most volatile FIRST = RAM . then everything else follows)