name: Windows Command Shell Fetch Env Variables id: 048839e4-1eaa-43ff-8a22-86d17f6fcc13 version: 1 date: '2022-10-27' author: Teoderick Contreras, Splunk status: production type: TTP description: The following analytic identifies a suspicious process command line fetching the environment variables with a non-shell parent process. This technique was seen in qakbot malware where it fetches the environment variable in the target or compromised host. This TTP detection is a good pivot of possible malicious behavior since the command line is executed by a common non-shell process like cmd.exe , powershell.exe and many more. This can also be a good sign that the parent process has a malicious code injected to it to execute this command. data_source: - Sysmon Event ID 1 search: selection1: CommandLine: - '*cmd /c set' - '*cmd.exe /c set' condition: selection1 how_to_implement: To successfully implement this search you need to be ingesting information on process that include the name of the process responsible for the changes from your endpoints into the `Endpoint` datamodel in the `Processes` node. In addition, confirm the latest CIM App 4.20 or higher is installed and the latest TA for the endpoint product. 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 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