Detect Scripting in CrowdStrike LogScale
Adversaries may use scripts to aid in operations and perform multiple actions that would otherwise be manual. This deprecated technique (now superseded by T1059 Command and Scripting Interpreter) covered adversary use of scripting languages including VBScript, JavaScript, Windows Script Host, batch scripts, and macro-enabled Office documents. Scripts can be used to speed up operations, bypass process monitoring by interacting with the OS at an API level, and enable execution via spearphishing attachments containing malicious macros. Common attack patterns include VBScript/JScript execution via wscript.exe or cscript.exe, malicious Office macros spawning child processes, and batch scripts performing reconnaissance or lateral movement.
MITRE ATT&CK
- Tactic
- Defense Evasion Execution
- Canonical reference
- https://attack.mitre.org/techniques/T1064/
LogScale Detection Query
#event_simpleName = "ProcessRollup2"
| ParentBaseFileName = /(?i)^(winword|excel|powerpnt|outlook|onenote|access|visio)\.exe$/
OR (
FileName = /(?i)^(wscript|cscript)\.exe$/
AND CommandLine = /(?i)(invoke-expression|iex\(|downloadstring|downloadfile|net\.webclient|createobject|shell\.application|shellexecute|wscript\.shell|http:\/\/|https:\/\/|certutil|bitsadmin|\.(?:vbs|vbe|js|jse|wsf|wsh|hta)\b)/
)
OR (
FileName = /(?i)^mshta\.exe$/
AND CommandLine = /(?i)(vbscript:|javascript:|http:\/\/|https:\/\/|\/\/|\\\\)/
)
OR (
FileName = /(?i)^cmd\.exe$/
AND (
ParentBaseFileName = /(?i)^(winword|excel|powerpnt|outlook|onenote|access)\.exe$/
OR (
CommandLine = /(\^\^|&&|\|\|)/
AND CommandLine = /(?i)(certutil|bitsadmin|powershell|wscript|cscript|http)/
)
)
)
| case {
ParentBaseFileName = /(?i)^(winword|excel|powerpnt|outlook|onenote|access|visio)\.exe$/
AND FileName = /(?i)^(wscript|cscript|mshta|cmd|powershell|pwsh|regsvr32|rundll32)\.exe$/ |
DetectionType := "OfficeMacroSpawn";
FileName = /(?i)^(wscript|cscript)\.exe$/
AND CommandLine = /(?i)(invoke-expression|downloadstring|net\.webclient|http:\/\/|https:\/\/|createobject|certutil|bitsadmin)/ |
DetectionType := "SuspiciousScriptInterp";
FileName = /(?i)^mshta\.exe$/ |
DetectionType := "MshtaAbuse";
FileName = /(?i)^cmd\.exe$/ |
DetectionType := "CmdBatchAbuse";
* | DetectionType := "Unknown"
}
| table([_time, ComputerName, UserName, FileName, CommandLine, ParentBaseFileName, ParentCommandLine, DetectionType])
| sort(field=_time, order=desc) Detects T1064 scripting abuse in CrowdStrike Falcon LogScale using ProcessRollup2 endpoint telemetry. Applies regex pattern matching across four detection branches: Office application macro spawns of script interpreters (parent-child file name matching), suspicious wscript.exe/cscript.exe invocations with download or COM object command line patterns, mshta.exe loading remote or protocol-handler scripts, and cmd.exe executing obfuscated LOLBin chains or spawned by Office applications. Uses LogScale case expressions for detection type classification and structured tabular output for analyst triage.
Data Sources
Required Tables
False Positives & Tuning
- Office-integrated automation workflows in financial or legal environments where Excel macros call cscript.exe to execute VBScript-based reporting, data transformation, or Lotus Notes integration scripts
- Managed service provider tooling that wraps cmd.exe execution with certutil for SHA256 hash verification during endpoint software installation and patching workflows
- Internal HTML applications (.hta files) served on corporate intranet that mshta.exe loads via http:// or https:// addresses as legacy enterprise web portals or configuration dashboards
Other platforms for T1064
Testing Methodology
Validate this detection against 5 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 1VBScript Download Cradle via wscript.exe
Expected signal: Sysmon Event ID 1: Process Create with Image=wscript.exe, CommandLine referencing df00tech_test.vbs. Sysmon Event ID 3: Network connection attempt to 127.0.0.1:8080 from wscript.exe (connection will fail). Sysmon Event ID 11: File creation of df00tech_test.vbs in %TEMP%.
- Test 2JScript Execution via cscript.exe with Shell Command
Expected signal: Sysmon Event ID 1: Process Create for cscript.exe with CommandLine referencing df00tech_shell.js. Sysmon Event ID 1 (child): cmd.exe spawned by cscript.exe with 'whoami' command. Sysmon Event ID 11: Output file creation in %TEMP%.
- Test 3MSHTA Remote HTA Execution
Expected signal: Sysmon Event ID 1: Process Create with Image=mshta.exe, CommandLine='mshta.exe http://127.0.0.1:8080/df00tech_test.hta'. Sysmon Event ID 3: Network connection attempt to 127.0.0.1:8080 (will fail — no listener). The process creation event fires regardless of connection success.
- Test 4Simulated Office Macro Child Process (cmd.exe spawned from Word context)
Expected signal: Sysmon Event ID 1: powershell.exe process create followed by cmd.exe child process. Security Event ID 4688 (if command line auditing enabled) for both processes. To fully test the OfficeMacroSpawn detection branch, the test would need to originate from a running winword.exe process — this simulation exercises the cmd.exe execution and output paths.
- Test 5VBScript Inline Execution via mshta vbscript: Protocol
Expected signal: Sysmon Event ID 1: Process Create with Image=mshta.exe, CommandLine containing 'vbscript:Execute'. A dialog box will appear briefly — dismiss it. No network connections or file writes are expected for this test variant.
References (11)
- https://attack.mitre.org/techniques/T1064/
- https://attack.mitre.org/techniques/T1059/
- https://www.uperesia.com/analyzing-malicious-office-documents
- https://blog.crowdstrike.com/deep-thought-chinese-targeting-national-security-think-tanks/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1064/T1064.md
- https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688
- https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/process_creation
- https://www.fireeye.com/blog/threat-research/2019/10/staying-hidden-on-the-endpoint-evading-detection-with-shellcode.html
- https://lolbas-project.github.io/lolbas/Binaries/Mshta/
- https://github.com/mandiant/OfficeMalScanner
Unlock Pro Content
Get the full detection package for T1064 including response playbook, investigation guide, and atomic red team tests.