| ID | Technique | Tactic |
|---|---|---|
| T1222.001 | Windows Permissions | Defense Impairment |
| T1484.001 | Group Policy Modification | Defense Impairment |
Detection: Windows AD Suspicious GPO Modification
REMOVED DETECTION
This detection has been removed from the Splunk Threat Research content library and is no longer maintained or supported.
Reason: Detection deprecated due to lack of data and consistency. Research is being done to create potential replacement in a future release.
Removed in version: 5.10.0
If you have any questions or concerns, please reach out to us at research@splunk.com.
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.
Search
1`wineventlog_security` EventCode=5145 ShareName="\\\\*\\SYSVOL" RelativeTargetName IN (*\\ScheduledTasks.xml, *\\Groups.xml, *\\Registry.xml, *\\Services.xml, *\\Scripts\\*) NOT RelativeTargetName=*\\Scripts\\scripts.ini AccessMask=0x2
2| rex field=AccessList max_match=0 "(?P<AccessList>%%\d+)"
3| table _time AccessMask src_ip src_user RelativeTargetName Logon_ID dvc
4| rex field=RelativeTargetName "Policies\\\(?P<gpo_guid>{.*?})\\\(?P<scope>\w+?)\\\(\w+)\\\(?P<folder>\w+)\\\(?P<file>\w+\.\w+)$"
5| 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)
6| appendpipe
7 [
8| map search="search `wineventlog_security` EventCode=5136 ObjectClass=groupPolicyContainer AttributeLDAPDisplayName=gPCMachineExtensionNames $gpo_guid$"
9
10| 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
11
12| rex field=old_value max_match=10000 "(?P<old_values>\{.*?\})"
13
14| rex field=new_value max_match=10000 "(?P<new_values>\{.*?\})"
15
16| rex field=ObjectDN max_match=10000 "CN=(?P<policy_guid>\{.*?\})"
17
18| mvexpand new_values
19
20| where NOT new_values IN (old_values,"{00000000-0000-0000-0000-000000000000}",policy_guid) AND match(new_values, "^\{[A-Z
21|\d]+\-[A-Z
22|\d]+\-[A-Z
23|\d]+\-[A-Z
24|\d]+\-[A-Z
25|\d]+\}")
26
27| lookup msad_guid_lookup guid as new_values OUTPUTNEW displayName as policyType
28
29| eval newPolicy=if(policyType like "%",policyType,new_values)
30
31| stats values(OpCorrelationID) as OpCorrelationID values(newPolicy) as newPolicy by ObjectDN
32
33| rex field=ObjectDN max_match=10000 "CN=(?P<gpo_guid>\{.*?\})"
34
35| fields - ObjectDN]
36
37| 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
38| mvexpand folder
39| where NOT folder IN (newPolicy)
40| `windows_ad_suspicious_gpo_modification_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Windows Event Log Security 5136 | 'XmlWinEventLog' |
'XmlWinEventLog:Security' |
|
| Windows Event Log Security 5145 | 'XmlWinEventLog' |
'XmlWinEventLog:Security' |
Macros Used
| Name | Value |
|---|---|
| wineventlog_security | eventtype="wineventlog_security" OR Channel="security" OR source="XmlWinEventLog:Security" OR source="WinEventLog:Security" |
| windows_ad_suspicious_gpo_modification_filter | `` |
windows_ad_suspicious_gpo_modification_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
| Setting | Value |
|---|---|
| Disabled | true |
| Cron Schedule | N/A |
| Earliest Time | N/A |
| Latest Time | N/A |
| Schedule Window | N/A |
| Creates Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | No |
Implementation
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
References
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | Not Applicable | N/A | N/A | N/A |
| Unit | Not Applicable | N/A | N/A |
N/A |
| Integration | Not Applicable | N/A | N/A |
N/A |
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: GitHub |
Version: 7