Detection rules › Splunk

Executable Create Script Process (Sysmon)

Group by
_time, command_line, host
Source
github.com/anvilogic-forge/armory

A BAT file is a DOS batch file used to execute commands with the Windows Command Prompt (cmd.exe), this usecase will detect common scripting type like bat, sh, and ps1 with an executable parent

MITRE ATT&CK coverage

References

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

id: '1116.1192'
title: Executable Create Script Process
description: 'A BAT file is a DOS batch file used to execute commands with the Windows
  Command Prompt (cmd.exe), this usecase will detect common scripting type like bat,
  sh, and ps1 with an executable parent. -- Threat Actor Association: APT28 (aka.Fancy
  Bear, Fighting Ursa, Forest Blizzard, Pawn Storm, TA422, STRONTIUM), APT29/Nobelium/Cozy
  Bear, APT31, APT35/Phosphorus/Magic Hound, APT41, APT43, Blind Eagle/APT-C-36, FIN8,
  Gamaredon Group/Shuckworm, GoldenJackal, Karakurt, Mustang Panda (aka. Stately Taurus//Earth
  Preta/BRONZE PRESIDENT/TA416/RedDelta), Redfly, TA413, UAC-0057 (GhostWriter), Vice
  Society, Volt Typhoon, Winter Vivern, Witchetty, Wizard Spider -- Software Association:
  ALPHV/BlackCat, AvosLocker, Bazarloader, BianLian, Black Basta, Blackbyte, Clop,
  Conti, Dharma, Emotet, Hive, LV, Prestige, PYSA/Mespinoza, Quantum, Rhysida, Royal,
  Snatch, Vice Society, TargetCompany, Trigona, XingLocker, Zloader - Atomics T1547.001
  Test#6 - #TrendingThreat #Russia #Ukraine'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_sysmon` EventCode=1 (TERM("exe") AND
  (TERM(".bat") OR TERM(".ps1") OR TERM(".sh"))) | regex process_name="(?i)\w+\.(exe)"|
  regex process="(?i)\w+\.(bat|ps1|sh)" | table _time, host, user, signature_id, dest_port,
  process, process_name, parent_process_name, parent_process | bin span=1s | stats
  values(*) as * by _time, host, process | eventstats c(process) as c_process | where
  c_process<10 '
techniques:
- execution:command and scripting interpreter
- exfiltration:automated exfiltration
- execution:command and scripting interpreter:windows command shell
- collection:automated collection
technique_id:
- T1059
- T1020
- T1059.003
- T1119
data_category:
- Windows Sysmon
references:
- https://www.fireeye.com/blog/threat-research/2016/05/targeted_attacksaga.html

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_sysmon` EventCode=1 (TERM("exe") AND (TERM(".bat") OR TERM(".ps1") OR TERM(".sh")))

Stage 2: regex

| regex process_name="(?i)\w+\.(exe)"

Stage 3: regex

| regex process="(?i)\w+\.(bat|ps1|sh)"

Stage 4: table

| table _time, host, user, signature_id, dest_port, process, process_name, parent_process_name, parent_process

Stage 5: bucket

| bin span=1s

Stage 6: stats

| stats values(*) as * by _time, host, process

Stage 7: eventstats

| eventstats c(process) as c_process

Stage 8: where

| where c_process<10

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 1 corpus 241 (splunk 225, kusto 15, elastic 1)
field:"EventID" kind:eq value:"1"
c_processlt
  • 10 corpus 2 (splunk 2)
field:"c_process" kind:lt value:"10"
processregex_match
  • "(?i)\w+.(bat|ps1|sh)" corpus 3 (splunk 3)
field:"CommandLine" kind:regex_match
process_nameregex_match
  • "(?i)\w+.(exe)"
field:"process_name" kind:regex_match

Search terms

These SPL tokens match against raw event text.

StageTerm
1"exe"
1".bat"
1".ps1"
1".sh"