T1064 Google Chronicle · YARA-L

Detect Scripting in Google Chronicle

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/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule t1064_scripting_detection {
  meta:
    author = "Argus Detection Engineering"
    description = "Detects T1064 scripting abuse: Office macro child process spawns, suspicious wscript/cscript arguments, MSHTA remote execution, and obfuscated cmd.exe batch chains"
    severity = "HIGH"
    mitre_attack_tactic = "Execution"
    mitre_attack_technique = "T1064"
    reference = "https://attack.mitre.org/techniques/T1064/"
    version = "1.0"

  events:
    $e.metadata.event_type = "PROCESS_LAUNCH"
    (
      (
        // Branch 1: Office application spawning script interpreters (macro execution)
        re.regex($e.principal.process.file.full_path, `(?i)(winword|excel|powerpnt|outlook|onenote|access|visio)\.exe$`) and
        re.regex($e.target.process.file.full_path, `(?i)(wscript|cscript|mshta|cmd|powershell|pwsh|regsvr32|rundll32)\.exe$`)
      ) or
      (
        // Branch 2: wscript/cscript with suspicious download or COM object arguments
        re.regex($e.target.process.file.full_path, `(?i)(wscript|cscript)\.exe$`) and
        (
          re.regex($e.target.process.command_line, `(?i)(invoke-expression|iex\(|downloadstring|downloadfile|net\.webclient|createobject|shell\.application|shellexecute|wscript\.shell|http:\/\/|https:\/\/|certutil|bitsadmin)`) or
          re.regex($e.target.process.command_line, `(?i)\.(vbs|vbe|js|jse|wsf|wsh|hta)\b`)
        )
      ) or
      (
        // Branch 3: MSHTA loading remote or inline scripts
        re.regex($e.target.process.file.full_path, `(?i)mshta\.exe$`) and
        re.regex($e.target.process.command_line, `(?i)(vbscript:|javascript:|http:\/\/|https:\/\/|\/\/|\\\\)`)
      ) or
      (
        // Branch 4: Cmd.exe with obfuscation patterns or spawned from Office
        re.regex($e.target.process.file.full_path, `(?i)cmd\.exe$`) and
        (
          re.regex($e.principal.process.file.full_path, `(?i)(winword|excel|powerpnt|outlook|onenote|access)\.exe$`) or
          (
            re.regex($e.target.process.command_line, `(\^\^|&&|\|\|)`) and
            re.regex($e.target.process.command_line, `(?i)(certutil|bitsadmin|powershell|wscript|cscript|http)`)
          )
        )
      )
    )

  condition:
    $e
}
high severity high confidence

Chronicle YARA-L 2.0 rule detecting T1064 scripting abuse via UDM PROCESS_LAUNCH events. Uses principal.process (parent) and target.process (child) UDM fields to identify four high-confidence detection branches: Office macro execution via parent-child process relationships, suspicious wscript.exe/cscript.exe command line patterns indicating download or COM object abuse, mshta.exe loading remote or protocol-handler scripts, and cmd.exe executing obfuscated LOLBin chains or spawned by Office applications. The rule uses re.regex() for case-insensitive pattern matching across all branches.

Data Sources

Google Chronicle UDM (Unified Data Model)Windows endpoint telemetry ingested via Chronicle ForwarderSysmon events normalized to UDM via Chronicle parsers

Required Tables

UDM Events (metadata.event_type = PROCESS_LAUNCH)

False Positives & Tuning

  • Legitimate enterprise macros in Excel or Word that call wscript.exe or cscript.exe for automated document processing, ETL integration, or scheduled reporting tasks in finance or operations environments
  • IT asset management or endpoint management tools that spawn cmd.exe from Office applications to collect system inventory or push configuration changes via scripted automation
  • Custom HTA-based internal portals loaded via mshta.exe that reference local intranet URLs matching http:// or https:// patterns or use javascript: navigation handlers
Download portable Sigma rule (.yml)

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.

  1. 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%.

  2. 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%.

  3. 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.

  4. 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.

  5. 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.

Unlock Pro Content

Get the full detection package for T1064 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections