Suspicious Command Execution via ComSpec Environment Variable Obfuscation

PremiumReviewedSigma · High · v1
Product
windows
Category
process_creation
Author
HuntRule
Published
2026-09-28
Updated
2026-09-28

ATT&CK techniques

Execution → Defense Evasion
  1. Recon

  2. Resource Dev

  3. Initial Access

  4. Persistence

  5. Priv Esc

  6. Cred Access

  7. Discovery

  8. Lateral Movement

  9. Collection

  10. C2

  11. Exfiltration

  12. Impact

What it detects

This rule detects command lines that reference the delayed-expansion ComSpec variable using the exclamation syntax, an obfuscation Raspberry Robin uses when piping junk-laden files into cmd. Legitimate command lines almost never contain this token, making it a reliable indicator of obfuscated batch execution.

Related detections9 linkedT1027 — drag to rearrange
Suspicious PIF Payload Assembly via copy /b Binary Concatenation
Obfuscated Encoded PowerShell Payload Deployed via Process Execution (via process_creation)
Malicious KB Document Masqueraded Executable Spawned by Script Interpreter via RoKRAT Loader (via process_creation)
Malicious Payload Assembly via MZ Header Prepend and copy Concatenation (via process_creation)
AutoIt Interpreter Executing Script From User-Writable Path (via process_creation)
HijackLoader Staging Artifacts Written to Disk (via file_event)
BabaDeda Loader Payload Storage File Creation (via file_event)
Obfuscated Windows Command Shell Command Line (via process_creation)
Suspicious JScript Execution via NTFS Short Name by Script Host (via process_creation)
Suspicious Command Execution via ComSpec Environment Variable Obfuscation
Pivot detection · T1027 · 9 related

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.