1. Resources
  2. Detection rules
  3. SID-History Injection

SID-History Injection detection rules

Adding a privileged SID, such as that of Domain Admins, to an account's sIDHistory grants the account that privilege without any group membership. 4765 and 4766 record SID History additions; 4738 and 4742 show sIDHistory changes.

Platform
Active Directory
Severity
High
Log source
Windows Security event log
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Domain administrator rights or equivalent control of the domain controllers, or a rogue replication path such as DCShadow.
Impact
The account gains the injected group's privileges, typically domain or forest administrator, while membership reviews of privileged groups show nothing unusual.
Response
Disable the account that carries the injected SID, remove the unauthorized value from sIDHistory, and handle the domain as compromised at administrator level.
Mitigation
Keep SID filtering enabled on external and forest trusts, and clear sIDHistory once migrations are complete.
Event IDs
47654766473847424675
Threat groups
None listed in MITRE ATT&CK for this technique

How the attack works

The sIDHistory attribute keeps the SIDs an account had in a previous domain so that migrated users keep their access. Windows adds every SID in sIDHistory to the account's access token at logon, so a SID placed there grants all of its rights without the account appearing in the corresponding group.

Attackers who have reached domain administrator or domain controller level add the SID of a privileged group or account (Domain Admins, Enterprise Admins, the built-in Administrator) to an inconspicuous account for persistence or, across trusts without SID filtering, to escalate into another domain. Domain controllers log additions made through the SID History migration interface in event 4765 and failed attempts in 4766; changes to the attribute also appear in the SidHistory field of 4738 (users) and 4742 (computers). Values written through rogue replication (DCShadow) or by editing the database offline do not produce these events. However the value was written, a domain controller of a trusting domain logs event 4675 (SIDs were filtered) when the account authenticates across a trust that filters the SID, and the event lists the SIDs that were removed.

What an attacker needs

  • Domain administrator rights or equivalent control of the domain controllers, or a rogue replication path such as DCShadow.
  • For escalation into another domain, a trust without SID filtering.

Impact

The account gains the injected group's privileges, typically domain or forest administrator, while membership reviews of privileged groups show nothing unusual. The access survives password resets of the real administrators.

Detection rules

SID History Added to an Account

Detects SID History being added to an account (4765) and failed attempts to add it (4766) on a domain controller. Outside a planned domain migration, adding SID History is a persistence or privilege escalation technique. Requires Audit User Account Management.

LevelHighStatusExperimentalLog sourceWindows Security event log
title: SID History Added to an Account
id: 0d196366-2fb4-45f8-b79b-6ad7e7a76200
status: experimental
description: >-
  Detects SID History being added to an account (4765) and failed attempts to
  add it (4766) on a domain controller. Outside a planned domain migration,
  adding SID History is a persistence or privilege escalation technique.
  Requires Audit User Account Management.
references:
  - https://attack.mitre.org/techniques/T1134/005/
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4765
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4766
author: Forestall
date: 2026-11-10
tags:
  - attack.privilege-escalation
  - attack.t1134.005
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID:
      - 4765
      - 4766
  condition: selection
falsepositives:
  - Domain migrations that copy SID History on purpose. Confirm the migration window and the account that runs the migration tool.
level: high

False positives

  • Domain migrations that copy SID History on purpose. Confirm the migration window and the account that runs the migration tool.

SID History Changed on a User or Computer Account

Detects a user or computer account change (4738, 4742) whose SidHistory field carries a value. Microsoft documents that the field is "-" unless the sIDHistory attribute changed, so any other value means SID History was written, whether through the migration interface or by direct modification. Requires Audit User Account Management and Audit Computer Account Management.

LevelHighStatusExperimentalLog sourceWindows Security event log
title: SID History Changed on a User or Computer Account
id: 77283dcc-e94e-44df-a4f9-53cd72e6d508
status: experimental
description: >-
  Detects a user or computer account change (4738, 4742) whose SidHistory field
  carries a value. Microsoft documents that the field is "-" unless the
  sIDHistory attribute changed, so any other value means SID History was
  written, whether through the migration interface or by direct modification.
  Requires Audit User Account Management and Audit Computer Account Management.
references:
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4738
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4742
author: Forestall
date: 2026-11-10
tags:
  - attack.privilege-escalation
  - attack.t1134.005
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID:
      - 4738
      - 4742
  filter_not_changed:
    SidHistory:
      - '-'
      - '%%1793'
      - ''
  condition: selection and not filter_not_changed
falsepositives:
  - Domain migrations that copy or clean up SID History. Confirm the migration window; removals may appear with a value other than "-" and can be verified on the object.
level: high

False positives

  • Domain migrations that copy or clean up SID History. Confirm the migration window; removals may appear with a value other than "-" and can be verified on the object.

SIDs Filtered for an Account Authenticating Across a Trust

Detects event 4675 (SIDs were filtered), which a domain controller of the trusting domain writes when SID filtering removes security identifiers from an account that authenticates across an Active Directory trust. This is the place where a SID that was injected into sIDHistory in the trusted domain becomes visible to the other side, because the filter stops it and names it. The event text holds the target account, the direction, type and attributes of the trust, the domain SID of the trusted domain object and the filtered SIDs. Microsoft documents that text but gives no example of the event and no field names, so the rule matches on the event ID. Read the filtered SIDs in the event. A SID of the trusting domain itself, or one with a privileged RID such as 512 or 519, was never the leftover of a migration. Requires Audit Logon on domain controllers.

LevelMediumStatusExperimentalLog sourceWindows Security event log
title: SIDs Filtered for an Account Authenticating Across a Trust
id: 7361a876-454d-416c-972c-aa59e2682629
status: experimental
description: >-
  Detects event 4675 (SIDs were filtered), which a domain controller of the
  trusting domain writes when SID filtering removes security identifiers from
  an account that authenticates across an Active Directory trust. This is the
  place where a SID that was injected into sIDHistory in the trusted domain
  becomes visible to the other side, because the filter stops it and names it.
  The event text holds the target account, the direction, type and attributes
  of the trust, the domain SID of the trusted domain object and the filtered
  SIDs. Microsoft documents that text but gives no example of the event and no
  field names, so the rule matches on the event ID. Read the filtered SIDs in
  the event. A SID of the trusting domain itself, or one with a privileged RID
  such as 512 or 519, was never the leftover of a migration. Requires Audit
  Logon on domain controllers.
references:
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4675
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/audit-logon
  - https://attack.mitre.org/techniques/T1134/005/
author: Forestall
date: 2026-11-16
tags:
  - attack.privilege-escalation
  - attack.t1134.005
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4675
  condition: selection
falsepositives:
  - Accounts that were migrated from another domain and still carry SID History, when they authenticate across a trust that filters those SIDs. They produce the event at every logon until the attribute is cleaned up. Exclude them by the fields your collector extracts from the event, after reviewing the filtered SIDs.
  - The rule has no further conditions, so every event 4675 matches. In a forest with many trusts and migrated accounts, expect to baseline it before alerting.
level: medium

False positives

  • Accounts that were migrated from another domain and still carry SID History, when they authenticate across a trust that filters those SIDs. They produce the event at every logon until the attribute is cleaned up. Exclude them by the fields your collector extracts from the event, after reviewing the filtered SIDs.
  • The rule has no further conditions, so every event 4675 matches. In a forest with many trusts and migrated accounts, expect to baseline it before alerting.

Detection logic

Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.

Logon with administrator-level privileges by an account that is in no administrative group

Detection hypothesisNeeds your own lists

Windows adds every SID in sIDHistory to the access token at logon, so an injected SID of Domain Admins gives the account that group's privileges while the group's member list stays unchanged. A logon on a domain controller that receives administrator-level privileges, for an account that no administrative membership explains, is that pattern. It also finds values written through rogue replication or offline, which produce none of the events the rules read.

  1. From the Security log of the domain controllers, take event 4672 (special privileges assigned to new logon) and keep SubjectUserSid, SubjectUserName and PrivilegeList.
  2. Leave out LOCAL SYSTEM, NETWORK SERVICE, LOCAL SERVICE and the domain controller computer accounts, as Microsoft's monitoring recommendation for this event does.
  3. Leave out the accounts on your list of expected administrators: the direct and nested members of Administrators, Domain Admins, Enterprise Admins, Schema Admins and the built-in operator groups, and the service accounts granted these privileges by policy.
  4. Report every other account and read its sIDHistory, its group memberships and the user rights assigned on the domain controllers, to find what put the privileges in its token.

Events4672

LimitsAccounts granted one of these privileges directly through user rights assignment, such as backup software, appear as well and belong on the list. The list has to follow membership changes, or a new administrator shows up as a finding. It needs Audit Special Logon on the domain controllers, and it sees only accounts that log on to them. An injected SID of a group that grants no such privilege is not seen.

Triage

  • Read the account's sIDHistory and resolve each SID. A SID of a privileged group, a SID from the account's own domain, or any value outside a migration window is malicious until proven otherwise.
  • Check the subject that made the change and whether a domain migration project is running.
  • Review the account's logons and actions since the change. If confirmed, clear the attribute, reset the account and investigate the domain for further persistence.

Response

Once the attack is confirmed:

  1. Disable the account that carries the injected SID and end its sessions.
  2. Remove the unauthorized value from sIDHistory on that account and reset its credentials.
  3. Handle the domain as compromised at administrator level. Writing the attribute takes domain administrator rights, control of a domain controller or a rogue replication path, so find and remove that access.
  4. If the account was used in another domain across a trust, inform the administrators of that domain, review what the account did there and confirm that SID filtering is enabled on the trust.
  5. Search every account in the domain for sIDHistory values that contain a privileged RID or a SID of the same domain. An attacker who hid one account this way may have hidden more.

Mitigation

  • Keep SID filtering enabled on external and forest trusts and do not disable it for convenience.
  • Clear sIDHistory once migrations are complete, and alert on any value that contains a privileged RID (500, 512, 518, 519) or a SID from the same domain.
  • Restrict domain administrator and replication rights so that only Tier 0 operators can write sIDHistory.

Frequently asked questions

Why does the account have administrator rights without being in an admin group?

Windows adds every SID in sIDHistory to the access token of the account at logon. A SID of Domain Admins placed there grants the rights of that group, while the member list of the group does not change. Membership reviews therefore show nothing unusual, and only the attribute itself reveals it.

Which SID History changes do these rules not see?

Values written through rogue replication (DCShadow) or by editing the database offline do not produce events 4765, 4766, 4738 or 4742. An attacker with domain controller level access can use those ways, so add a regular review of sIDHistory values to the event-based detection. The Detection logic section describes a check of administrator-level logons by accounts in no administrative group, which does not depend on how the value was written.

Is SID History ever legitimate?

Yes, in a domain migration. The attribute keeps the SIDs an account had in a previous domain so that migrated users keep their access. It should be cleared once the migration is complete. A SID of a privileged group, a SID from the account's own domain, or any value written outside a migration window is malicious until proven otherwise.

Does SID filtering protect against this?

It protects the other side of a trust. With SID filtering enabled on external and forest trusts, an injected SID cannot be used to escalate into another domain. Inside the domain where the value was written, every SID in sIDHistory is still added to the token at logon.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.