How to Detect DCSync: DRSUAPI Replication, Packet by Packet
This walkthrough uses ntlm_rpc.pcapng from the NTLMSSP section of the Wireshark wiki's SampleCaptures page, published with the password that decrypts it. The comparison with real replication uses win2016_win2016.pcapng and its keytab from Wireshark issue 19699. Download them there. We decoded them with VisualEther, which turns a Wireshark PCAP into a sequence diagram with a plain-English caption on every message.
DCSync is a well-known attack name, but few defenders have seen one on the wire. It is not malware or an exploit: it is an ordinary Active Directory replication request, the same call domain controllers make to each other every few minutes, sent by a machine that is not a domain controller. The domain controller answers it because the caller's account holds replication rights, and the answer contains password hashes.
This capture holds one complete DCSync: 32 frames in 203 ms. A workstation looks up the replication service, logs in with NTLM, resolves one account name, and pulls that account's secrets with a single DsGetNCChanges call. Its traffic is encrypted, but the capture comes with the password, so Wireshark decrypts every call. We put it beside a real domain controller replicating, so each difference is visible in the packets rather than claimed.
This article explains what replication looks like and how to recognize the imitation. It is not a guide to running DCSync.
Each participant gets a lane, and each message is an arrow, numbered as in Wireshark and captioned with what it does. Under each arrow are the fields that matter: the RPC interface, the authentication type and level, the NTLM user and host, the DRS extensions and GUIDs, and the DsGetNCChanges extended operation, object, flags, and attribute list. The password hashes in the reply are redacted from the packet trees.
💡 Read the walkthrough and the diagram side by side: open the interactive diagram in a split-screen window, or open it in a new tab and snap the two windows side by side.
What is DRSUAPI?
DRSUAPI is the RPC interface domain controllers use to replicate Active Directory to each other. Microsoft specifies it in [MS-DRSR], the Directory Replication Service (DRS) Remote Protocol.
Some background first. Active Directory (AD) stores a Windows domain's users, computers, groups, and their passwords. Every domain controller (DC) holds a full writable copy, so a user can log in at any of them, and a change made on one DC must reach all the others. Replication is how it gets there.
The copies are split into naming contexts (NCs), also called partitions: the domain NC with the users and computers, the configuration NC, and the schema NC. Each object has a distinguished name (DN), such as CN=DC,OU=Domain Controllers,DC=lab,DC=lan, and a GUID (a 128-bit globally unique identifier) that never changes. Each DC also has its own identity for replication: the GUID of its NTDS Settings object, called its DSA GUID (DSA, directory system agent, is the old X.500 name for a directory server).
DRSUAPI runs over DCE/RPC (the Distributed Computing Environment's remote procedure call protocol, which Windows extends as [MS-RPCE]). A client finds the interface through the Endpoint Mapper (EPM) on TCP port 135, binds to it with UUID e3514235-4b06-11d1-ab04-00c04fc2dcd2, version 4.0 ([MS-DRSR] 1.9 and 2.1), and then calls its operations by number:
| Opnum | Operation | What it does |
|---|---|---|
| 0 | DsBind | Open a session and exchange capabilities, the DRS extensions |
| 1 | DsUnbind | Close it |
| 3 | DsGetNCChanges | Pull directory changes from a partner: the replication call |
| 12 | DsCrackNames | Translate a name between formats, such as account name to GUID |
| 16 | DsGetDomainControllerInfo | List the domain's DCs and their GUIDs |
How do domain controllers replicate?
Replication is pull-based: a DC that wants changes asks a partner for them with DsGetNCChanges ([MS-DRSR] 4.1.10). Each request names a naming context and says how much the caller already has, so the partner sends only what is new.
Two counters make that work. Each DC numbers its own changes with an update sequence number (USN) that only goes up. The caller sends a high-water mark, the highest USN it has seen from this partner, and an up-to-dateness (UTD) vector, the highest USN it has seen from every DC in the domain, so changes that already reached it another way are skipped. The partner replies with a batch of objects, a new high-water mark, and a more data flag; the caller repeats until the flag is clear.
The issue 19699 capture shows a real DC doing this. It records a new DC, SUBWINDC4002, being promoted against an existing one, WINDC1. Its first replication requests decrypt with the attached keytab, so we can read them:
| Round | Naming context | Watermark (USN) | Reply size | Reply time |
|---|---|---|---|---|
| 1 | Schema | 0 | 379 kB | 107 ms |
| 2 | Schema | 1,003 | 345 kB | 79 ms |
| 3 | Configuration | 0 | 469 kB | 78 ms |
| 4 | Configuration | 5,103 | 347 kB | 114 ms |
Every request asks for up to 1,000 objects and 10 MiB, with no extended operation and no attribute list (all attributes). Each reply arrives as 61 to 82 RPC fragments of about 5.7 kB. Their contents stay unreadable for a different reason than encryption: the requests set DRSUAPI_DRS_USE_COMPRESSION, and the replies come back compressed with the Windows Server 2003 algorithm (DRS_COMP_ALG_WIN2K3, [MS-DRSR] 4.1.10.2.18). Wireshark labels it WIN2K3_LZ77_DIRECT2 but does not decompress it. After promotion, the two DCs replicate in both directions with their own machine accounts, and those connections stay sealed because the keytab holds only the Administrator key.
What is DCSync?
DCSync is a DsGetNCChanges request for one account's secrets, sent by a machine that is not a domain controller. Tools such as Mimikatz (lsadump::dcsync) and Impacket (secretsdump) implement it. Nothing in the protocol requires the caller to be a DC: the server checks the caller's account for two control access rights on the naming context, DS-Replication-Get-Changes and, for secret attributes, DS-Replication-Get-Changes-All ([MS-DRSR] 5.101; the rights are listed in [MS-ADTS] 5.1.3.2.1).
Domain Admins, Enterprise Admins, and the domain controllers hold those rights by default, and so do some service accounts, such as the one Microsoft Entra Connect uses to synchronize password hashes. Anyone who controls one of those accounts can pull the hash of any user, including krbtgt, whose key signs every Kerberos ticket in the domain.
What does the whole DCSync look like?
The capture has five phases. The diagram keeps every message except the TCP acknowledgments and one retransmitted EPM reply, and each section below names the frames it covers.
Finding the service: EPM on port 135 (frames 1 to 7)
The workstation, which names itself PC (10.0.0.20), connects to port 135 on the domain controller DC (10.0.0.10) and binds to the Endpoint Mapper with no authentication. It asks where DRSUAPI listens, and the DC answers in 200 µs: TCP port 49667, in the Windows dynamic range of 49152 to 65535.
This is the first point a network sensor can catch. The EPM request names the DRSUAPI UUID in the clear, and so does the RPC bind on the new port. Neither depends on decryption.
Logging in: NTLM at packet privacy (frames 8 to 13)
The workstation opens a second connection, to port 49667, and binds to DRSUAPI with NTLM authentication at RPC authentication level 6, packet privacy: every call after the bind is signed and encrypted ([MS-RPCE] 2.2.1.1.8). The three NTLM messages ride in the bind (NEGOTIATE), the bind acknowledgment (CHALLENGE, naming server DC in domain LAB), and a separate AUTH3 packet (AUTHENTICATE).
The AUTHENTICATE message names the caller in the clear: user LAB\admin on host PC. That is the first strong signal. Real replication logs in as a domain controller's machine account, such as SUBWINDC4002$, with Kerberos and a ticket for the replication service principal name (SPN), E3514235-4B06-11D1-AB04-00C04FC2DCD2/<DSA GUID>/<domain> ([MS-DRSR] 2.2.3.2). Here it is a user on a workstation, with NTLM. The NT response is 24 bytes, so this lab also allows NTLMv1 ([MS-NLMP] 3.3.1), which is worth its own alert on a real network.
Looking up the target: DsBind, DsGetDomainControllerInfo, DsCrackNames (frames 14 to 21)
The first DsBind identifies the client with GUID e24d201a-4fd6-11d1-a3da-0000f875ae0d. That is NTDSAPI_CLIENT_GUID ([MS-DRSR] 5.138), which Windows clients that are not DCs pass to DsBind; a DC passes its own server GUID ([MS-DRSR] 4.1.3 and its product behavior note). The client offers two DRS extension bits (0x04008000: DRS_EXT_STRONG_ENCRYPTION and DRS_EXT_GETCHGREPLY_V6, [MS-DRSR] 5.39), with process ID 0 and no site. The DC answers with extensions 0x3fffff7f (nearly every capability bit), its site GUID, and its process ID.
DsGetDomainControllerInfo then lists the domain's two DCs, DC.lab.lan and dcfr.lab.lan, with their computer-object and DSA GUIDs. DsCrackNames translates the account name lab\dc$, the DC's own computer account, into its object GUID, 2640eac5-0fb7-4550-99da-cc3d97649a28.
Pulling the account: a second DsBind and DsGetNCChanges (frames 22 to 25)
The second DsBind is dressed as a domain controller. Its client GUID is now 3a2a6e1a-1701-45d7-8771-b5dd5a305c46, the DC's own DSA GUID from the list in frame 18, and its site GUID is the one the DC returned in frame 16. The extension bits are still the two from frame 14, and the process ID is still 0. A DC binding to a partner offers its own GUID and its full extension set, as SUBWINDC4002 did when it bound to WINDC1 in the issue 19699 capture (0x3ffffb7f).
Then comes the request itself:
frame : Frame 24: Packet, 454 bytes on wire (3632 bits), 454 bytes captured (3632 bits) on interface \Device\NPF_{0CCC9DBC-B1C8-4DEF-B733-7A34F2894DF7}, id 0
Interface id : 0 (\Device\NPF_{0CCC9DBC-B1C8-4DEF-B733-7A34F2894DF7})
eth : Ethernet II, Src: 00:15:5d:00:02:1d, Dst: 00:15:5d:00:02:1f
Destination : 00:15:5d:00:02:1f
Source : 00:15:5d:00:02:1d
ip : Internet Protocol Version 4, Src: 10.0.0.20, Dst: 10.0.0.10
Differentiated Services Field : 0x00 (DSCP: CS0, ECN: Not-ECT)
010. .... = Flags : 0x2, Don't fragment
tcp : Transmission Control Protocol, Src Port: 49943, Dst Port: 49667, Seq: 957, Ack: 2569, Len: 400
Conversation completeness : Complete, WITH_DATA (47)
Flags : 0x018 (PSH, ACK)
Timestamps
SEQ/ACK analysis
dcerpc : Distributed Computing Environment / Remote Procedure Call (DCE/RPC) Request, Fragment: Single, FragLen: 400, Call: 6, Ctx: 0, [Resp: #25]
Packet Flags : 0x03
Data Representation : 10000000 (Order: Little-endian, Char: ASCII, Float: IEEE)
Complete stub data (352 bytes)
Auth Info : NTLMSSP, Packet privacy, AuthContextId(0)
NTLMSSP Verifier
drsuapi : Active Directory Replication, DsGetNCChanges
Pointer to Bind Handle (policy_handle)
Policy Handle
Pointer to Req (drsuapi_DsGetNCChangesRequest)
drsuapi_DsGetNCChangesRequest
Req8
Pointer to Naming Context (drsuapi_DsReplicaObjectIdentifier)
Naming Context
Sid : S-0-0
Highwatermark
Replica Flags […] : 0x00288030, DRSUAPI DRS WRIT REP: DRSUAPI_DRS_WRIT_REP is SET, DRSUAPI DRS INIT SYNC: DRSUAPI_DRS_INIT_SYNC is SET, DRSUAPI DRS FULL SYNC NOW: DRSUAPI_DRS_FULL_SYNC_NOW is SET, DRSUAPI DRS SYNC URGENT: DRSUAPI_DRS_SYNC
Pointer to Partial Attribute Set (drsuapi_DsPartialAttributeSet)
Partial Attribute Set
Mapping Ctr
Pointer to Mappings (drsuapi_DsReplicaOIDMapping)
Mappings
Oid
Pointer to Binary Oid (uint8)
Mappings
Oid
Pointer to Binary Oid (uint8)
Frame 24, the DCSync request, decrypted. DsGetNCChanges at request version 8: destination DSA GUID 3a2a6e1a… (the server's own), the DC$ object 2640eac5… in place of a naming context, USN watermark 0, replica flags 0x00288030, one object, extended operation DRSUAPI_EXOP_REPL_OBJ, and a partial attribute set of 19 attribute IDs encoded against the client's two-entry prefix table.
DRSUAPI_EXOP_REPL_OBJ, max objects 1. An extended operation that replicates a single object ([MS-DRSR] 4.1.10.1.3 and 4.1.10.2.22). With it, the naming-context field names that object, here theDC$account ([MS-DRSR] 4.1.10.4.2).- Destination DSA GUID
3a2a6e1a…. This field (uuidDsaObjDest) identifies the DC that is asking ([MS-DRSR] 4.1.10.2.6). A real DC puts its own DSA GUID here; this request puts the server's, as if the DC were replicating from itself. - Watermark 0, no up-to-dateness vector. Send everything, as a brand-new replica would.
- 19 attributes, named. The prefix table maps them to the account's identity (
name,sAMAccountName,userPrincipalName,objectSid,sIDHistory), its state (userAccountControl,pwdLastSet,accountExpires), its password hashes and history (unicodePwd,ntPwdHistory,dBCSPwd,lmPwdHistory), its Kerberos keys (supplementalCredentials), and trust and LSA secrets (trustAuthIncoming,trustAuthOutgoing,currentValue).
What does DsGetNCChanges return?
The DC answers 410 µs later with a version 6 reply (Ctr6): one object, 13 attributes, extended result DRSUAPI_EXOP_ERR_SUCCESS, more data 0, status WERR_OK, 5,590 bytes on the wire. The reply is not compressed, because the request did not ask for compression.
The 13 attributes are the ones that exist on a computer account. Five hold credentials: unicodePwd (the NT hash), ntPwdHistory, dBCSPwd (the LM hash), lmPwdHistory, and supplementalCredentials (the Kerberos keys). We redacted their values from the packet trees. The account belongs to a domain controller, so its keys are enough to forge Kerberos service tickets for that DC; pulled for krbtgt, the same call yields the key that signs every ticket in the domain.
[MS-DRSR] protects these values twice. The whole reply is sealed at packet privacy, and inside it each secret value is encrypted again with RC4, under a key made from the RPC session key and a random salt ([MS-DRSR] 4.1.10.5.11), so a sensor that strips only the outer layer still sees ciphertext.
The client spends 191 ms after the reply before it sends DsUnbind, the longest gap in the capture, and then resets both TCP connections. The first bind handle is never released.
Is replication traffic encrypted?
Yes. Both captures run DRSUAPI at authentication level 6, packet privacy, so every request and reply after the bind is encrypted, whether the login is Kerberos (real replication) or NTLM (this DCSync). Wireshark decrypts it only when given the keys: a password for NTLM, or a keytab for Kerberos. The Kerberos walkthrough shows how a keytab unlocks the tickets.
Without keys, a sensor still sees a lot, which is what network detection relies on:
- The EPM lookup for the DRSUAPI UUID, and the RPC bind to it, with the authentication type.
- For NTLM, the user, domain, and host in the AUTHENTICATE message. For Kerberos, the client and service names in the ticket exchange with the KDC (key distribution center).
- The opnum of every call, in the RPC header:
DsGetNCChangesis opnum 3. - Request and reply sizes and timing: a one-object pull is a few kilobytes, a real replication round hundreds.
How is DCSync different from real replication?
| Real replication (issue 19699) | DCSync (this capture) | |
|---|---|---|
| Caller | A domain controller | A workstation, PC |
| Account | Administrator during promotion; afterward the DC's machine account, SUBWINDC4002$ | LAB\admin, a user |
| Authentication | Kerberos, packet privacy | NTLMv1, packet privacy |
| DsBind client GUID | The caller's own DSA GUID | NTDSAPI_CLIENT_GUID, then the server's DSA GUID |
| DsBind extensions | 0x3ffffb7f | 0x04008000 |
| Request | Version 10, whole NC, up to 1,000 objects, all attributes | Version 8, one object, 19 named attributes |
| Extended operation | None for NC rounds; REPL_OBJ only for its own configuration objects | REPL_OBJ on a credential-bearing account |
| Destination DSA GUID | The caller's own | The server's own |
| Reply | Compressed, 345 to 469 kB per round | Uncompressed, 5.6 kB |
One row needs care. DRSUAPI_EXOP_REPL_OBJ alone does not mean DCSync: while promoting, SUBWINDC4002 used it twice to pull single configuration objects, its partition's cross-reference and its own NTDS Settings object. What gives DCSync away is the combination: who asks, as which account, and for which object and attributes.
How do you detect DCSync?
Watch for replication requests from machines that are not domain controllers, on the network and in the domain controllers' security logs.
On the network:
- Keep a list of your domain controllers' addresses, and add the few legitimate replication clients, such as the Microsoft Entra Connect server.
- Alert on a DRSUAPI bind or a
DsGetNCChangescall (opnum 3) from any other address. The interface UUID in the bind and the opnum in each request are readable without keys. Many network detection products and intrusion detection system (IDS) rule sets carry this rule. - Note the account and the authentication type. NTLM to DRSUAPI, or a user account rather than a computer account ending in
$, deserves a closer look even from an expected address.
On the domain controllers, Windows logs event 4662, "An operation was performed on an object", when Directory Service Access auditing is on and the domain object's audit list (SACL) covers the replication rights. The event's Properties field lists the GUIDs of the rights and property sets the operation used, and DCSync detection rules look there for the replication rights ([MS-ADTS] 6.1.1.2.7):
| Right | GUID |
|---|---|
DS-Replication-Get-Changes | 1131f6aa-9c07-11d1-f79f-00c04fc2dcd2 |
DS-Replication-Get-Changes-All | 1131f6ad-9c07-11d1-f79f-00c04fc2dcd2 |
DS-Replication-Get-Changes-In-Filtered-Set | 89e95b76-444d-4c62-991a-0facbeda640c |
Alert when the subject account is not a domain controller's machine account and not a known synchronization account. To match it with the network alert, join its logon ID to the logon event on the same DC (event 4624), which records the source address.
Finally, reduce who can do it: review which accounts hold the two replication rights on the domain, and treat those accounts with the same care as Domain Admins.
How to analyze DRSUAPI in Wireshark
- Decrypt NTLM: Preferences → Protocols → NTLMSSP → NT Password, or
-o ntlmssp.nt_password:<password>with tshark. This works when NTLM authenticated the RPC connection and you know the password. - Decrypt Kerberos: Preferences → Protocols → KRB5 → Try to decrypt, with a keytab holding the account keys (
-o kerberos.decrypt:TRUE -o kerberos.file:<keytab>). - Run two passes (
-2in tshark) so request and reply link up and every call on a connection decrypts. - Filters:
dcerpc.cn_bind_to_uuid == e3514235-4b06-11d1-ab04-00c04fc2dcd2finds DRSUAPI binds;drsuapi.opnum == 3findsDsGetNCChanges;drsuapi.drsuapi_DsGetNCChangesRequest8.extended_op == 6finds single-object pulls at request version 8. - Know the limits: Wireshark does not decompress
GetNCChangesreplies compressed between DCs, and a DN prints one character per field.
FAQ
What is DRSUAPI used for? Replicating Active Directory between domain controllers, plus a few directory-service API calls such as name translation (DsCrackNames). Its replication call is DsGetNCChanges.
Does DCSync need code on the domain controller? No. It is a network request to the DC's replication interface, which is why the source address is the best network signal.
Which accounts can perform DCSync? Any account with DS-Replication-Get-Changes and DS-Replication-Get-Changes-All on the domain: by default Domain Admins, Enterprise Admins, Administrators, and the domain controllers, plus any service account granted them, such as Microsoft Entra Connect's.
Is DsGetNCChanges from a non-DC always an attack? No, but every one should be on your list. Microsoft Entra Connect and some identity and backup products replicate legitimately; list them, and alert on everything else.
Can a firewall block DCSync? Partly. Allowing RPC to domain controllers only from the hosts that need it shrinks the exposure, but clients need RPC to DCs for other services, so the rights review and the alerts above still matter.
Takeaways
- DCSync is replication, not an exploit. One
DsGetNCChangescall from an account with the replication rights returns password hashes. - The source is the strongest signal. Real replication comes from domain controllers; this request came from a workstation.
- The account and login type follow. A user over NTLM, not a DC machine account over Kerberos with the replication SPN.
- The request imitates a DC, imperfectly. The server's own DSA GUID as both bind identity and destination, two extension bits instead of a DC's full set, one object, and 19 named secret-bearing attributes.
EXOP_REPL_OBJalone is not proof. DCs use it too; combine it with the caller and the object.- Encryption hides the contents, not the call. The EPM lookup, bind, opnum, account, and sizes stay visible; event 4662 with the replication right GUIDs covers the host side.