:warning: THIS IS A EXPERIMENTAL DETECTION

This detection has been marked experimental by the Splunk Threat Research team. This means we have not been able to test, simulate, or build datasets for this detection. Use at your own risk. This analytic is NOT supported.

Try in Splunk Security Cloud

Description

This analytic looks for a the creation of potentially harmful GPO which could lead to persistence or code execution on remote hosts. Note, this analyic is looking for the absence of the corresponding 5136 events which is evidence of the GPOs being manually edited (using a tool like PowerView) or potentially missing logs.

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

  • Last Updated: 2023-12-19
  • Author: Dean Luxton
  • ID: 0a2afc18-a3b5-4452-b60a-2e774214f9bf

Annotations

ATT&CK

ATT&CK

ID Technique Tactic
T1484 Domain or Tenant Policy Modification Defense Evasion, Privilege Escalation
T1484.001 Group Policy Modification Defense Evasion, Privilege Escalation
T1222 File and Directory Permissions Modification Defense Evasion
T1222.001 Windows File and Directory Permissions Modification Defense Evasion
Kill Chain Phase
  • Exploitation
NIST
  • DE.CM
CIS20
  • CIS 10
CVE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
`wineventlog_security` EventCode=5145 ShareName="\\\\*\\SYSVOL" RelativeTargetName IN (*\\ScheduledTasks.xml, *\\Groups.xml, *\\Registry.xml, *\\Services.xml, *\\Scripts\\*) NOT RelativeTargetName=*\\Scripts\\scripts.ini AccessMask=0x2  
| rex field=AccessList max_match=0 "(?P<AccessList>%%\d+)"  
| table _time AccessMask src_ip src_user RelativeTargetName Logon_ID dvc  
| rex field=RelativeTargetName "Policies\\\(?P<gpo_guid>{.*?})\\\(?P<scope>\w+?)\\\(\w+)\\\(?P<folder>\w+)\\\(?P<file>\w+\.\w+)$" 
| eval src=if(match(src_ip, "(?i)^fe80:"),dvc,src_ip), folder=case(RelativeTargetName like "%\\Scripts\\%","Scripts",folder="Groups","Local users and groups",1=1,folder) 
| appendpipe 
  [
| map search="search `wineventlog_security` EventCode=5136 ObjectClass=groupPolicyContainer AttributeLDAPDisplayName=gPCMachineExtensionNames $gpo_guid$" 
  
| stats min(_time) as _time values(eval(if(OperationType=="%%14675",AttributeValue,null))) as old_value values(eval(if(OperationType=="%%14674",AttributeValue,null))) as new_value values(OperationType) as OperationType by ObjectClass ObjectDN OpCorrelationID src_user SubjectLogonId 
  
| rex field=old_value max_match=10000 "(?P<old_values>\{.*?\})" 
  
| rex field=new_value max_match=10000 "(?P<new_values>\{.*?\})" 
  
| rex field=ObjectDN max_match=10000 "CN=(?P<policy_guid>\{.*?\})" 
  
| mvexpand new_values 
  
| where NOT new_values IN (old_values,"{00000000-0000-0000-0000-000000000000}",policy_guid) AND match(new_values, "^\{[A-Z
|\d]+\-[A-Z
|\d]+\-[A-Z
|\d]+\-[A-Z
|\d]+\-[A-Z
|\d]+\}") 
  
| lookup msad_guid_lookup guid as new_values OUTPUTNEW displayName as policyType 
  
| eval newPolicy=if(policyType like "%",policyType,new_values) 
  
| stats values(OpCorrelationID) as OpCorrelationID values(newPolicy) as newPolicy by ObjectDN 
  
| rex field=ObjectDN max_match=10000 "CN=(?P<gpo_guid>\{.*?\})" 
  
| fields - ObjectDN] 

| stats values(AccessMask) as AccessMask values(src) as src values(src_user) as src_user values(RelativeTargetName) as RelativeTargetName values(Logon_ID) as Logon_ID values(newPolicy) as newPolicy values(OpCorrelationID) as OpCorrelationID values(folder) as folder values(file) as file by gpo_guid  
| mvexpand folder  
| where NOT folder IN (newPolicy) 
| `windows_ad_suspicious_gpo_modification_filter`

Macros

The SPL above uses the following Macros:

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

Lookups

The SPL above uses the following Lookups:

Required fields

List of fields required to use this analytic.

  • _time
  • OperationType
  • ObjectDN
  • OpCorrelationID
  • src_user
  • AttributeLDAPDisplayName
  • AttributeValue
  • ObjectClass
  • SubjectLogonId
  • DSName

How To Implement

Ingest EventCodes 5145 and 5136 from domain controllers. Additional SACLs required to capture EventCode 5136, see references for further information on how to configure this. The Group Policy - Audit Detailed File Share will need to be enabled on the DCs to generate event code 5145, this event is very noisy on DCs, consider tuning out sysvol events which do not match access mask 0x2.

Known False Positives

When a GPO is manually edited and 5136 events are not logging to Splunk.

Associated Analytic Story

RBA

Risk Score Impact Confidence Message
80.0 100 80 $src_user$ has added new GPO Client Side Extensions $folder$ to the policy $gpo_guid$

: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: 1