Potential Credential Access via DCSync
This rule identifies when a User Account starts the Active Directory Replication Process. Attackers can use the DCSync technique to get credential information of individual accounts or the entire domain, thus compromising the entire domain.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2022/02/08"
3integration = ["system", "windows"]
4maturity = "production"
5updated_date = "2024/10/15"
6min_stack_version = "8.14.0"
7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
8
9[rule]
10author = ["Elastic"]
11description = """
12This rule identifies when a User Account starts the Active Directory Replication Process. Attackers can use the DCSync
13technique to get credential information of individual accounts or the entire domain, thus compromising the entire
14domain.
15"""
16from = "now-9m"
17index = ["winlogbeat-*", "logs-system.*", "logs-windows.*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Potential Credential Access via DCSync"
21note = """## Triage and analysis
22
23### Investigating Potential Credential Access via DCSync
24
25Active Directory replication is the process by which the changes that originate on one domain controller are automatically transferred to other domain controllers that store the same data.
26
27Active Directory data consists of objects that have properties, or attributes. Each object is an instance of an object class, and object classes and their respective attributes are defined in the Active Directory schema. Objects are defined by the values of their attributes, and changes to attribute values must be transferred from the domain controller on which they occur to every other domain controller that stores a replica of an affected object.
28
29Adversaries can use the DCSync technique that uses Windows Domain Controller's API to simulate the replication process from a remote domain controller, compromising major credential material such as the Kerberos krbtgt keys used legitimately for tickets creation, but also tickets forging by attackers. This attack requires some extended privileges to succeed (DS-Replication-Get-Changes and DS-Replication-Get-Changes-All), which are granted by default to members of the Administrators, Domain Admins, Enterprise Admins, and Domain Controllers groups. Privileged accounts can be abused to grant controlled objects the right to DCsync/Replicate.
30
31More details can be found on [Threat Hunter Playbook](https://threathunterplaybook.com/library/windows/active_directory_replication.html?highlight=dcsync#directory-replication-services-auditing) and [The Hacker Recipes](https://www.thehacker.recipes/ad/movement/credentials/dumping/dcsync).
32
33This rule monitors for Event ID 4662 (Operation was performed on an Active Directory object) and identifies events that use the access mask 0x100 (Control Access) and properties that contain at least one of the following or their equivalent Schema-Id-GUID (DS-Replication-Get-Changes, DS-Replication-Get-Changes-All, DS-Replication-Get-Changes-In-Filtered-Set). It also filters out events that use computer accounts and also Azure AD Connect MSOL accounts (more details [here](https://techcommunity.microsoft.com/t5/microsoft-defender-for-identity/ad-connect-msol-user-suspected-dcsync-attack/m-p/788028)).
34
35#### Possible investigation steps
36
37- Identify the user account that performed the action and whether it should perform this kind of action.
38- Contact the account and system owners and confirm whether they are aware of this activity.
39- Investigate other alerts associated with the user/host during the past 48 hours.
40- Correlate security events 4662 and 4624 (Logon Type 3) by their Logon ID (`winlog.logon.id`) on the Domain Controller (DC) that received the replication request. This will tell you where the AD replication request came from, and if it came from another DC or not.
41- Scope which credentials were compromised (for example, whether all accounts were replicated or specific ones).
42
43### False positive analysis
44
45- Administrators may use custom accounts on Azure AD Connect, investigate if it is the case, and if it is properly secured. If noisy in your environment due to expected activity, consider adding the corresponding account as a exception.
46- Although replicating Active Directory (AD) data to non-Domain Controllers is not a common practice and is generally not recommended from a security perspective, some software vendors may require it for their products to function correctly. If this rule is noisy in your environment due to expected activity, consider adding the corresponding account as a exception.
47
48### Response and remediation
49
50- Initiate the incident response process based on the outcome of the triage.
51- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
52- If the entire domain or the `krbtgt` user was compromised:
53 - Activate your incident response plan for total Active Directory compromise which should include, but not be limited to, a password reset (twice) of the `krbtgt` user.
54- Investigate how the attacker escalated privileges and identify systems they used to conduct lateral movement. Use this information to determine ways the attacker could regain access to the environment.
55- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
56- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
57"""
58references = [
59 "https://threathunterplaybook.com/notebooks/windows/06_credential_access/WIN-180815210510.html",
60 "https://threathunterplaybook.com/library/windows/active_directory_replication.html?highlight=dcsync#directory-replication-services-auditing",
61 "https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/security/win_ad_replication_non_machine_account.yml",
62 "https://github.com/atc-project/atomic-threat-coverage/blob/master/Atomic_Threat_Coverage/Logging_Policies/LP_0027_windows_audit_directory_service_access.md",
63 "https://attack.stealthbits.com/privilege-escalation-using-mimikatz-dcsync",
64 "https://www.thehacker.recipes/ad/movement/credentials/dumping/dcsync",
65 "https://www.elastic.co/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry",
66]
67risk_score = 73
68rule_id = "9f962927-1a4f-45f3-a57b-287f2c7029c1"
69setup = """## Setup
70
71The 'Audit Directory Service Access' logging policy must be configured for (Success, Failure).
72Steps to implement the logging policy with Advanced Audit Configuration:
Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policies Configuration > Audit Policies > DS Access > Audit Directory Service Access (Success,Failure)
1"""
2severity = "high"
3tags = [
4 "Domain: Endpoint",
5 "OS: Windows",
6 "Use Case: Threat Detection",
7 "Tactic: Credential Access",
8 "Tactic: Privilege Escalation",
9 "Data Source: Active Directory",
10 "Resources: Investigation Guide",
11 "Use Case: Active Directory Monitoring",
12 "Data Source: System",
13]
14timestamp_override = "event.ingested"
15type = "eql"
16
17query = '''
18any where event.action : ("Directory Service Access", "object-operation-performed") and
19 event.code == "4662" and winlog.event_data.Properties : (
20
21 /* Control Access Rights/Permissions Symbol */
22
23 "*DS-Replication-Get-Changes*",
24 "*DS-Replication-Get-Changes-All*",
25 "*DS-Replication-Get-Changes-In-Filtered-Set*",
26
27 /* Identifying GUID used in ACE */
28
29 "*1131f6ad-9c07-11d1-f79f-00c04fc2dcd2*",
30 "*1131f6aa-9c07-11d1-f79f-00c04fc2dcd2*",
31 "*89e95b76-444d-4c62-991a-0facbeda640c*")
32
33 /* The right to perform an operation controlled by an extended access right. */
34
35 and winlog.event_data.AccessMask : "0x100" and
36 not winlog.event_data.SubjectUserName : (
37 "*$", "MSOL_*", "OpenDNS_Connector", "adconnect", "SyncADConnect",
38 "SyncADConnectCM", "aadsync", "svcAzureADSync", "-"
39 )
40
41 /* The Umbrella AD Connector uses the OpenDNS_Connector account to perform replication */
42'''
43
44
45[[rule.threat]]
46framework = "MITRE ATT&CK"
47[[rule.threat.technique]]
48id = "T1003"
49name = "OS Credential Dumping"
50reference = "https://attack.mitre.org/techniques/T1003/"
51[[rule.threat.technique.subtechnique]]
52id = "T1003.006"
53name = "DCSync"
54reference = "https://attack.mitre.org/techniques/T1003/006/"
55
56
57
58[rule.threat.tactic]
59id = "TA0006"
60name = "Credential Access"
61reference = "https://attack.mitre.org/tactics/TA0006/"
62[[rule.threat]]
63framework = "MITRE ATT&CK"
64[[rule.threat.technique]]
65id = "T1078"
66name = "Valid Accounts"
67reference = "https://attack.mitre.org/techniques/T1078/"
68[[rule.threat.technique.subtechnique]]
69id = "T1078.002"
70name = "Domain Accounts"
71reference = "https://attack.mitre.org/techniques/T1078/002/"
72
73
74
75[rule.threat.tactic]
76id = "TA0004"
77name = "Privilege Escalation"
78reference = "https://attack.mitre.org/tactics/TA0004/"
Triage and analysis
Investigating Potential Credential Access via DCSync
Active Directory replication is the process by which the changes that originate on one domain controller are automatically transferred to other domain controllers that store the same data.
Active Directory data consists of objects that have properties, or attributes. Each object is an instance of an object class, and object classes and their respective attributes are defined in the Active Directory schema. Objects are defined by the values of their attributes, and changes to attribute values must be transferred from the domain controller on which they occur to every other domain controller that stores a replica of an affected object.
Adversaries can use the DCSync technique that uses Windows Domain Controller's API to simulate the replication process from a remote domain controller, compromising major credential material such as the Kerberos krbtgt keys used legitimately for tickets creation, but also tickets forging by attackers. This attack requires some extended privileges to succeed (DS-Replication-Get-Changes and DS-Replication-Get-Changes-All), which are granted by default to members of the Administrators, Domain Admins, Enterprise Admins, and Domain Controllers groups. Privileged accounts can be abused to grant controlled objects the right to DCsync/Replicate.
More details can be found on Threat Hunter Playbook and The Hacker Recipes.
This rule monitors for Event ID 4662 (Operation was performed on an Active Directory object) and identifies events that use the access mask 0x100 (Control Access) and properties that contain at least one of the following or their equivalent Schema-Id-GUID (DS-Replication-Get-Changes, DS-Replication-Get-Changes-All, DS-Replication-Get-Changes-In-Filtered-Set). It also filters out events that use computer accounts and also Azure AD Connect MSOL accounts (more details here).
Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account and system owners and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Correlate security events 4662 and 4624 (Logon Type 3) by their Logon ID (
winlog.logon.id
) on the Domain Controller (DC) that received the replication request. This will tell you where the AD replication request came from, and if it came from another DC or not. - Scope which credentials were compromised (for example, whether all accounts were replicated or specific ones).
False positive analysis
- Administrators may use custom accounts on Azure AD Connect, investigate if it is the case, and if it is properly secured. If noisy in your environment due to expected activity, consider adding the corresponding account as a exception.
- Although replicating Active Directory (AD) data to non-Domain Controllers is not a common practice and is generally not recommended from a security perspective, some software vendors may require it for their products to function correctly. If this rule is noisy in your environment due to expected activity, consider adding the corresponding account as a exception.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- If the entire domain or the
krbtgt
user was compromised:- Activate your incident response plan for total Active Directory compromise which should include, but not be limited to, a password reset (twice) of the
krbtgt
user.
- Activate your incident response plan for total Active Directory compromise which should include, but not be limited to, a password reset (twice) of the
- Investigate how the attacker escalated privileges and identify systems they used to conduct lateral movement. Use this information to determine ways the attacker could regain access to the environment.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
References
Related rules
- Access to a Sensitive LDAP Attribute
- Group Policy Abuse for Privilege Addition
- Scheduled Task Execution at Scale via GPO
- Service Creation via Local Kerberos Authentication
- Startup/Logon Script added to Group Policy Object