Detection rules › Splunk

Impacket atexec.py Temp File Creation (Sysmon)

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

Impacket's atexec.py is a tool designed for executing commands on a target system via the Windows Task Scheduler to run arbitrary commands with the privileges of the account under which the scheduler is running, often providing a method for remote command execution which can be used by attackers during post-exploitation activities. This use case detects the file creation events matching characteristics of those created by Impacket atexec.py.

MITRE ATT&CK coverage

References

Event coverage

ProviderEventTitle
SysmonEvent ID 11FileCreate

Rule body yaml

id: '29738.53741'
title: Impacket atexec.py Temp File Creation
description: Impacket's atexec.py is a tool designed for executing commands on a target
  system via the Windows Task Scheduler to run arbitrary commands with the privileges
  of the account under which the scheduler is running, often providing a method for
  remote command execution which can be used by attackers during post-exploitation
  activities. This use case detects the file creation events matching characteristics
  of those created by Impacket atexec.py.
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=11) OR "<EventID>11<")
  ("\\Windows\\System32\\Tasks\\" "svchost.exe") OR ("\\Windows\\Temp\\" ".tmp" "cmd.exe")
  | regex file_name="^([a-zA-Z]){8}(\.tmp)?$" | table _time, host, user, file_name,
  file_path, process_name | bin span=1s | stats values(*) as * by _time, host '
techniques:
- execution:scheduled task/job
- execution:command and scripting interpreter
- execution:scheduled task/job:scheduled task
- persistence:scheduled task/job:scheduled task
- privilege-escalation:scheduled task/job:scheduled task
- execution:command and scripting interpreter:windows command shell
- defense-evasion:obfuscated files or information
technique_id:
- T1053
- T1059
- T1053.005
- T1059.003
- T1027
data_category:
- Windows Sysmon
references:
- https://u0041.co/blog/post/1
- https://github.com/fortra/impacket/blob/master/examples/atexec.py
- https://labs.withsecure.com/content/dam/labs/docs/WithSecure-Lazarus-No-Pineapple-Threat-Intelligence-Report-2023.pdf
- https://thedfirreport.com/2023/10/30/netsupport-intrusion-results-in-domain-compromise/

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=11) OR "<EventID>11<") ("\\Windows\\System32\\Tasks\\" "svchost.exe") OR ("\\Windows\\Temp\\" ".tmp" "cmd.exe")

Stage 2: regex

| regex file_name="^([a-zA-Z]){8}(\.tmp)?$"

Stage 3: table

| table _time, host, user, file_name, file_path, process_name

Stage 4: bucket

| bin span=1s

Stage 5: stats

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

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
EventCodeeq
  • 11 corpus 23 (splunk 21, kusto 2)
file_nameregex_match
  • "^([a-zA-Z]){8}(.tmp)?$" corpus 2 (splunk 2)

Search terms

Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.

StageTerm
1TERM
1"<EventID>11<"
1"\\Windows\\System32\\Tasks\\"
1"svchost.exe"
1"\\Windows\\Temp\\"
1".tmp"
1"cmd.exe"