· by · 10 min read

DCSync: three 4662 events, and only one that matters


DCSync is an attacker pretending to be a domain controller and politely asking a real DC to replicate the domain’s secrets over to them. The krbtgt hash, the admins’ hashes, everything. No code on the DC, no touching LSASS. Just the replication protocol, used by someone who holds the rights to use it (T1003.006).

The textbook detection fits in one sentence: look for Event 4662 with the replication rights GUIDs, coming from an account that isn’t a domain controller. That’s correct. But when I went through the logs of two real DCSync runs, three things turned up that the sentence leaves out. There are three 4662 events per DCSync, and two of them prove nothing. None of them carries an IP address. And without a setting that’s off by default, you get none at all.

The data

I don’t have a domain controller I can dissect in public. So I went back to OTRF Security-Datasets, MIT-licensed and already used on this blog. Two datasets in credential_access/host record a full DCSync: covenant_dcsync_dcerpc_drsuapi_DsGetNCChanges (August 2020, Covenant) and empire_dcsync_dcerpc_drsuapi_DsGetNCChanges (September 2020, Empire). Same lab, same attacking account (pgustavo), same source host (WORKSTATION5), same DC (MORDORDC).

As false-positive terrain, I added the 50 other datasets I’d already pulled for earlier posts. That’s 52 datasets and 48,142 Security log events in total.

Six milliseconds on the DC

Here’s everything the DC’s Security log records during the Covenant DCSync, in order:

Timeline of the DCSync on domain controller MORDORDC. At 0 ms, two 5156 events: svchost.exe accepts a connection from WORKSTATION5 on port 135, then lsass.exe on dynamic port 49674. At 1 ms, lsass.exe accepts ports 389 and 88, and a 4769 records a service ticket for MORDORDC$ on behalf of pgustavo. At 2 ms, a 4672 and a type 3 Kerberos 4624 for pgustavo, LogonId 0x824909, with WORKSTATION5’s IP. At 5 and 6 ms, three 4662 events: two DS-Replication-Get-Changes and one DS-Replication-Get-Changes-All.
The whole DCSync fits in six milliseconds and nine events. Diagram: PurpleLog, OTRF Security-Datasets data (covenant_dcsync).

The Empire dataset tells the exact same story, except every event carries the same timestamp down to the millisecond.

The last three are the ones detection cares about. Each has an AccessMask of 0x100 (Control Access, meaning an extended right was used), an ObjectType of %{19195a5b-6da0-11d0-afd3-00c04fd930c9}, which is the GUID of the domainDNS class (the domain root object), and a Properties field holding the GUID of the right being exercised. Per the Active Directory schema documentation:

GUID Extended right What it allows
1131f6aa-9c07-11d1-f79f-00c04fc2dcd2 DS-Replication-Get-Changes replicate changes from a partition
1131f6ad-9c07-11d1-f79f-00c04fc2dcd2 DS-Replication-Get-Changes-All also replicate the domain’s secret data
89e95b76-444d-4c62-991a-0facbeda640c DS-Replication-Get-Changes-In-Filtered-Set replicate the filtered set (RODC)

In both DCSync runs: two 4662 events with 1131f6aa, a single one with 1131f6ad. That third one is what hands over the hashes.

A side note. Microsoft’s documentation for Event 4662 describes Object Name as the “distinguished name of the object that was accessed”. In both datasets it holds a GUID instead (%{3933c65d-…} in one, %{d613d8a5-…} in the other): the domain object’s objectGUID, which differs between lab builds. A rule that trusted the docs and looked for DC=contoso,DC=com in that field would match nothing.

The right that matters

Why not just alert on all three GUIDs, like most public rules do? Because the first one gets used for plenty of things besides DCSync.

In the OTRF corpus, two datasets that have nothing to do with replication (empire_shell_dcerpc_smb_service_dll_hijack and covenant_wmi_wbemcomn_dll_hijack) each contain a 4662 with 1131f6aa, emitted by the DC itself: SubjectUserName is MORDORDC$, SubjectUserSid is S-1-5-18. Background DC activity. Never with 1131f6ad. On the application side, the documentation for the LDAP DirSync control is explicit: the caller must hold the DS-Replication-Get-Changes extended right. Sync tools built on DirSync will therefore trigger 1131f6aa without doing anything malicious. I don’t have logs of that case to show; it’s an inference from the docs, not an observation.

1131f6ad is a different animal. It’s the right that releases secrets. The only common legitimate use outside DCs that I know of is documented by Microsoft: the Entra Connect AD DS connector account needs “Replicate Directory Changes” and “Replicate Directory Changes All” for password hash sync. With express settings, that account is created with an MSOL_ prefix.

Hence this rule, which I prefer over a list of four GUIDs:

title: Replication Of Secret Domain Data By Non-Machine Account - DCSync
id: 2b8c918e-67f1-4865-8264-be9d7b8b4935
related:
    - id: 17d619c1-e020-4347-957e-1d1207455c93
      type: similar
status: experimental
description: |
    Detects use of the DS-Replication-Get-Changes-All extended right, the one that lets a
    replication client receive secret attributes such as password hashes, by an account
    that is neither a machine account nor SYSTEM. One event per DCSync in the OTRF datasets,
    where DS-Replication-Get-Changes alone shows up three times per DCSync and also comes
    from the DC itself and from DirSync-based tools.
references:
    - https://learn.microsoft.com/en-us/windows/win32/adschema/r-ds-replication-get-changes-all
    - https://github.com/OTRF/Security-Datasets
author: PurpleLog
date: 2026-10-17
tags:
    - attack.credential-access
    - attack.t1003.006
logsource:
    product: windows
    service: security
    definition: 'Requirements: Audit Directory Service Access (Success) and a SACL on the domain root covering the replication extended rights'
detection:
    selection:
        EventID: 4662
        Properties|contains: '1131f6ad-9c07-11d1-f79f-00c04fc2dcd2'
    filter_main_machine_account:
        SubjectUserName|endswith: '$'
    filter_main_system:
        SubjectUserSid: 'S-1-5-18'
    filter_optional_entra_connect:
        SubjectUserName|startswith: 'MSOL_'
    condition: selection and not 1 of filter_main_* and not 1 of filter_optional_*
falsepositives:
    - Entra Connect AD DS connector accounts created with a custom name (password hash sync needs this right)
    - Any other account deliberately granted Replicating Directory Changes All
level: high

It passes sigma check with no errors or issues. The MSOL_ filter only covers express installs; if your Entra Connect account was created by hand under another name, add it. Better still, list every account that holds this right on the domain root. It should fit on one hand, and each entry should have a reason to be there.

Replayed on 52 datasets

I replayed the logic of three rules in Python over the corpus’s 48,142 Security events: SigmaHQ’s two replication rules (win_security_ad_replication_non_machine_account and win_security_ad_replication_machine_account, as modified on July 30, 2026) and mine.

Output of replay.py over 52 OTRF datasets and 48,142 Security events. The SigmaHQ non-machine-account rule raises 6 alerts, the SigmaHQ machine-account rule 0, the PurpleLog Get-Changes-All rule 2. Both PurpleLog alerts, one per DCSync, are joined to a type 3 Kerberos logon from the source host’s IP.
Two DCSync runs: six alerts on one side, two on the other, and the source IP recovered through the session. Real output, capture: PurpleLog.

No false positives from any of the three on this corpus. SigmaHQ’s non-machine rule catches both attacks, three times each; mine catches each once. In a lab, the difference is cosmetic. On a domain running a DirSync-based sync tool, I expect it stops being cosmetic, for the reason above.

The SigmaHQ machine-account rule stays quiet, which is by design: the DC’s two 4662 events are excluded by their S-1-5-18 SID. What it would do on a domain with several controllers replicating with each other all day, I can’t tell you. The OTRF corpus has a single DC, and I’d rather say so than guess.

The IP isn’t in the 4662

When the rule fires, the first triage question is: from which machine? The 4662 doesn’t say. You get an account, a domain, a SID and a SubjectLogonId. No address, no hostname.

The address lives elsewhere, in the 4624 that opened the session. In both datasets, the SubjectLogonId of all three 4662 events (0x824909 for Covenant, 0x69099c7 for Empire) is exactly the TargetLogonId of a type 3 Kerberos 4624 logged two milliseconds earlier on the same DC, with WORKSTATION5’s IP. Microsoft’s description of the Logon ID field hints at this: it’s there to correlate with other events, “for example, 4624”.

In KQL, against Microsoft Sentinel’s SecurityEvent table:

// DCSync: who used DS-Replication-Get-Changes-All, and from which IP
let lookback = 1d;
let dcIps = dynamic(["198.51.100.10", "198.51.100.11"]); // replace with your domain controllers' IPs
let replication = SecurityEvent
    | where TimeGenerated > ago(lookback)
    | where EventID == 4662
    | where Properties contains "1131f6ad-9c07-11d1-f79f-00c04fc2dcd2"
    | where not(SubjectUserName endswith "$") and SubjectUserSid != "S-1-5-18"
    | project TimeGenerated, Computer, SubjectUserName, SubjectLogonId;
SecurityEvent
| where TimeGenerated > ago(lookback)
| where EventID == 4624
| project Computer, TargetLogonId, IpAddress, LogonType, AuthenticationPackageName
| join kind=inner replication on Computer, $left.TargetLogonId == $right.SubjectLogonId
| where IpAddress !in (dcIps)
| project TimeGenerated, Computer, SubjectUserName, IpAddress, LogonType, AuthenticationPackageName

The query passes Microsoft’s official KQL parser against the documented SecurityEvent schema; I haven’t run it on a real workspace. The join is on machine plus LogonId, because a LogonId is only unique on the machine that issued it. The final filter on DC IPs is the actual detection. A DC replicating from another DC is normal. A user account replicating from a workstation never is.

One limitation: the 4624 has to fall inside the same window as the 4662. In both datasets the session opens two milliseconds before the first 4662; if an attacker reuses a session opened much earlier, the join comes back empty. Widen the 4624 window if that worries you.

None of this is on by default

Last point, and possibly the most important. The Event 4662 documentation states that it’s only generated if an appropriate SACL is set on the Active Directory object and the operation matches it. So you need two things: the “Directory Service Access” audit subcategory enabled for success on your DCs, and an audit entry on the domain root covering the replication rights.

The SigmaHQ rule spells this out in its definition field, procedure included: in ADSI Edit, on the domain root, an audit entry for Everyone, success, this object only, for DS-Replication-Get-Changes and DS-Replication-Get-Changes-All. The OTRF lab was set up that way. Is yours? Check before you rely on the rule. A detection rule that has never fired can mean two things, and only one of them is reassuring.

If that auditing isn’t an option, two other angles exist that I won’t develop here. On the network, DCSync goes over the DRSUAPI RPC interface; a sensor that decodes DCE/RPC will see a DRSGetNCChanges call from an IP that isn’t a DC. On the endpoint, Sysmon recorded in both datasets a connection from GruntHTTP.exe (Covenant) or powershell.exe (Empire) to the DC on port 135 and then on dynamic port 49674. A user process talking to a DC’s replication interface has little business doing so, but I haven’t measured how such a rule would behave on a real fleet.

Another surprise in the corpus

While pulling every 4662 out of the corpus, I found four I didn’t expect, in empire_mimikatz_backupkeys_dcerpc_smb_lsarpc. They don’t come from the directory but from LSA: ObjectServer is LSA, ObjectType is SecretObject, and ObjectName reads Policy\Secrets\G$BCKUPKEY_PREFERRED, G$BCKUPKEY_P, then two names followed by a GUID. Those are the domain’s DPAPI backup keys, which Mimikatz’s lsadump::backupkeys has just read on behalf of pgustavo.

Same event ID, two different worlds. Everywhere else in the corpus, the only SecretObject 4662 events come from LOCAL SERVICE. A user account reading G$BCKUPKEY_* deserves its own post. For now, take it as one more reason why any 4662 rule should pin down ObjectServer or ObjectType before looking at anything else.

At triage time

When the rule surfaces an account:

  1. Take the SubjectLogonId and find the matching 4624 on the same DC: source IP, logon type, protocol.
  2. Check whether that IP is a domain controller or the Entra Connect server. If not, treat it as a confirmed DCSync.
  3. Assume every secret in the domain is compromised, krbtgt included. That means, eventually, a double krbtgt password reset, plus an investigation into how this account got replication rights in the first place.

Step 3 is the painful one. It’s also why the rule earns its high level.

References

How I check the rules and queries published here →