Try in Splunk Security Cloud

Description

The following analytic detects the execution of a PowerShell script that modifies the 'TrustedHosts' configuration via EventCode 4104. It leverages PowerShell Script Block Logging to identify commands targeting WSMan settings, specifically those altering or concatenating trusted hosts. This activity is significant as it can indicate attempts to manipulate remote connection settings, potentially allowing unauthorized remote access. If confirmed malicious, this could enable attackers to establish persistent remote connections, bypass security protocols, and gain unauthorized access to sensitive systems and data.

  • Type: TTP
  • Product: Splunk Enterprise, Splunk Enterprise Security, Splunk Cloud

  • Last Updated: 2024-05-20
  • Author: Teoderick Contreras, Splunk
  • ID: bef21d24-297e-45e3-9b9a-c6ac45450474

Annotations

ATT&CK

ATT&CK

ID Technique Tactic
T1021.006 Windows Remote Management Lateral Movement
T1021 Remote Services Lateral Movement
Kill Chain Phase
  • Exploitation
NIST
  • DE.CM
CIS20
  • CIS 10
CVE
1
2
3
4
5
6
`powershell` EventCode=4104  ScriptBlockText = "*WSMan:\\localhost\\Client\\TrustedHosts*" ScriptBlockText IN ("* -Value *", "* -Concatenate *") 
| rename Computer as dest, UserID as user 
| stats count min(_time) as firstTime max(_time) as lastTime by EventCode ScriptBlockText dest user 
| `security_content_ctime(firstTime)` 
| `security_content_ctime(lastTime)` 
| `powershell_remote_services_add_trustedhost_filter`

Macros

The SPL above uses the following Macros:

:information_source: powershell_remote_services_add_trustedhost_filter is a empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Required fields

List of fields required to use this analytic.

  • _time
  • EventCode
  • ScriptBlockText
  • Computer
  • UserID
  • Score

How To Implement

To successfully implement this analytic, you will need to enable PowerShell Script Block Logging on some or all endpoints. Additional setup here https://docs.splunk.com/Documentation/UBA/5.0.4.1/GetDataIn/AddPowerShell#Configure_module_logging_for_PowerShell.

Known False Positives

user and network administrator may used this function to add trusted host.

Associated Analytic Story

RBA

Risk Score Impact Confidence Message
64.0 80 80 a powershell script adding a remote trustedhost on $dest$ .

:information_source: The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

Reference

Test Dataset

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range

source | version: 2