Files
splunk-security_content/detections/endpoint/windows_command_shell_fetch_env_variables.yml
2024-07-17 14:41:50 +02:00

83 lines
3.7 KiB
YAML

name: Windows Command Shell Fetch Env Variables
id: 048839e4-1eaa-43ff-8a22-86d17f6fcc13
version: 2
date: '2024-05-28'
author: Teoderick Contreras, Splunk
status: production
type: TTP
description: The following analytic identifies a suspicious process command line fetching
environment variables with a non-shell parent process. It leverages data from Endpoint
Detection and Response (EDR) agents, focusing on command-line executions and parent
process names. This activity is significant as it is commonly associated with malware
like Qakbot, which uses this technique to gather system information. If confirmed
malicious, this behavior could indicate that the parent process has been compromised,
potentially allowing attackers to execute arbitrary commands, escalate privileges,
or persist within the environment.
data_source:
- Sysmon EventID 1
- Windows Event Log Security 4688
- CrowdStrike ProcessRollup2
search: '| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time)
as lastTime from datamodel=Endpoint.Processes where Processes.process = "*cmd /c
set" OR Processes.process = "*cmd.exe /c set" AND NOT (Processes.parent_process_name
= "cmd.exe" OR Processes.parent_process_name = "powershell*" OR Processes.parent_process_name="pwsh.exe"
OR Processes.parent_process_name = "explorer.exe") by Processes.dest Processes.user
Processes.parent_process_name Processes.process_name Processes.process Processes.process_id
Processes.parent_process_id Processes.original_file_name | `drop_dm_object_name(Processes)`
| `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)` | `windows_command_shell_fetch_env_variables_filter`'
how_to_implement: The detection is based on data that originates from Endpoint Detection
and Response (EDR) agents. These agents are designed to provide security-related
telemetry from the endpoints where the agent is installed. To implement this search,
you must ingest logs that contain the process GUID, process name, and parent process.
Additionally, you must ingest complete command-line executions. These logs must
be processed using the appropriate Splunk Technology Add-ons that are specific to
the EDR product. The logs must also be mapped to the `Processes` node of the `Endpoint`
data model. Use the Splunk Common Information Model (CIM) to normalize the field
names and speed up the data modeling process.
known_false_positives: shell process that are not included in this search may cause
False positive. Filter is needed.
references:
- https://twitter.com/pr0xylife/status/1585612370441031680?s=46&t=Dc3CJi4AnM-8rNoacLbScg
tags:
analytic_story:
- Qakbot
asset_type: Endpoint
confidence: 70
impact: 80
message: non-shell parent process has a child process $process_name$ with a commandline
$process$ to fetch env variables in $dest$
mitre_attack_id:
- T1055
observable:
- name: dest
type: Endpoint
role:
- Victim
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
required_fields:
- _time
- Processes.dest
- Processes.user
- Processes.parent_process_name
- Processes.parent_process
- Processes.original_file_name
- Processes.process_name
- Processes.process
- Processes.process_id
- Processes.parent_process_path
- Processes.process_path
- Processes.parent_process_id
risk_score: 56
security_domain: endpoint
tests:
- name: True Positive Test
attack_data:
- data:
https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/qakbot/qbot_wermgr/sysmon_wermgr.log
source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
sourcetype: xmlwineventlog
update_timestamp: true