Detect Spearphishing Link in Splunk
Adversaries may send spearphishing emails with a malicious link in an attempt to gain access to victim systems. Unlike spearphishing attachments, this variant embeds URLs in email body text, requiring the recipient to actively click or paste the link into a browser. Clicked links may deliver browser exploits, prompt downloads of malware or scripts, or harvest credentials via convincing login pages. Advanced variants include OAuth consent phishing (abusing OAuth 2.0 authorization flows to steal application access tokens), device code phishing (abusing OAuth 2.0 device authorization grant to obtain persistent tokens), and IDN homograph attacks where lookalike Unicode domains impersonate trusted brands. URLs may also be obfuscated via URL shorteners, integer-format IP addresses (e.g., hxxp://1157586937), or the @ symbol trick. Threat actors including Kimsuky, MuddyWater, BlackTech, LuminousMoth, DarkGate, and Squirrelwaffle have extensively leveraged this technique.
MITRE ATT&CK
- Tactic
- Initial Access
- Technique
- T1566 Phishing
- Sub-technique
- T1566.002 Spearphishing Link
- Canonical reference
- https://attack.mitre.org/techniques/T1566/002/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| eval ParentImage_lower=lower(ParentImage)
| eval Image_lower=lower(Image)
| eval CommandLine_lower=lower(CommandLine)
| eval IsEmailClient=if(match(ParentImage_lower, "(outlook\.exe|thunderbird\.exe|teams\.exe)"), 1, 0)
| eval IsBrowser=if(match(ParentImage_lower, "(msedge\.exe|chrome\.exe|firefox\.exe|iexplore\.exe|opera\.exe|brave\.exe)"), 1, 0)
| eval IsMshtaParent=if(match(ParentImage_lower, "mshta\.exe"), 1, 0)
| eval IsSuspiciousChild=if(match(Image_lower, "(powershell\.exe|pwsh\.exe|cmd\.exe|wscript\.exe|cscript\.exe|mshta\.exe|rundll32\.exe|regsvr32\.exe|msiexec\.exe|certutil\.exe|bitsadmin\.exe|curl\.exe|wget\.exe)"), 1, 0)
| eval IsLegitBrowserSubProc=if(match(CommandLine_lower, "(--type=renderer|--type=utility|--type=gpu-process|--extension-process|nativemessaginghost|microsoftedgeupdate|googleupdate|chromesetup)"), 1, 0)
| where (IsEmailClient=1 OR IsBrowser=1 OR IsMshtaParent=1) AND IsSuspiciousChild=1 AND IsLegitBrowserSubProc=0
| eval DetectionVector=case(
IsEmailClient=1, "EmailClientDirectSpawn",
IsMshtaParent=1, "MshtaChainSpawn",
IsBrowser=1, "BrowserSpawnedSuspiciousProcess",
true(), "Unknown")
| eval RiskScore=case(
IsMshtaParent=1, 90,
IsEmailClient=1, 85,
IsBrowser=1 AND match(Image_lower, "(powershell\.exe|wscript\.exe|cscript\.exe|mshta\.exe)"), 75,
IsBrowser=1, 60,
true(), 50)
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, DetectionVector, RiskScore
| sort - RiskScore, - _time Detects email clients and browsers spawning suspicious child processes via Sysmon Event ID 1 (Process Create). Evaluates ParentImage for email clients (Outlook, Thunderbird, Teams) and browsers (Edge, Chrome, Firefox), then filters for suspicious child processes (PowerShell, cmd.exe, wscript.exe, mshta.exe, regsvr32.exe, certutil.exe). Assigns risk scores: 90 for mshta.exe chains (strong indicator of HTA payload delivery), 85 for email client direct spawns, 75 for browsers spawning scripting interpreters. Filters legitimate browser sub-process types to reduce noise.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Legitimate enterprise software installers triggered by browser downloads (Chrome/Edge spawning msiexec.exe for vendor updates)
- Microsoft Teams or Outlook opening SharePoint links that trigger PowerShell-based document or configuration handlers
- Browser-based virtual desktop clients (Citrix, VMware Horizon) spawning helper binaries through registered protocol handlers
- Security awareness training platforms simulating phishing link behavior with benign payloads
- Developer tooling that opens browser URLs which chain to local build or test scripts
Other platforms for T1566.002
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 1Email Client Spawning PowerShell via Link Handler
Expected signal: Sysmon Event ID 1: Process Create — Image=powershell.exe, CommandLine contains '-WindowStyle Hidden' and 'Net.WebClient' and 'DownloadString'. Sysmon Event ID 3: Network connection attempt to 127.0.0.1:8080 (connection refused). Security Event ID 4688 if command line auditing is enabled. PowerShell ScriptBlock Log Event ID 4104 with full script content.
- Test 2Browser Spawning MSHTA via HTA File Download
Expected signal: Sysmon Event ID 1: Process Create — Image=mshta.exe, ParentImage=msedge.exe (or cmd.exe depending on Edge's open handler). Sysmon Event ID 11: File creation event for df00tech-test.hta in %TEMP%. Security Event ID 4688 for mshta.exe process creation with full command line including path to HTA file.
- Test 3OAuth Device Code Phishing Flow Initiation
Expected signal: Sysmon Event ID 1: Process Create — Image=powershell.exe, CommandLine contains 'devicecode' and 'login.microsoftonline.com'. Sysmon Event ID 3: Network connection to login.microsoftonline.com on port 443. Sysmon Event ID 22: DNS query for login.microsoftonline.com. Azure AD sign-in logs: device code flow request entry visible in non-interactive sign-in logs for the test client_id (04b07795 is the Azure CLI client ID, a well-known public client).
- Test 4Malicious Link Payload Drop Simulation
Expected signal: Sysmon Event ID 11: File creation in %TEMP% for Invoice_2026-03-12.pdf.cmd (double extension with .cmd as final extension). Sysmon Event ID 1: Process Create — Image=cmd.exe, CommandLine references the %TEMP% staged file path, ParentImage=powershell.exe. Security Event ID 4688 for both powershell.exe and cmd.exe. The temporal pattern of PowerShell network activity followed by file creation in staging dir followed by cmd.exe execution matches the hunting query for email client network + file drop correlation.
References (11)
- https://attack.mitre.org/techniques/T1566/002/
- https://us-cert.cisa.gov/ncas/tips/ST05-016
- https://www.mandiant.com/resources/blog/url-obfuscation-schema-abuse
- https://www.microsoft.com/security/blog/2021/07/14/microsoft-delivers-comprehensive-solution-to-battle-rise-in-consent-phishing-emails/
- https://www.secureworks.com/blog/oauths-device-code-flow-abused-in-phishing-attacks
- https://www.netskope.com/blog/new-phishing-attacks-exploiting-oauth-authorization-flows-part-1
- https://www.optiv.com/insights/source-zero/blog/microsoft-365-oauth-device-code-flow-and-phishing
- https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/safe-links-about
- https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-urlclickevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1566.002/T1566.002.md
- https://blog.trendmicro.com/trendlabs-security-intelligence/pawn-storm-abuses-open-authentication-advanced-social-engineering-attacks
Unlock Pro Content
Get the full detection package for T1566.002 including response playbook, investigation guide, and atomic red team tests.