Skip to content

Commit 3e4575c

Browse files
authored
Merge pull request #1927 from HackTricks-wiki/update_Dynamic_Objects_in_Active_Directory__The_Stealthy__20260220_184711
Dynamic Objects in Active Directory The Stealthy Threat
2 parents 7e05678 + 119fc42 commit 3e4575c

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@
291291
- [AD CS Domain Persistence](windows-hardening/active-directory-methodology/ad-certificates/domain-persistence.md)
292292
- [AD CS Certificate Theft](windows-hardening/active-directory-methodology/ad-certificates/certificate-theft.md)
293293
- [Ad Certificates](windows-hardening/active-directory-methodology/ad-certificates.md)
294+
- [Ad Dynamic Objects Anti Forensics](windows-hardening/active-directory-methodology/ad-dynamic-objects-anti-forensics.md)
294295
- [AD information in printers](windows-hardening/active-directory-methodology/ad-information-in-printers.md)
295296
- [AD DNS Records](windows-hardening/active-directory-methodology/ad-dns-records.md)
296297
- [Adws Enumeration](windows-hardening/active-directory-methodology/adws-enumeration.md)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,14 @@ The **security descriptors** are used to **store** the **permissions** an **obje
639639
security-descriptors.md
640640
{{#endref}}
641641

642+
### Dynamic Objects Anti-Forensics / Evasion
643+
644+
Abuse the `dynamicObject` auxiliary class to create short-lived principals/GPOs/DNS records with `entryTTL`/`msDS-Entry-Time-To-Die`; they self-delete without tombstones, erasing LDAP evidence while leaving orphan SIDs, broken `gPLink` references, or cached DNS responses (e.g., AdminSDHolder ACE pollution or malicious `gPCFileSysPath`/AD-integrated DNS redirects).
645+
646+
{{#ref}}
647+
ad-dynamic-objects-anti-forensics.md
648+
{{#endref}}
649+
642650
### Skeleton Key
643651

644652
Alter **LSASS** in memory to establish a **universal password**, granting access to all domain accounts.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# AD Dynamic Objects (dynamicObject) Anti-Forensics
2+
3+
{{#include ../../banners/hacktricks-training.md}}
4+
5+
## Mechanics & Detection Basics
6+
7+
- Any object created with the auxiliary class **`dynamicObject`** gains **`entryTTL`** (seconds countdown) and **`msDS-Entry-Time-To-Die`** (absolute expiry). When `entryTTL` reaches 0 the **Garbage Collector deletes it without tombstone/recycle-bin**, erasing creator/timestamps and blocking recovery.
8+
- TTL can be refreshed by updating `entryTTL`; min/default are enforced in **Configuration\Services\NTDS Settings → `msDS-Other-Settings``DynamicObjectMinTTL` / `DynamicObjectDefaultTTL`** (supports 1s–1y but commonly defaults to 86,400s/24h). Dynamic objects are **unsupported in Configuration/Schema partitions**.
9+
- Deletion can lag a few minutes on DCs with short uptime (<24h), leaving a narrow response window to query/backup attributes. Detect by **alerting on new objects carrying `entryTTL`/`msDS-Entry-Time-To-Die`** and correlating with orphan SIDs/broken links.
10+
11+
## MAQ Evasion with Self-Deleting Computers
12+
13+
- Default **`ms-DS-MachineAccountQuota` = 10** lets any authenticated user create computers. Add `dynamicObject` during creation to have the computer self-delete and **free the quota slot** while wiping evidence.
14+
- Powermad tweak inside `New-MachineAccount` (objectClass list):
15+
```powershell
16+
$request.Attributes.Add((New-Object "System.DirectoryServices.Protocols.DirectoryAttribute" -ArgumentList "objectClass", "dynamicObject", "Computer")) > $null
17+
```
18+
- Short TTL (e.g., 60s) often fails for standard users; AD falls back to **`DynamicObjectDefaultTTL`** (example: 86,400s). ADUC may hide `entryTTL`, but LDP/LDAP queries reveal it.
19+
20+
## Stealth Primary Group Membership
21+
22+
- Create a **dynamic security group**, then set a user’s **`primaryGroupID`** to that group’s RID to gain effective membership that **doesn’t show in `memberOf`** but is honored in Kerberos/access tokens.
23+
- TTL expiry **deletes the group despite primary-group delete protection**, leaving the user with a corrupted `primaryGroupID` pointing to a non-existent RID and no tombstone to investigate how the privilege was granted.
24+
25+
## AdminSDHolder Orphan-SID Pollution
26+
27+
- Add ACEs for a **short-lived dynamic user/group** to **`CN=AdminSDHolder,CN=System,...`**. After TTL expiry the SID becomes **unresolvable (“Unknown SID”)** in the template ACL, and **SDProp (~60 min)** propagates that orphan SID across all protected Tier-0 objects.
28+
- Forensics lose attribution because the principal is gone (no deleted-object DN). Monitor for **new dynamic principals + sudden orphan SIDs on AdminSDHolder/privileged ACLs**.
29+
30+
## Dynamic GPO Execution with Self-Destructing Evidence
31+
32+
- Create a **dynamic `groupPolicyContainer`** object with a malicious **`gPCFileSysPath`** (e.g., SMB share à la GPODDITY) and **link it via `gPLink`** to a target OU.
33+
- Clients process the policy and pull content from attacker SMB. When TTL expires, the GPO object (and `gPCFileSysPath`) vanishes; only a **broken `gPLink`** GUID remains, removing LDAP evidence of the executed payload.
34+
35+
## Ephemeral AD-Integrated DNS Redirection
36+
37+
- AD DNS records are **`dnsNode`** objects in **DomainDnsZones/ForestDnsZones**. Creating them as **dynamic objects** allows temporary host redirection (credential capture/MITM). Clients cache the malicious A/AAAA response; the record later self-deletes so the zone looks clean (DNS Manager may need zone reload to refresh view).
38+
- Detection: alert on **any DNS record carrying `dynamicObject`/`entryTTL`** via replication/event logs; transient records rarely appear in standard DNS logs.
39+
40+
## Hybrid Entra ID Delta-Sync Gap (Note)
41+
42+
- Entra Connect delta sync relies on **tombstones** to detect deletes. A **dynamic on-prem user** can sync to Entra ID, expire, and delete without tombstone—delta sync won’t remove the cloud account, leaving an **orphaned active Entra user** until a manual **full sync** is forced.
43+
44+
## References
45+
46+
- [Dynamic Objects in Active Directory: The Stealthy Threat](https://www.tenable.com/blog/active-directory-dynamic-objects-stealthy-threat)
47+
48+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)