Event ID 4765: sid history added to an account
What Event ID 4765 (sid history added to an account) means, the fields to check, what is normal and what is suspicious, with PowerShell and KQL queries to find it.
Event ID 4765 says SID History was added to an account. SID History exists for domain migrations: it lets a moved account keep access to resources that still trust its old SID. Attackers like it for the same reason. If they add the SID of Domain Admins or Enterprise Admins to an ordinary user's SID History, that user quietly gets those rights without appearing in any admin group. Outside a migration project, a 4765 is close to proof of compromise.
The fields that matter
| Field | What it tells you |
|---|---|
| Subject > Account Name | Who added the SID History. |
| Target Account > Account Name | The account that received the extra SIDs. |
| Source Account > Account Name | The account the SID came from, during a real migration usually in the old domain. |
| Additional Information > SID List | The SIDs added. A SID ending in -512 (Domain Admins), -519 (Enterprise Admins) or -544 (Administrators) is the worst case. |
What is normal
Migrations with ADMT or a third-party migration tool, which add SID History for many accounts in a short window, run by the migration team, with old-domain SIDs.
When Event ID 4765 is suspicious
- Any 4765 when no migration is running.
- A SID in the list from your own domain rather than an old one, especially a well-known admin group SID.
- The Target Account is a normal user, a service account or a recently created account.
- A 4765 with no matching migration tooling on the server that made the change.
Common false positive: Domain migrations and mergers. Once the migration is finished, clean up SID History and turn on SID filtering on the trust, so any later 4765 is unambiguous.
Find Event ID 4765 with PowerShell
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4765; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 50 |
ForEach-Object {
$d = [ordered]@{ Time = $_.TimeCreated; Computer = $_.MachineName }
([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
[pscustomobject]$d
} | Format-List
Microsoft Sentinel (KQL)
SecurityEvent
| where TimeGenerated > ago(7d) and EventID == 4765
| project TimeGenerated, Computer, Account, Activity, EventData
| order by TimeGenerated desc
Related events
- Event ID 4766: SID History add attempt failed
- Event ID 4738: User account changed
- Event ID 4728: Member added to global security group
- Event ID 4662: Operation performed on an AD object
FAQ
How do I find accounts that already have SID History?
Run Get-ADUser -Filter * -Properties SIDHistory | Where-Object SIDHistory (and the same with Get-ADGroup and Get-ADComputer). After a finished migration the list should be short, and none of the SIDs should belong to your own domain.
Does every SID History injection create Event ID 4765?
No. Mimikatz sid::add running against a DC is logged, but a change pushed through DCShadow skips the normal write path. Check accounts for SID History directly as well, and watch for 4928 and 4929.
What is the difference between 4765 and 4766?
4765 is a successful add; 4766 is a failed attempt. A 4766 still tells you someone tried, so treat it just as seriously.
Windows Event Triage reads a CSV, EVTX-to-JSON or XML export in your browser and flags brute force, new admins, suspicious services and log clearing.
IOC Triage, our free browser extension: right-click it for a verdict from 15 threat-intel sources, then copy a ready ticket note.