Detect Spearphishing Attachment in Google Chronicle
Adversaries send targeted spearphishing emails with malicious attachments to gain initial access. Attachments may include Microsoft Office documents with macros, PDFs exploiting reader vulnerabilities, executables disguised with document icons, archive files (ZIP, ISO, IMG) containing LNK or script files, or RTF files exploiting equation editor vulnerabilities. Upon opening the attachment, the adversary's payload exploits a vulnerability or executes directly, typically spawning a child process from the email client or document handler. Common threat actors using this technique include APT28, Lazarus Group, FIN6, Cobalt Group, and Tropic Trooper.
MITRE ATT&CK
- Tactic
- Initial Access
- Technique
- T1566 Phishing
- Sub-technique
- T1566.001 Spearphishing Attachment
- Canonical reference
- https://attack.mitre.org/techniques/T1566/001/
YARA-L Detection Query
rule spearphishing_attachment_office_child_process {
meta:
author = "df00tech"
description = "Detects Office applications spawning suspicious child processes indicative of spearphishing attachment execution (T1566.001)"
severity = "CRITICAL"
priority = "HIGH"
mitre_attack_tactic = "Initial Access"
mitre_attack_technique = "T1566.001"
reference = "https://attack.mitre.org/techniques/T1566/001/"
events:
$e.metadata.event_type = "PROCESS_LAUNCH"
$e.principal.process.file.full_path = /(?i)\\(winword|excel|powerpnt|outlook|mspub|msaccess|onenote|visio|eqnedt32)\.exe$/
$e.target.process.file.full_path = /(?i)\\(cmd|powershell|pwsh|wscript|cscript|mshta|regsvr32|rundll32|certutil|bitsadmin|curl|wget|msbuild|installutil|schtasks|at|wmic|odbcconf|pcalua|cmstp|msiexec|hh)\.exe$/
match:
$e.principal.hostname over 1h
outcome:
$risk_score = max(
if($e.target.process.file.full_path = /(?i)(powershell|pwsh|mshta|wscript|cscript)\.exe$/, 100,
if($e.target.process.file.full_path = /(?i)(certutil|bitsadmin|regsvr32|rundll32|odbcconf|cmstp)\.exe$/, 80, 60))
)
$has_network_ref = max(if($e.target.process.command_line = /(?i)(https?:\/\/|ftp:\/\/|\\\\\\\\)/, 1, 0))
$has_encoded_payload = max(if($e.target.process.command_line = /(?i)(-enc|-encodedcommand|frombase64string|\/e:jscript|\/e:vbscript)/, 1, 0))
$temp_execution = max(if($e.target.process.command_line = /(?i)(\\temp\\|\\appdata\\|\\downloads\\)/, 1, 0))
$child_process = array_distinct($e.target.process.file.full_path)
$parent_process = array_distinct($e.principal.process.file.full_path)
$hostname = array_distinct($e.principal.hostname)
$username = array_distinct($e.principal.user.userid)
condition:
$e
} Chronicle YARA-L 2.0 rule detecting spearphishing attachment execution via PROCESS_LAUNCH events in the UDM model. Matches Office application parent processes (principal) spawning LOLBin or script interpreter child processes (target). Outcome block computes a numeric risk score (100=Critical, 80=High, 60=Medium) and enrichment flags for network references, encoded payloads, and temp-path execution to support triage prioritization.
Data Sources
Required Tables
False Positives & Tuning
- Automated document processing pipelines where Word or Excel templates invoke PowerShell or cmd.exe as part of a scheduled batch conversion workflow.
- Corporate macro policies that allow sanctioned macros to call certutil.exe or bitsadmin.exe for legacy file transfer operations.
- Security product agents that attach to Office processes and spawn child processes (e.g., DLP or data classification tools using msiexec.exe for updates).
Other platforms for T1566.001
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Word Macro Spawning PowerShell (VBA Simulation)
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe. If run from within a Word VBA macro (Tools > Macro > Run), the ParentImage will be winword.exe. Security Event ID 4688 (if command line auditing enabled) will capture the full command line.
- Test 2LNK File Execution Simulating ISO-Delivered Spearphishing
Expected signal: Sysmon Event ID 11: File Created for InvoiceDocument.lnk in %TEMP%. Sysmon Event ID 1: Process Create with Image=cmd.exe, ParentImage=explorer.exe (or the process that invoked Start-Process). The LNK file path in temp directory is a key indicator. Sysmon Event ID 1 will show target command line '/c whoami'.
- Test 3Excel Macro Dropping Script to Disk (Dropper Pattern)
Expected signal: Sysmon Event ID 11: File Created for update_helper.ps1 in %TEMP%. Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing '-ExecutionPolicy Bypass -File' and the temp path. DeviceFileEvents ActionType=FileCreated for the .ps1 file. The combination of file drop to temp + immediate execution is a high-fidelity pattern.
- Test 4Equation Editor Exploitation Simulation (CVE-2017-11882 Pattern)
Expected signal: Sysmon Event ID 1: Process Create with Image=cmd.exe. In real exploitation, ParentImage=eqnedt32.exe (C:\Program Files (x86)\Common Files\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPSVC.EXE launching eqnedt32.exe which spawns cmd.exe). Security Event ID 4688 with cmd.exe command line. For authentic testing, embed this command in an RTF file using a hex editor to trigger via eqnedt32.exe.
References (10)
- https://attack.mitre.org/techniques/T1566/001/
- https://www.microsoft.com/en-us/security/blog/2021/09/15/analyzing-attacks-that-exploit-the-mshtml-cve-2021-40444-vulnerability/
- https://research.checkpoint.com/2021/irans-apt34-returns-with-an-updated-arsenal/
- https://unit42.paloaltonetworks.com/new-threat-actor-group-darkhydrus-targets-middle-east-government/
- https://www.secureworks.com/blog/darktortilla-malware-analysis
- https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/anti-spoofing-protection
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-emailattachmentinfo-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1566.001/T1566.001.md
- https://www.elastic.co/security-labs/embracing-offensive-tooling-building-detections-against-koadic-using-eql
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_office_spawn_susp_process.yml
Unlock Pro Content
Get the full detection package for T1566.001 including response playbook, investigation guide, and atomic red team tests.