ID | Technique | Tactic |
---|---|---|
T1546 | Event Triggered Execution | Persistence |
Detection: Windows AD AdminSDHolder ACL Modified
Description
The following analytic detects modifications to the Access Control List (ACL) of the AdminSDHolder object in a Windows domain, specifically the addition of new rules. It leverages EventCode 5136 from the Security Event Log, focusing on changes to the nTSecurityDescriptor attribute. This activity is significant because the AdminSDHolder object secures privileged group members, and unauthorized changes can allow attackers to establish persistence and escalate privileges. If confirmed malicious, this could enable an attacker to control domain-level permissions, compromising the entire Active Directory environment.
Search
1`wineventlog_security` EventCode=5136 ObjectClass=container ObjectDN="CN=AdminSDHolder,CN=System*"
2| 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
3| rex field=old_value max_match=10000 "\((?P<old_values>.*?)\)"
4| rex field=new_value max_match=10000 "\((?P<new_ace>.*?)\)"
5| mvexpand new_ace
6| where NOT new_ace IN (old_values)
7| rex field=new_ace "(?P<aceType>.*?);(?P<aceFlags>.*?);(?P<aceAccessRights>.*?);(?P<aceObjectGuid>.*?);(?P<aceInheritedTypeGuid>.*?);(?P<aceSid>.*?)$"
8| rex max_match=100 field=aceAccessRights "(?P<AccessRights>[A-Z]{2})"
9| rex max_match=100 field=aceFlags "(?P<aceFlags>[A-Z]{2})"
10| lookup msad_guid_lookup guid as aceObjectGuid OUTPUT displayName as ControlAccessRights
11| lookup ace_access_rights_lookup access_rights_string as AccessRights OUTPUT access_rights_value
12| lookup ace_type_lookup ace_type_string as aceType OUTPUT ace_type_value
13| lookup ace_flag_lookup flag_string as aceFlags OUTPUT flag_value as ace_flag_value ``` Optional SID resolution lookups
14| lookup identity_lookup_expanded objectSid as aceSid OUTPUT downLevelDomainName as user
15| lookup admon_groups_def objectSid as aceSid OUTPUT cn as group```
16| lookup builtin_groups_lookup builtin_group_string as aceSid OUTPUTNEW builtin_group_name as builtin_group
17| eval aceType=coalesce(ace_type_value,aceType), aceFlags=coalesce(ace_flag_value,"This object only"), aceAccessRights=if(aceAccessRights="CCDCLCSWRPWPDTLOCRSDRCWDWO","Full control",coalesce(access_rights_value,AccessRights)), aceControlAccessRights=coalesce(ControlAccessRights,aceObjectGuid), user=coalesce(user, group, builtin_group, aceSid)
18| stats min(_time) as _time values(aceType) as aceType values(aceFlags) as aceFlags(inheritance) values(aceControlAccessRights) as aceControlAccessRights values(aceAccessRights) as aceAccessRights values(new_ace) as new_ace values(SubjectLogonId) as SubjectLogonId by ObjectClass ObjectDN src_user user
19| eval aceControlAccessRights=if(mvcount(aceControlAccessRights)=1 AND aceControlAccessRights="","All rights",'aceControlAccessRights')
20| search NOT aceType IN (*denied*,D,OD,XD) AND aceAccessRights IN ("Full control","All extended rights","All validated writes","Create all child objects","Delete all child objects","Delete subtree","Delete","Modify permissions","Modify owner","Write all properties",CC,CR,DC,DT,SD,SW,WD,WO,WP)
21| `windows_ad_adminsdholder_acl_modified_filter`
Data Source
Name | Platform | Sourcetype | Source |
---|---|---|---|
Windows Event Log Security 5136 | Windows | 'xmlwineventlog' |
'XmlWinEventLog:Security' |
Macros Used
Name | Value |
---|---|
wineventlog_security | eventtype=wineventlog_security OR Channel=security OR source=XmlWinEventLog:Security |
windows_ad_adminsdholder_acl_modified_filter | search * |
windows_ad_adminsdholder_acl_modified_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 | 0 * * * * |
Earliest Time | -70m@m |
Latest Time | -10m@m |
Schedule Window | auto |
Creates Notable | Yes |
Rule Title | %name% |
Rule Description | %description% |
Notable Event Fields | user, dest |
Creates Risk Event | True |
Implementation
To successfully implement this search, you ned to be ingesting eventcode 5136
. The Advanced Security Audit policy setting Audit Directory Services Changes
within DS Access
needs to be enabled. Additionally, a SACL needs to be created for the AdminSDHolder object in order to log modifications.
Known False Positives
Adding new users or groups to the AdminSDHolder ACL is not usual. Filter as needed
Associated Analytic Story
Risk Based Analytics (RBA)
Risk Message | Risk Score | Impact | Confidence |
---|---|---|---|
The AdminSDHolder domain object $ObjectDN$ has been modified by $src_user$ | 56 | 80 | 70 |
References
-
https://pentestlab.blog/2022/01/04/domain-persistence-adminsdholder/
-
https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-5136
-
https://learn.microsoft.com/en-us/windows/win32/secauthz/access-control-lists
-
https://medium.com/@cryps1s/detecting-windows-endpoint-compromise-with-sacls-cd748e10950
Detection Testing
Test Type | Status | Dataset | Source | Sourcetype |
---|---|---|---|---|
Validation | ✅ Passing | N/A | N/A | N/A |
Unit | ✅ Passing | Dataset | XmlWinEventLog:Security |
XmlWinEventLog |
Integration | ✅ Passing | Dataset | XmlWinEventLog:Security |
XmlWinEventLog |
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: 4