Active Directory / ARTICLE

Detecting DCSync

بسم الله والصلاة والسلام على رسول الله
اللهم علمنا ما ينفعنا وانفعنا بما علمتنا وقنا عذاب النار

Attack Side

https://anas404.gitbook.io/anas404/active-directory/ad-attack/dcsync


Intro

imagine the attacker has Domain Admin credentials. Maybe they cracked a Kerberoasted service account that happened to be a Domain Admin, or they dumped LSASS on a machine where a Domain Admin had an active session. Either way, they now have the highest level of access in the domain. The question is what they do with it.

Attackers target DCSync because it lets them extract every password hash in the domain without :

  • touching the domain controller’s disk
  • creating volume shadow copies
  • needing physical access to the DC

It works by abusing the Active Directory replication protocol (DRSUAPI), the same protocol that legitimate domain controllers use to synchronize directory data with each other.

The attacker’s machine pretends to be a domain controller and requests password data via DRSUAPI. If their account has the right permissions, the real DC complies. Domain Admins, Enterprise Admins, and DC machine accounts have these replication rights by default.

In some environments, attackers can also obtain replication rights through ACL abuse (WriteDACL on the domain object) without ever joining the Domain Admins group.


How DCSync Works

Active Directory replication is built on a set of extended rights that control who can request directory data. Three specific GUIDs are relevant:

  • is DS-Replication-Get-Changes-All
{1131f6ad-9c07-11d1-f79f-00c04fc2dcd2}
  • is DS-Replication-Get-Changes
{1131f6aa-9c07-11d1-f79f-00c04fc2dcd2} 
  • is DS-Replication-Get-Changes-In-Filtered-Set
{89e95b76-444d-4c62-991a-0facbeda640c}

The one that matters most is 1131f6ad, which is DS-Replication-Get-Changes-All. This is the permission that allows pulling password data, and it’s the primary indicator of DCSync.


Detection with Event 4662

DCSync detection uses Event 4662 (An operation was performed on an object), which is part of Directory Service Access auditing. When someone exercises the replication extended rights on the domain partition, Event 4662 fires with the replication GUID embedded in the raw event data.

The detection signal is an Event 4662 with Access_Mask=0x100, the replication GUIDs present in the raw event data, and a user that isn’t a machine account (doesn’t end in $).

Field What It Contains Why It Matters
user The account performing the replication Identifies who is running DCSync
Access_Mask 0x100 (Control Access) Indicates an extended right was exercised
Properties Shows “Control Access” (GUIDs in raw event) The replication GUIDs confirm DCSync
Logon_ID Hex session identifier Links to 4624 logon event for source IP correlation

Warning: Event 4662 for DCSync detection requires TWO things to be configured in advance:

  • (1) “Audit Directory Service Access” must be enabled via Group Policy, and
  • (2) a SACL (System Access Control List) must be set on the domain partition to audit replication operations.

Normal vs Suspicious Replication

Pattern Normal Suspicious
user Machine account ending in $ (e.g., THM-DC$) Human user account (not ending in $)
Source host Another domain controller A workstation or non-DC server
Frequency Regular intervals matching replication schedule One-time or burst of requests
Scope Specific partition changes Requesting all credentials (-just-dc-ntlm or full dump)

With Splunk

we can filter for the anomaly: a non-machine account exercising replication rights.

The 1131f6ad GUID (DS-Replication-Get-Changes-All) is the permission that allows pulling password data, and filtering out machine accounts (user!="*$") isolates any human user performing replication:

index=task5 EventCode=4662 "1131f6ad" user!="*$"
| table _time, user, Access_Mask, Properties
| sort _time

there’s a non-machine account performing AD replication

Event 4662 doesn’t contain a source IP field directly. To find where the DCSync originated, we correlate the Logon_ID from the 4662 event with a 4624 (logon) event for the same session, which contains the Source_Network_Address field

index=task5 EventCode=4662 Access_Mask=0x100 user={COMPROMISED_USER} "1131f6ad"
| table _time, host, user, Logon_ID
index=task5 EventCode=4624 Logon_ID={LOGON_ID}
| table _time, host, user, Source_Network_Address, Logon_Type

This gives us the source IP and confirms the logon type.


سبحانك اللهم وبحمد أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك
← All journal articles
Scroll to Top
Home