Detection rules › Splunk

Executables Or Script Creation In Temp Path

Author
Teoderick Contreras, Splunk
Source
upstream

The following analytic identifies the creation of executables or scripts in temporary file paths on Windows systems. It leverages the Endpoint.Filesystem data set to detect files with specific extensions (e.g., .exe, .dll, .ps1) created in temporary directories (e.g., \windows\Temp, \AppData\Local\Temp). This activity can be significant as adversaries often use these paths to evade detection and maintain persistence. If confirmed malicious, this behavior could allow attackers to execute unauthorized code, escalate privileges, or persist within the environment, posing a significant security threat.

MITRE ATT&CK coverage

TacticTechniques
Defense EvasionT1036 Masquerading

Event coverage

ProviderEvent IDTitle
Sysmon11FileCreate

Stages and Predicates

Stage 1: tstats

tstats WHERE NOT Filesystem.file_path="*\\__PSScriptPolicyTest_*" Filesystem.action="created" Filesystem.file_name IN ("*.bat", "*.cmd", "*.com", "*.dll", "*.exe", "*.js", "*.msc", "*.pif", "*.ps1", "*.sys", "*.vbe", "*.vbs") Filesystem.file_path IN ("*:\\Temp\\*", "*:\\Windows\\Temp\\*", "*\\AppData\\Local\\Temp\\*") BY Filesystem.action, Filesystem.dest, Filesystem.file_access_time, Filesystem.file_create_time, Filesystem.file_hash, Filesystem.file_modify_time, Filesystem.file_name, Filesystem.file_path, Filesystem.file_acl, Filesystem.file_size, Filesystem.process_guid, Filesystem.process_id, Filesystem.user, Filesystem.vendor_product

Stage 2: search

search

Stage 3: search

search

Stage 4: search

search

Stage 5: search

search `macro`

Exclusions

Top-level NOT(...) conjuncts — predicates this rule actively suppresses.

StageFieldKindExcluded values
1TargetFilenameeq"*\\__PSScriptPolicyTest_*"

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Filesystem.actioneq
  • "created" corpus 3 (splunk 3)
Filesystem.file_namein
  • "*.bat" corpus 4 (splunk 4)
  • "*.cmd" corpus 4 (splunk 4)
  • "*.com" corpus 4 (splunk 4)
  • "*.dll" corpus 6 (splunk 6)
  • "*.exe" corpus 7 (splunk 7)
  • "*.js" corpus 5 (splunk 5)
  • "*.msc" corpus 2 (splunk 2)
  • "*.pif" corpus 5 (splunk 5)
  • "*.ps1" corpus 3 (splunk 3)
  • "*.sys" corpus 4 (splunk 4)
  • "*.vbe" corpus 5 (splunk 5)
  • "*.vbs" corpus 5 (splunk 5)
Filesystem.file_pathin
  • "*:\\Temp\\*" corpus 2 (splunk 2)
  • "*:\\Windows\\Temp\\*" corpus 2 (splunk 2)
  • "*\\AppData\\Local\\Temp\\*" corpus 2 (splunk 2)