Hunting Evil with YARA (Windows Edition)
Overview
Using YARA on Windows systems is effective for identifying threats on disk and in memory.
Connect to Target System:
Launch the target system.
Use RDP to connect with provided credentials.
Hunting for Malicious Executables on Disk
Sample File:
dharma_sample.exelocated inC:\Samples\YARASigma.Hex Analysis: Using HxD to inspect strings like
C:\crysis\Release\PDB\payload.pdbandsssssbsss.YARA Rule Example: Detecting patterns in malicious executables.
rule ransomware_dharma {
meta:
author = "Madhukar Raina"
version = "1.0"
description = "Detect strings from Dharma ransomware"
reference = "https://www.virustotal.com"
strings:
$string_pdb = { 433A5C6372797369735C52656C656173655C5044425C7061796C6F61642E706462 }
$string_ssss = { 73 73 73 73 73 62 73 73 73 }
condition: all of them
}Command to Execute YARA Scan on Files
Detected Files:
pdf_reader.exe,microsoft.com,check_updates.exe,KB5027505.exe.
Hunting for Malware in Running Processes
Target Process: Example with
meterpretershellcode injection.YARA Rule for Metasploit Meterpreter:
Scanning Active Processes
Result: Detects shellcode in process PID 9084.
Hunting for Evil Within ETW Data with YARA
Key ETW Providers
Microsoft-Windows-Kernel-Process: Tracks process activities.
Microsoft-Windows-Kernel-File: Monitors file operations.
Microsoft-Windows-DNS-Client: Logs DNS activity (useful for C2 detection).
YARA and SilkETW Integration Example
PowerShell ETW Provider:
YARA Rule for PowerShell Strings:
DNS Client Provider:
YARA Rule for Wannacry Domain:
Last updated