Incident Analysis - DNS Exfiltration
Date: Sep 12, 2026
Tags: SOC Digital Forensics Endpoint Security Threat Hunting Log Correlation Process Causality MITRE ATTACK SIEM DNS Wazuh Sysmon PowerShell Windows
I. Executive Summary
In previous lab entries, I utilized Wazuh to aggregate network, endpoint, and application telemetry. To test these detection capabilities, I investigated a simulated, multi-stage DNS exfiltration incident on a Windows endpoint.
I correlated the events on Wazuh to track the adversary's abuse of Windows binaries. The alerts also guided me in collecting forensic evidence and breaking down the complete attack chain from the initial phishing lure to data exfiltration and persistence.
II Attack Chain Overview (MITRE ATT&CK)
| Tactics | Technique | Implementation Summary |
|---|---|---|
| Initial Access | Phishing (T1566) | Utilized phishing campaign to lure the target into downloading and opening the Q3_Bonus_Payout.pdf.lnk |
| Execution | PowerShell (T1059.001) | Utilized PowerShell to execute the attack chain. |
| Stealth | Double File Extension (T1036.007) | Masqueraded the .lnk payload by using double file extension .pdf.lnk. |
| Command Obfuscation (T1027.010) | Obfuscated some commands with Base64 then decoded it during execution. |
|
| File Deletion (T1070.004) | Removed the main exfiltration payload after it was executed. | |
| Discovery | System Owner/User Discovery (T1033) | Used whoami to identify the currently logged in user. |
| System Network Configuration Discovery (T1016) | Used ipconfig /all to look for network configuration such as IP and MAC address. |
|
| Collection | Automated Collection (T1119) | Used Get-ChildItem -Recurse to get the list of .csv files on the specified folder. |
| Archive via Utility (T1560.001) | Compressed all .csv files into a single .zip file before exfiltration. |
|
| Local Data Staging (T1074.001) | Staged the archived data on the user's Temp folder. |
|
| Exfiltration | Automated Exfiltration (T1020) | Looped Resolve-DnsName to perform exfiltration |
| Data Transfer Size Limits (T1030) | Set the Base64 data payload to 45-character chunks per label staying within 63-character FQDN label limit. |
|
| Exfiltration Over Alternative Protocol (T1048) | Exfiltrated the data using DNS protocol by performing NULL resource record type queries |
|
| Persistence | Boot or Logon Autostart Execution (T1547) | Modified the registry HKCU\...\Run to run a command on user login. |
III. Incident Analysis and Alert Correlation
3.1 Initial Access
The attacker used a GitHub Repository to host their malicious staging and exfiltration scripts. The attack chain started when the victim opened a disguised shortcut file (Q3_Bonus_Payout.pdf.lnk), likely delivered via phishing.
3.2 Execution Chain
After the user opened Q3_Bonus_Payout.pdf.lnk, a series of PowerShell scripts executed in the background, ultimately leading to data exfiltration and persistence.
- Phase 1 - Staging
- Downloads the main payload (
exfil.ps1) to the disk and executes it in a new process. - Deletes
exfil.ps1from the disk to evade detection once execution is completed.
- Downloads the main payload (
- Phase 2 - Exfiltration
- Collects all
.csvfiles in the specified path and compresses them into a single.ziparchive. - Encodes the
.ziparchive into Base64 strings and exfiltrates the data in chunks using DNS queries.
- Collects all
- Phase 3 - Discovery & Persistence
- Executes
whoamiandipconfig /allto gather host and network information. - Adds a registry key (
HKCU\...\Run) that triggers a hidden PowerShell task upon user login.
- Executes
IV. Findings
- The adversary used a masqueraded
.lnkshortcut file delivered likely via phishing, which initiated the attack upon user interaction. - The threat actor initiated the stager in memory while
exfil.ps1was saved on disk. They obfuscated some payloads with Base64 encoding, and deleted artifacts from the disk after the attack was executed. - Host reconnaissance and collection were highly targeted. The script specifically enumerated and compressed
.csvfiles located within the user's~\Documents\Data\Datasetsdirectory, limiting the immediate blast radius to that specific dataset. - The endpoint transmitted encoded data through DNS queries to the external domain by chunking the compressed
.zipfile into Base64 strings and tunneling it through DNSNULLqueries. - The attacker deployed persistence by modifying the
HKCU\...\Runregistry key, ensuring their payload would re-execute upon subsequent user login.
V. Lessons Learned
- Wazuh cannot flag every malicious event, defenders must also be able to investigate events that do not generate alerts by using the context available across logs, processes, and endpoint artifacts.
- Cyber attacks usually goes through multiple phases to avoid detections and perform advanced exploitations, these also create multiple opportunities for defenders to thwart the intrusion and prevent further compromise.
- Attackers can use
sleepto delay malware executions to prevent noticeable security alert spikes and closely tied alerts. This requires the defenders to rely onPID/PPID/GUIDto map process execution chains. - PowerShell Script Block Logging (4104) was able to capture a Base64-encoded payload (collection and archiving) after it was decoded during execution.











