From 74210a9efaef034f5d498f2be50162822b2b4f0f Mon Sep 17 00:00:00 2001 From: Michael Haag <5632822+MHaggis@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:30:21 -0600 Subject: [PATCH 1/2] broken out Impacket - smbexec, wmiexec --- ...ateral_movement_commandline_parameters.yml | 2 +- ...ovement_smbexec_commandline_parameters.yml | 65 +++++++++++++++++ ...ovement_wmiexec_commandline_parameters.yml | 72 +++++++++++++++++++ 3 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml create mode 100644 detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml diff --git a/detections/endpoint/impacket_lateral_movement_commandline_parameters.yml b/detections/endpoint/impacket_lateral_movement_commandline_parameters.yml index f13537da7d..5fe55839a2 100644 --- a/detections/endpoint/impacket_lateral_movement_commandline_parameters.yml +++ b/detections/endpoint/impacket_lateral_movement_commandline_parameters.yml @@ -47,7 +47,7 @@ tags: asset_type: Endpoint confidence: 70 impact: 90 - message: Suspicious command line parameters on $dest may represent a lateral movement + message: Suspicious command line parameters on $dest$ may represent a lateral movement attack with Impackets tools mitre_attack_id: - T1021 diff --git a/detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml b/detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml new file mode 100644 index 0000000000..4408f51b06 --- /dev/null +++ b/detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml @@ -0,0 +1,65 @@ +name: Impacket Lateral Movement smbexec CommandLine Parameters +id: bb3c1bac-6bdf-4aa0-8dc9-068b8b712a76 +version: 1 +date: '2023-04-25' +author: Michael Haag, Splunk +status: production +type: TTP +data_source: +- Sysmon Event ID 1 +- Windows Security 4688 +description: This analytic focuses on identifying suspicious command-line parameters commonly associated with the use of Impacket wmiexec.py. Impacket is a set of Python classes designed for working with Microsoft network protocols, and it includes several scripts like wmiexec.py, smbexec.py, dcomexec.py, and atexec.py that enable command execution on remote endpoints. These scripts typically utilize administrative shares and hardcoded parameters, which can serve as signatures to detect their usage. Both Red Teams and adversaries may employ Impacket tools for lateral movement and remote code execution purposes. By monitoring for these specific command-line indicators, the analytic aims to detect potentially malicious activities related to Impacket tool usage. +search: '| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where Processes.process_name=cmd.exe by Processes.dest Processes.user Processes.parent_process_name Processes.process_name Processes.process Processes.process_id Processes.parent_process_id + | `drop_dm_object_name(Processes)` + | where match(process, "(?i)cmd\.exe\s+\/Q\s+\/c") AND match(process,"(?i)echo\s+cd") AND match(process, "(?i)\\__output") AND match(process, "(?i)C:\\\\Windows\\\\[a-zA-Z]{1,8}\\.bat") AND match(process, "\\\\127\.0\.0\.1\\.*") + | `security_content_ctime(firstTime)` + | `security_content_ctime(lastTime)` | `impacket_lateral_movement_smbexec_commandline_parameters_filter`' +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: Although uncommon, Administrators may leverage Impackets tools + to start a process on remote systems for system administration or automation use + cases. +references: +- https://attack.mitre.org/techniques/T1021/002/ +- https://attack.mitre.org/techniques/T1021/003/ +- https://attack.mitre.org/techniques/T1047/ +- https://attack.mitre.org/techniques/T1053/ +- https://attack.mitre.org/techniques/T1053/005/ +- https://github.com/SecureAuthCorp/impacket +- https://vk9-sec.com/impacket-remote-code-execution-rce-on-windows-from-linux/ +- https://www.microsoft.com/security/blog/2022/01/15/destructive-malware-targeting-ukrainian-organizations/ +tags: + analytic_story: + - Industroyer2 + - Active Directory Lateral Movement + - Prestige Ransomware + - CISA AA22-277A + - Data Destruction + - WhisperGate + asset_type: Endpoint + atomic_guid: [] + confidence: 70 + impact: 90 + message: Suspicious command-line parameters on $dest$ may represent lateral movement using smbexec. + mitre_attack_id: + - T1021 + - T1021.002 + - T1021.003 + - T1047 + - T1543.003 + observable: + - name: dest + type: Endpoint + role: + - Victim + product: + - Splunk Enterprise + - Splunk Enterprise Security + - Splunk Cloud + risk_score: 63 + security_domain: endpoint +tests: +- name: True Positive Test + attack_data: + - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1021.003/impacket/windows-sysmon.log + source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational + sourcetype: xmlwineventlog \ No newline at end of file diff --git a/detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml b/detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml new file mode 100644 index 0000000000..7b8582ece7 --- /dev/null +++ b/detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml @@ -0,0 +1,72 @@ +name: Impacket Lateral Movement WMIExec Commandline Parameters +id: d6e464e4-5c6a-474e-82d2-aed616a3a492 +version: 1 +date: '2023-04-21' +author: Michael Haag, Splunk +status: production +type: TTP +data_source: +- Sysmon Event ID 1 +- Windows Security 4688 +description: This analytic looks for the presence of suspicious commandline parameters + typically present when using Impacket tools. Impacket is a collection of python + classes meant to be used with Microsoft network protocols. There are multiple scripts + that leverage impacket libraries like `wmiexec.py`, `smbexec.py`, `dcomexec.py` + and `atexec.py` used to execute commands on remote endpoints. By default, these + scripts leverage administrative shares and hardcoded parameters that can be used + as a signature to detect its use. Red Teams and adversaries alike may leverage Impackets + tools for lateral movement and remote code execution. +search: '| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where Processes.parent_process_name=wmiprvse.exe by Processes.dest Processes.user Processes.parent_process_name Processes.process_name Processes.process Processes.process_id Processes.parent_process_id + | `drop_dm_object_name(Processes)` + | where match(process, "(?i)cmd\.exe\s+\/Q\s+\/c") AND match(process, "\\\\127\.0\.0\.1\\.*") AND match(process, "__\\d{1,10}\\.\\d{1,10}") + | `security_content_ctime(firstTime)` + | `security_content_ctime(lastTime)`| `impacket_lateral_movement_wmiexec_commandline_parameters_filter`' +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: Although uncommon, Administrators may leverage Impackets tools + to start a process on remote systems for system administration or automation use + cases. +references: +- https://attack.mitre.org/techniques/T1021/002/ +- https://attack.mitre.org/techniques/T1021/003/ +- https://attack.mitre.org/techniques/T1047/ +- https://attack.mitre.org/techniques/T1053/ +- https://attack.mitre.org/techniques/T1053/005/ +- https://github.com/SecureAuthCorp/impacket +- https://vk9-sec.com/impacket-remote-code-execution-rce-on-windows-from-linux/ +- https://www.microsoft.com/security/blog/2022/01/15/destructive-malware-targeting-ukrainian-organizations/ +tags: + analytic_story: + - Industroyer2 + - Active Directory Lateral Movement + - Prestige Ransomware + - CISA AA22-277A + - Data Destruction + - WhisperGate + asset_type: Endpoint + atomic_guid: [] + confidence: 70 + impact: 90 + message: Suspicious command-line parameters on $dest$ may represent lateral movement using wmiexec. + mitre_attack_id: + - T1021 + - T1021.002 + - T1021.003 + - T1047 + - T1543.003 + observable: + - name: dest + type: Endpoint + role: + - Victim + product: + - Splunk Enterprise + - Splunk Enterprise Security + - Splunk Cloud + risk_score: 63 + security_domain: endpoint +tests: +- name: True Positive Test + attack_data: + - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1021.003/impacket/windows-sysmon.log + source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational + sourcetype: xmlwineventlog \ No newline at end of file From 15a8c06208ffb4b1dabbea831e4b038190874d1c Mon Sep 17 00:00:00 2001 From: Michael Haag <5632822+MHaggis@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:05:52 -0600 Subject: [PATCH 2/2] fix --- ...impacket_lateral_movement_smbexec_commandline_parameters.yml | 2 +- ...impacket_lateral_movement_wmiexec_commandline_parameters.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml b/detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml index 4408f51b06..edecf952ec 100644 --- a/detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml +++ b/detections/endpoint/impacket_lateral_movement_smbexec_commandline_parameters.yml @@ -60,6 +60,6 @@ tags: tests: - name: True Positive Test attack_data: - - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1021.003/impacket/windows-sysmon.log + - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1021.002/atomic_red_team/smbexec_windows-sysmon.log source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational sourcetype: xmlwineventlog \ No newline at end of file diff --git a/detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml b/detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml index 7b8582ece7..f104d8b402 100644 --- a/detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml +++ b/detections/endpoint/impacket_lateral_movement_wmiexec_commandline_parameters.yml @@ -67,6 +67,6 @@ tags: tests: - name: True Positive Test attack_data: - - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1021.003/impacket/windows-sysmon.log + - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1021.002/atomic_red_team/wmiexec_windows-sysmon.log source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational sourcetype: xmlwineventlog \ No newline at end of file