Get DomainPolicy with Powershell Script Block
Description
The following analytic detects the execution of the Get-DomainPolicy
cmdlet using PowerShell Script Block Logging (EventCode=4104). It leverages logs capturing script block text to identify attempts to obtain the password policy in a Windows domain. This activity is significant as it indicates potential reconnaissance efforts by adversaries or Red Teams to gather domain policy information, which is crucial for planning further attacks. If confirmed malicious, this behavior could lead to detailed knowledge of domain security settings, aiding in privilege escalation or lateral movement within the network.
- Type: TTP
-
Product: Splunk Enterprise, Splunk Enterprise Security, Splunk Cloud
- Last Updated: 2024-05-11
- Author: Teoderick Contreras, Splunk
- ID: a360d2b2-065a-11ec-b0bf-acde48001122
Annotations
Kill Chain Phase
- Exploitation
NIST
- DE.CM
CIS20
- CIS 10
CVE
Search
1
2
3
4
5
`powershell` EventCode=4104 ScriptBlockText ="*Get-DomainPolicy*"
| stats count min(_time) as firstTime max(_time) as lastTime by Opcode Computer UserID EventCode ScriptBlockText
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `get_domainpolicy_with_powershell_script_block_filter`
Macros
The SPL above uses the following Macros:
get_domainpolicy_with_powershell_script_block_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
- ScriptBlockText
- Opcode
- Computer
- UserID
- EventCode
How To Implement
The following Hunting analytic requires PowerShell operational logs to be imported. Modify the powershell macro as needed to match the sourcetype or add index. This analytic is specific to 4104, or PowerShell Script Block Logging.
Known False Positives
Administrators or power users may use this command for troubleshooting.
Associated Analytic Story
RBA
Risk Score | Impact | Confidence | Message |
---|---|---|---|
30.0 | 50 | 60 | powershell process having commandline $ScriptBlockText$ to query domain policy. |
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
- https://github.com/S1ckB0y1337/Active-Directory-Exploitation-Cheat-Sheet
- https://powersploit.readthedocs.io/en/latest/Recon/Get-DomainPolicy/
- https://attack.mitre.org/techniques/T1201/
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: 3