FaresMorcy
  • Whoami
  • Footprinting Labs
    • Lab - Easy
    • Lab - Medium
    • Lab - Hard
  • Shells & Payloads
    • The Live Engagement
  • Password Attacks
    • Lab - Easy
    • Lab - Medium
    • Lab - Hard
  • SOC Hackthebox Notes & Labs
    • Security Monitoring & SIEM Fundamentals Module
    • Windows Event Logs & Finding Evil Module
    • Introduction to Threat Hunting & Hunting With Elastic Module
    • Understanding Log Sources & Investigating with Splunk Module
      • Introduction To Splunk & SPL
      • Using Splunk Applications
      • Intrusion Detection With Splunk (Real-world Scenario)
      • Detecting Attacker Behavior With Splunk Based On TTPs
      • Detecting Attacker Behavior With Splunk Based On Analytics
      • Skills Assessment
    • Windows Attacks & Defense
      • Kerberoasting
      • AS-REProasting
      • GPP Passwords
      • GPO Permissions/GPO Files
      • Credentials in Shares
      • Credentials in Object Properties
      • DCSync
      • Golden Ticket
      • Kerberos Constrained Delegation
      • Print Spooler & NTLM Relaying
      • Coercing Attacks & Unconstrained Delegation
      • Object ACLs
      • PKI - ESC1
      • Skills Assessment
    • Intro to Network Traffic Analysis Module
    • YARA & Sigma for SOC Analysts Module
      • Developing YARA Rules
      • Hunting Evil with YARA (Windows Edition)
      • Hunting Evil with YARA (Linux Edition)
      • Sigma and Sigma Rules
      • Developing Sigma Rules
      • Hunting Evil with Sigma (Chainsaw Edition)
      • Hunting Evil with Sigma (Splunk Edition)
      • Skills Assessment
  • TryHackme SOC 1
    • TShark
      • TShark: The Basics
      • TShark: CLI Wireshark Features
      • TShark Challenge I: Teamwork
      • TShark Challenge II: Directory
    • Tempest
    • Boogeyman 1
    • Boogeyman 2
    • Boogeyman 3
  • TryHackme SOC 2
    • Advanced Splunk
      • Splunk: Exploring SPL
      • Splunk: Setting up a SOC Lab
      • Splunk: Dashboards and Reports
      • Splunk: Data Manipulation
      • Fixit
    • Advanced ELK
      • Slingshot
    • Threat Hunting
      • Threat Hunting: Foothold
      • Threat Hunting: Pivoting
      • Threat Hunting: Endgame
  • TryHackme Rooms
    • Investigating Windows
    • Splunk 2
    • Windows Network Analysis
  • Powershell Scripting Fundamentals
  • SANS SEC504 & Labs
    • Book one
      • Live Examination
      • Network Investigations
      • Memory Investigations
      • Malware Investigations
      • Accelerating IR with Generative AI
      • Bootcamp: Linux Olympics
      • Bootcamp: Powershell Olympics
    • Book Two
      • Hacker Tools and Techniques Introduction
      • Target Discovery and Enumeration
      • Discovery and Scanning with Nmap
      • Cloud Spotlight: Cloud Scanning
      • SMB Security
      • Defense Spotlight: Hayabusa and Sigma Rules
    • Book Three
      • Password Attacks
      • Cloud Spotlight: Microsoft 365 Password Attacks
      • Understanding Password Hashes
      • Password Cracking
      • Cloud Spotlight: Insecure Storage
      • Multipurpose Netcat
    • Book Four
      • Metasploit Framework
      • Drive-By Attacks
      • Command Injection
      • Cross-Site Scripting
      • SQL Injection
      • Cloud Spotlight: SSRF and IMDS
    • Book Five
      • Endpoint Security Bypass
      • Pivoting and Lateral Movement
      • Hijacking Attacks
      • Establishing Persistence
      • Defense Spotlight: RITA
      • Cloud Spotlight: Cloud Post-Exploitation
  • SANS SEC511 & Labs
    • Resources
      • Primers
      • References
      • Tools
        • Network
        • Elastic Stack
      • Printable Versions
    • Book One
      • Part One
      • Part Two
      • Part Three
    • Book Two
      • Part One
      • Part Two
      • Part Three
      • Part Four
    • Book Three
      • Part One
      • Part Two
      • Part Three
      • Part Four
    • Book Four
      • Part One
      • Part Two
      • Part Three Lab
      • Part Four Lab
    • Book Five
      • Part One Lab
      • Part Two Lab
      • Part Three Lab
  • CyberDefenders
    • XXE Infiltration Lab
    • T1594 Lab
    • RetailBreach Lab
    • DanaBot Lab
    • OpenWire Lab
    • BlueSky Ransomware Lab
    • Openfire Lab
    • Boss Of The SOC v1 Lab
    • GoldenSpray Lab
    • REvil Lab
    • ShadowRoast Lab
    • SolarDisruption Lab
    • Kerberoasted Lab
    • T1197 Lab
    • Amadey Lab
    • Malware Traffic Analysis 1 Lab
    • Insider Lab
    • Volatility Traces Lab
    • FalconEye Lab
    • GitTheGate Lab
    • Trident Lab
    • NerisBot Lab
  • Practical Windows Forensics
    • Data Collection
    • Examination
    • Disk Analysis Introduction
    • User Behavior
    • Overview of disk structures, partitions and file systems
    • Finding Evidence of Deleted Files with USN Journal Analysis
    • Analyzing Evidence of Program Execution
    • Finding Evidence of Persistence Mechanisms
    • Uncover Malicious Activity with Windows Event Log Analysis
    • Windows Memory Forensic Analysis
  • Hackthebox Rooms
    • Campfire-1
    • Compromised
    • Brutus
    • Trent
    • CrownJewel-1
  • WEInnovate Training
    • Weinnovate - Active Directory Task One
    • Build ELK Lab
      • Configure Elasticsearch and Kibana setup in ubuntu
      • Configure Fluent-Bit to send logs to ELK
      • Set up Winlogbeat & Filebeat for log collection
      • Send Logs from Winlogbeat through Logstash to ELK
      • Enable Windows Audit Policy & Winlogbeat
      • Elasticsearch API and Ingestion Pipeline
    • SOAR
      • Send Alerts To Email & Telegram Bot
      • Integrate Tines with ELK
    • SOC Practical Assessment
    • Lumma C2
    • Network Analysis
  • Build ELK Lab
    • Configure Elasticsearch and Kibana setup in ubuntu
    • Configure Fluent-Bit to send logs to ELK
    • Set up Winlogbeat & Filebeat for log collection
    • Send Logs from Winlogbeat through Logstash to ELK
    • Enable Windows Audit Policy & Winlogbeat
    • Elasticsearch API and Ingestion Pipeline
  • Build Home Lab - SOC Automation
    • Install & configure Sysmon for deep Windows event logging
    • Set up Wazuh & TheHive for threat detection & case management
    • Execute Mimikatz & create detection rules in Wazuh
    • Automate everything with Shuffle
    • Response to SSH Attack Using Shuffle, Wazuh, and TheHive
  • Home Lab (Attack & Defense Scenarios)
    • Pass-the-Hash Attack & Defense
    • Scheduled Task Attack & Defense
    • Kerberoasting Attack & Defense
    • Kerberos Constrained Delegation
    • Password Spraying Attack & Defense
    • Golden Ticket Attack & Defense
    • AS-REProasting Attack & Defense
    • DCSync Attack & Defense
  • Home Lab (FIN7 (Carbanak Group) – Point of Sale (POS) Attack on Hospitality Chains)
  • Home Lab (Lumma Stealer)
Powered by GitBook
On this page
  1. SANS SEC511 & Labs
  2. Book Four

Part Four Lab

Lab 4.4 - Merlin Sysmon Analysis

Objectives:

  • Analyze artifacts of an attack using the Merlin post-exploitation framework.

  • Analyze Sysmon DNS logs

  • Gain experience using PowerShell to analyze Windows Event Logs

Challenges:

We previously investigated an exploit involving the Merlin post-exploitation framework and identified several Indicators of Compromise (IoCs), including:

  • e7zzxen3x6.ryanic.com

  • HxuT0y1GjO.exe

Along with the PCAP previously analyzed using Zeek and Wireshark, we also have Windows event logs, including Sysmon logs, from the same compromise.

  1. View suspicious processes in the Sysmon log and determine the SHA256 hash of HxuT0y1GjO.exe

  2. View suspicious DNS queries in the Sysmon log

  3. Determine the date and time of the compromise using Sysmon DNS logs

  4. Determine the name of the file deleted by the malware

1) View suspicious processes in the Sysmon log and determine the SHA256 hash of HxuT0y1GjO.exe

Let's use PowerShell to search for Sysmon Event ID 1 that includes the string "HxuT0y1GjO.exe".

Get-WinEvent @{Path="c:\labs\merlin\Sysmon.evtx"; Id=1} | Where-Object { $_.Properties[10].Value -Match "HxuT0y1GjO.exe" } 
| Select-Object -Property TimeCreated, Id, @{Name="CommandLine"; Expression={$_.Properties[10].Value}} 
| fl

This can also be resolved using Event Log Explorer

Next, let's filter for Event ID 1 and the process HxuT0y1GjO.exe.

SHA256 of HxuT0y1GjO.exe: 730F0988CC88FC95A2809978B2BB3198283234E2A73F557A64E1F4A30BB85F56

2) View suspicious DNS queries in the Sysmon event log:

Let's filter by Event ID 22 in Event Log Explorer.

The first few entries seem suspicious, using the same DNS name analyzed earlier: e7zzxen3x6.ryanic.com. The DNS query was made by svchost.exe.

From a threat-hunting perspective, the most valuable information is often the DNS query (QueryName) and the program making the query (ImageName). Sysmon excels at linking these two.

Let's focus on these two details: the QueryName and ImageName. We'll use a PowerShell script called sysmon-dns.ps1 to extract and display this information from Sysmon EVTX files.

notepad C:\labs\merlin\sysmon-dns.ps1

This code processes Event ID 22 from a specified event log file, extracts specific XML data fields (QueryName and ImageName), converts them to lowercase, and outputs the selected fields for each event.

Note that the sysmon-dns.ps1 script converts both the QueryName and ImageName to lowercase (using ToLower()). This ensures that duplicates are avoided when sorting and using the Get-Unique cmdlet in PowerShell, as it is case-sensitive.

C:\labs\merlin\sysmon-dns.ps1 C:\labs\merlin\Sysmon.evtx | more

We can see that c:\users\ieuser\desktop\autoruns\autoruns64.exe also resolves to e7zzxen3x6.ryanic.com.

Let's look at the unique DNS queries.

C:\labs\merlin\sysmon-dns.ps1 C:\labs\merlin\Sysmon.evtx 
| Select-Object QueryName | Sort-Object QueryName | Get-Unique -AsString | more

This command instructs PowerShell to take the output from sysmon-dns.ps1, extract only the QueryName field, sort it by QueryName, and treat it as a string.

Next, let's see the unique ImageNames.

C:\labs\merlin\sysmon-dns.ps1 C:\labs\merlin\Sysmon.evtx 
| Select-Object ImageName | Sort-Object ImageName | Get-Unique -AsString 

3) Determine the date and time of the compromise using Sysmon DNS logs

Let's open the Sysmon.evtx file in Event Log Explorer, then filter for Event ID 22 and the QueryName e7zzxen3x6.ryanic.com.

The first sign of compromise involving e7zzxen3x6.ryanic.com was detected on September 17, 2021, at 7:38:43 PM.

The malicious file HxuT0y1GjO.exe sent a DNS request to e7zzxen3x6.ryanic.com less than a minute later.

4) Determine the name of the file deleted by the malware.

Let's filter by Event ID 23 (FileDelete) for entries containing the string e7zzxen3x6.ryanic.com.

The IMPHASH (Import Hash) is blank because it applies only to executables; it represents a hash of the DLL names loaded by a process.

Answer: Battlestar.pdf

PreviousPart Three LabNextBook Five

Last updated 4 months ago