How it works
Domain controllers keep each other consistent through the Directory Replication Service (DRS) protocol. A domain controller trusts what a replication partner sends: the receiving side applies the changes as replicated data and does not run them through the checks and the auditing that a client's LDAP write goes through.
A machine counts as a replication partner when the directory says it is one. That takes three things:
- a
serverobject underCN=Servers,CN=<site>,CN=Sites,CN=Configuration,<forest DN>and annTDSDSAobject (CN=NTDS Settings) below it; - two service principal names on the machine's computer account: the DRS interface SPN,
E3514235-4B06-11D1-AB04-00C04FC2DCD2/<DSA GUID>/<domain>, and a global catalog SPN,GC/<host>/<forest>; - an RPC server on the machine that answers the replication calls.
DCShadow, published by Benjamin Delpy and Vincent Le Toux in 2018 and implemented in Mimikatz as lsadump::dcshadow, does all of this for a few seconds:
- It creates the
serverandnTDSDSAobjects and adds the SPNs to the computer account of the attacker's host. - It starts a minimal DRS RPC server that holds the changes the attacker wants to make.
- It asks a real domain controller to replicate from the new partner. The real domain controller connects to the attacker's host, pulls the staged changes and commits them.
- It deletes the
serverandnTDSDSAobjects and removes the SPNs.
The domain controller then replicates the change to the rest of the domain like any other.
DCShadow needs rights that already mean control of the domain, so it is not an escalation. Attackers use it to make their persistence changes quietly, and to write values that the normal interfaces refuse.
What gets pushed
- SID history. Adding the SID of Domain Admins or Enterprise Admins to an ordinary account's
sIDHistory. LDAP does not allow a direct write of this attribute; replication does. See SID history injection. - Primary group. Setting
primaryGroupIDto 512 makes Domain Admins the account's primary group, a membership that does not show in the group'smemberattribute. - AdminSDHolder permissions. Writing the template's
nTSecurityDescriptorplants an AdminSDHolder backdoor without the 5136 event on that object. - Anything else: password hashes,
userAccountControl, SPNs, delegation attributes, descriptions.
Prerequisites
- Rights to register a domain controller and trigger replication. By default that is Domain Admins or Enterprise Admins. The published delegated set is: on the domain object, the extended rights
DS-Install-Replica,DS-Replication-Manage-TopologyandDS-Replication-Synchronize; on the Sites container in the Configuration partition,CreateChildandDeleteChild;WritePropertyon the computer object that will be registered; andWritePropertyon the target object. - SYSTEM on a domain-joined computer. The process that runs the RPC server must hold the machine's identity, because the real domain controller authenticates to the machine account's SPNs.
- Network reachability in both directions. The attacker's host reaches the domain controller to register and trigger, and the domain controller must reach the attacker's host over RPC to pull the changes.
An attacker who wants to return later without Domain Admin can grant the delegated set to an ordinary account in advance. Nishang's Set-DCShadowPermissions does this for one rogue host and one target object:
Set-DCShadowPermissions -FakeDC WS01 -SAMAccountName svc-sql -Username alice -Verbose
That grant is itself a series of ACL changes on the domain object, the Sites container and two other objects.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
Two Mimikatz instances run on the same host, WS01: one as SYSTEM to act as the domain controller, one as the privileged account to trigger the push.
1. Start the first instance as SYSTEM
mimikatz # !+
mimikatz # !processtoken
!+ loads the Mimikatz kernel driver (mimidrv) and !processtoken uses it to give the Mimikatz process a SYSTEM token. Impersonating SYSTEM on a thread (token::elevate) is not enough, because the RPC server runs with the process token. Starting Mimikatz from a SYSTEM shell works as well.
2. Stage the change
In the SYSTEM instance, name the object, the attribute and the new value. A harmless change shows the mechanism:
mimikatz # lsadump::dcshadow /object:svc-sql /attribute:description /value:DCShadowTest
Mimikatz starts the RPC server and waits. The persistence variants use the same command with a different attribute:
mimikatz # lsadump::dcshadow /object:alice /attribute:sidHistory /value:S-1-5-21-0-0-0-512
mimikatz # lsadump::dcshadow /object:alice /attribute:primaryGroupID /value:512
Replace the SID with the domain's real SID followed by the RID of the group.
3. Push
In the second instance, running as the Domain Admin or the delegated account:
mimikatz # lsadump::dcshadow /push
This registers the rogue domain controller, triggers replication on the real one, and removes the registration again. The first instance prints the replication calls it served.
4. Verify from an independent client
Get-ADUser -Identity alice -Properties sIDHistory, primaryGroupID, description |
Select-Object SamAccountName, sIDHistory, primaryGroupID, description
Get-ADReplicationAttributeMetadata -Object (Get-ADUser alice).DistinguishedName -Server DC01 |
Where-Object AttributeName -in 'sIDHistory', 'primaryGroupID', 'description' |
Select-Object AttributeName, Version, LastOriginatingChangeTime, LastOriginatingChangeDirectoryServerIdentity
A SID history value or a new primary group shows in the account's token only at its next logon.
Impact
The attacker can write any value to any object in the domain, including values that the directory would reject from an LDAP client. The usual goals are durable, hard-to-attribute privileges: an unremarkable account that carries the Domain Admins SID in its history, a template ACE that restores itself every hour, a changed password hash for a service account.
Because the changes come in as replication, the audit trail that incident responders rely on is missing. There is no event that says "this account changed that attribute", so after a compromise the defenders cannot easily list what was altered. That is the technique's real value, and it is why ATT&CK lists it under the defense impairment tactic.
A mistake has a cost too. Pushing a malformed value, or touching replication topology objects, can damage replication for the whole forest.
OPSEC and artifacts
- Short registration window. The
serverandnTDSDSAobjects exist for seconds. With Directory Service Changes auditing and SACLs on the Configuration partition, their creation is event 5137 and their deletion event 5141, one pair per push, naming the account that pushed. A run that fails midway leaves the objects behind. - SPNs on a non-DC. The computer account of the rogue host receives the DRS GUID SPN and a
GC/SPN. Event 4742 records the computer account change, and a 5136 records theservicePrincipalNamevalues when the object is audited. Operators cannot avoid this step: without the SPNs the real domain controller cannot authenticate to the rogue one. - Replication rights in use. Event 4662 on the domain object shows the control access rights for replication being exercised by an account or from a host that is not a domain controller. Events 4928 and 4929 (Detailed Directory Service Replication) record a replica source being established and removed.
- No change event for the payload. The pushed attribute produces no 5136, 4738 or 4765 on the target. What remains is replication metadata: the attribute's version number increases and its originating server is a DSA GUID that belongs to no current domain controller.
- Traffic direction. The domain controller opens an RPC connection to a workstation and makes DRS calls to it. Domain controllers normally replicate only with each other.
- On the rogue host. Loading
mimidrvinstalls a kernel driver service (System event 7045, Security 4697), and the Mimikatz process itself is visible to endpoint tooling. Operators who start from a SYSTEM shell skip the driver. - Pre-granted permissions. The delegated variant avoids using Domain Admin at push time, but the ACL changes that grant it are recorded if the objects are audited, and the non-default ACEs stay in the directory.
Detection
DCShadow hides the change, not the setup. Detection focuses on the things only a domain controller should do.
- Domain controller objects created and deleted in quick succession. A 5137 and a 5141 for a
serverornTDSDSAobject in the Configuration partition within seconds of each other, outside a domain controller promotion. The DCShadow detection rules cover this lifecycle and the SPN change. - Replication SPNs on a computer that is not a domain controller. Any
servicePrincipalNamebeginning withE3514235-4B06-11D1-AB04-00C04FC2DCD2/, or aGC/SPN, on a computer outside the domain controller inventory. - Replication from an unexpected source. Events 4928 and 4929 naming a source that is not a known domain controller, and network detection of DRS RPC calls from a domain controller to a non-DC address.
- The results. A
sIDHistoryvalue or a privilegedprimaryGroupIDon an account, found by inventory because no change event exists. See the SID history injection rules and the primary group ID changed rules, and compare AdminSDHolder against its baseline (AdminSDHolder modification rules). - Replication metadata. Attributes whose originating directory server is not a current domain controller.
// Server or NTDS Settings objects created or deleted in the Configuration partition
SecurityEvent
| where EventID in (5137, 5141)
| where EventData has "CN=Sites,CN=Configuration"
| where EventData has "nTDSDSA" or EventData has "server"
| project TimeGenerated, EventID, Computer, Account, EventData
| order by TimeGenerated asc
These events need Directory Service Changes auditing and a SACL that covers child object creation and deletion under the Sites container.
Mitigation
- Protect the rights that make it possible. DCShadow starts from Domain Admin, so everything that keeps Tier 0 credentials off ordinary machines applies: dedicated administrative accounts, privileged access workstations, no domain admin logons on member systems. The Active Directory hardening guide describes the model.
- Review delegated replication and topology rights. List who holds
DS-Install-Replica,DS-Replication-Manage-TopologyandDS-Replication-Synchronizeon the domain object, andCreateChildorDeleteChildunder the Sites container. Only domain controllers and Tier 0 administrators should. This also closes DCSync paths. - Restrict RPC from domain controllers. Host firewalls on workstations and servers, and network segmentation, should stop a domain controller from reaching RPC endpoints on machines that are not domain controllers. The pull cannot happen without that connection.
- Audit the setup steps. Enable Directory Service Changes, Directory Service Access, Detailed Directory Service Replication and Computer Account Management on domain controllers, with SACLs on the Sites container and the domain object. The Active Directory audit policy guide has the settings.
- Keep a domain controller inventory and alert on replication SPNs,
serverobjects and replication partners that are not on it. - Baseline what DCShadow targets. Scheduled checks of
sIDHistory,primaryGroupID, AdminSDHolder's ACL and replication metadata find changes that produced no event. - Plan recovery. After a confirmed DCShadow push, assume more changes exist than the ones found. Compare the directory with a known-good backup, and be ready to follow forest recovery procedures.
Detection rules for this attack
Log events to collect
FAQ
What is the difference between DCShadow and DCSync?
DCSync reads: it asks a domain controller to replicate secrets such as password hashes to the attacker. DCShadow writes: the attacker's machine poses as a domain controller and a real one replicates changes from it. Both use the directory replication protocol and both need rights that amount to control of the domain.
What privileges does DCShadow need?
Registering a domain controller requires Domain Admin or Enterprise Admin rights by default, plus SYSTEM on the machine that plays the rogue controller. A narrower delegated set has been published: replication rights on the domain, create and delete rights under the Sites container, and write access to the computer and target objects. It is a persistence and evasion technique, not a way to gain the domain.
Why is DCShadow hard to detect?
The change arrives through replication, so the domain controller applies it without writing the 5136 or account management event that an LDAP modification would produce, and no event names the attacker as the author. What remains visible is the setup: server and nTDSDSA objects created and deleted within seconds, replication SPNs on a computer that is not a domain controller, and replication traffic from a domain controller to a workstation.
References
- Rogue Domain Controller, T1207 (MITRE ATT&CK)
- DCShadow (Benjamin Delpy and Vincent Le Toux)
- [MS-DRSR]: Directory Replication Service (DRS) Remote Protocol
- Mimikatz (gentilkiwi)
- DS-Install-Replica extended right (Microsoft Learn)
- Audit Detailed Directory Service Replication (Microsoft Learn)
- Access Token Manipulation: SID-History Injection, T1134.005 (MITRE ATT&CK)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.