Skip to content

AdminSDHolder and SID History

Also calledAdminSDHolder abuse, SID history injection, SIDHistory

Two quiet ways to keep admin access, a template ACL or a SID in an account's history.

Needs
Domain AdminorDirectory Write
Gives
Domain Admin

How the Attack Works

AdminSDHolder is a template object whose security descriptor the directory stamps onto every protected admin account about once an hour, so a change to that template re-grants access across all of them at once, with nothing on the accounts to show it. SID history is an attribute that lets an account migrated between domains keep its old group memberships, so a privileged group's identifier placed there grants that group's access with no membership to show for it. Both are ordinary directory features, so the signal is a change to the AdminSDHolder object, or a SID appearing in an account's history that no migration explains.

Read first Authentication and Authorisation

How It Plays Out

The attack step by step. Each step shows which machines take part, what travels, the keys and tickets each side now holds, what is logged and what a defender can see.

A foothold on ws-042 adds the Domain Admins SID to the support account's history on dc-01, so it holds admin access with no group to show it.Step through it

ws-042 Foothold

dc-01 Domain controller

  1. Step 1 of 3, SID History Added, ws-042 to dc-01
  2. Step 2 of 3, ACL Re-Stamped, on dc-01
  3. Step 3 of 3, Hidden Admin Access, ws-042 to dc-01
  1. Step 1 of 3: SID History Added

    ws-042 Foothold to dc-01 Domain controller

    A SID added to the account history DsAddSidHistory DRS RPC

    The Domain Admins SID is added to the support account's sIDHistory on dc-01, an account never migrated between domains.

    Logged

    • 4765 SID History was added to an account

      On dc-01, in the Security log

      SID History added to CORP\support, the SID list carrying the Domain Admins SID.

    What Defenders See

    With Audit User Account Management on, dc-01 writes event 4765 naming the target account and the SID added.

  2. Step 2 of 3: ACL Re-Stamped

    On dc-01 Domain controller

    Every hour the PDC stamps the AdminSDHolder ACL onto the protected accounts, so a tampered template re-grants access across all of them.

    Logged

    • 4780 The ACL was set on accounts which are members of administrators groups

      On dc-01, in the Security log When enabled

      The ACL on admin-group members reset to the AdminSDHolder template.

    What Defenders See

    The Security log on dc-01 shows event 4780 as each admin account's ACL is reset to the template, whatever that template now grants.

  3. Step 3 of 3: Hidden Admin Access

    ws-042 Foothold to dc-01 Domain controller

    Admin access with no membership LDAP SearchRequest LDAP, port 389

    The support account reaches the directory as a Domain Admin through the SID in its history, with no group membership to show it.

    What Defenders See

    The Security log on dc-01 shows the support account using admin rights while it is in no admin group. Defender for Identity raises its SID-history injection and AdminSDHolder alerts.

Needs First

What the attacker must already hold for this attack to be possible.

  • Domain Admin Rights or Write Access to a Directory ObjectDomain Admin, or write access to AdminSDHolder or an account's SID history.

Gives the Attacker

What running it hands the attacker to use next.

  • Domain Admin RightsLasting admin access that no group membership shows, through the template ACL or the SID in history.

What Defenders See

What this attack leaves for a defender to find, and what to read in each. None of it is proof on its own, so treat each as a lead and confirm it against the rest.

Event and LogWritten OnLook ForSwitch It On
5136 A directory service object was modified (opens in a new tab) Security logDomain controllers, for objects with a matching audit entryA change to the AdminSDHolder object, or to an account's sIDHistory, with an audit entry set and Audit Directory Service Changes on.Audit Directory Service Changes, and an audit entry (SACL) on the object
4765 SID History was added to an account (opens in a new tab) Security logDomain controllersSID history added to an account that was never migrated, the SID list naming a privileged group such as Domain Admins.Audit User Account Management
4766 An attempt to add SID History to an account failed (opens in a new tab) Security logDomain controllersA failed attempt to add SID history, which can mark a blocked or mistimed attempt worth running down.Audit User Account Management
4780 The ACL was set on accounts which are members of administrators groups (opens in a new tab) Security logThe domain controller that holds the PDC role, when its hourly check resets an admin account to the AdminSDHolder templateThe ACL reset on admin-group members to the AdminSDHolder template, which lands whatever that template now grants.Audit User Account Management

What It Looks Like

One event from the worked example, decoded field by field, so you can see what to read in it and what each value means.

4765 SID History was added to an account

In the Security log on dc-01,

A Domain Admins SID added to the support account's history on dc-01.

  • The account that gained SID history, the new support account from the incident. It was never migrated between domains, so it should have none.

    As Windows writes it: Target Account CORP\support

  • The SID added ends 512, the Domain Admins group. The support account now carries Domain Admin access with no group membership to show it.

    As Windows writes it: SID List S-1-5-21-...-512

  • The account that made the change. Find where it signed in from, since its rights did this.

    As Windows writes it: Source Account CORP\Administrator

Defender for Identity Alerts

Where Defender for Identity runs, its sensors raise these from what they read on the servers they are installed on, domain controllers above all. Each names what it flags, which is a lead to confirm, not proof on its own.

Blind Spots

Where this attack leaves little or nothing to see, so a quiet log is not read as an all-clear.

  • SID history re-grants a group's access with no event 4728 in the Security log, so a membership review misses it. The sIDHistory attribute has to be read on each account.
  • A tampered AdminSDHolder re-applies its access control list every hour, so correcting one account is undone until the template object itself is put right.

Hunt It

The query to run in each tool, and how well each one sees this attack. Pick the tool you use, and the others load their query when you open them.

Needs Defender for Identity sensors on every DC. The alerts mark a changed AdminSDHolder object or a new SID in an account's history. Read the account's sIDHistory and the template's access control list to confirm.

KQLDefender XDR, Advanced hunting
// Defender for Identity AdminSDHolder and SID-history alertsAlertEvidence| where Timestamp > ago(30d)| where Title contains "AdminSdHolder" or Title contains "SID-History" or Title contains "SID History"| summarize FirstSeen = min(Timestamp), Accounts = make_set_if(AccountName, isnotempty(AccountName)), Devices = make_set_if(DeviceName, isnotempty(DeviceName)), Addresses = make_set_if(RemoteIP, isnotempty(RemoteIP)) by AlertId, Title| order by FirstSeen desc

How to Prevent It

The controls that break this attack, each with how it helps here and, where the Registry topic has it, where to check it on a machine.

Sources