1. Resources
  2. Detection sources
  3. Event ID 4765

Event ID 4765: SID History was added to an account

Written by a domain controller when SIDs are added to an account's SID History, which gives the account the access of those SIDs. Expected during a planned domain migration; any other occurrence deserves a look.

Log source
Windows Security log
Detection value
Supporting
Volume
Low
Last updated
Audit subcategory
Audit User Account Management (Account Management, Success)
Logged on
Domain controllers only
Event versions
0
Detects
1 attack (1 rule)
MITRE ATT&CK
1 technique in 2 tactics
Fields the rules read
The event ID and the provider only

When it is written

A domain controller writes 4765 when SID History is added to an account. SID History holds SIDs that an account had in another domain. Windows puts them in the account's access token at logon, so the account gets every access granted to those SIDs, wherever the trusts let them through.

The documented way to add SID History is Microsoft's migration function, DsAddSidHistory. It only works between domains of different forests, requires Domain Admins in the destination domain and administrator rights in the source, and refuses to run unless account management auditing (success and failure) is on in both domains. Microsoft's description of the function says the destination domain then writes an "Add SID History" audit event for each successful or failed operation; 4765 and 4766 are the events Microsoft documents for an addition and for a failed attempt. The source domain records the operation differently: the source account is added to and removed from a local group named after the source domain with three dollar signs (SOURCE$$$). Microsoft also notes that moving an object from one domain to another puts its previous SID in SID History; it does not say whether that move writes 4765.

Only domain controllers write the event. Microsoft's event page has no sample event and no field descriptions beyond the message layout.

How to turn it on

Advanced audit policy subcategory Audit User Account Management, Success. Set it in a Group Policy object linked to the computers that write the event:

Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > Audit Policies > Account Management > Audit User Account Management
Microsoft's recommendation per computer role
ComputerAuditNote
Domain controllersSuccess and FailureMicrosoft's general and stronger baselines both recommend Success and Failure auditing. Microsoft calls the subcategory useful for watching critical domain accounts (domain admins, service accounts, database admins) and recommends Failure auditing mainly for invalid password change and reset attempts on domain accounts, failed changes of the DSRM password and failed SID History additions.
Member serversSuccess and FailureBoth baselines recommend Success and Failure auditing. Microsoft recommends watching every change to local user accounts, especially the built-in local Administrator and other critical accounts, and Failure auditing mainly for invalid password change and reset attempts on local accounts.
WorkstationsSuccess and FailureBoth baselines recommend Success and Failure auditing. Microsoft recommends watching every change to local user accounts, especially the built-in local Administrator and other critical accounts, and Failure auditing mainly for invalid password change and reset attempts on local accounts.
Check the current setting
auditpol /get /subcategory:"User Account Management"
Based on vendor documentation.
Turn it on (local policy; a domain GPO overrides it)
auditpol /set /subcategory:"User Account Management" /success:enable
Based on vendor documentation.
The same on a Windows in another display language
auditpol /get /subcategory:"{0CCE9235-69AE-11D9-BED3-505054503030}"
Based on vendor documentation.

Run the commands in an elevated prompt on a computer that writes the event. Subcategory settings take effect only when the security option Audit: Force audit policy subcategory settings (Windows Vista or later) to override audit policy category settings is enabled (the default), and a Group Policy object that sets advanced audit policy replaces local changes at its next refresh. Microsoft's advanced audit policy reference

Fields

In Event Viewer order. The field names are those of the event XML, from the event template that ships with Windows.

FieldWhat it holdsSince
Security IDSubjectUserSidSubjectSID of the account that added SID History. Event Viewer resolves it to a name when it can.v0
Account NameSubjectUserNameSubjectName of the account that added SID History. The migration function requires it to be a member of Domain Admins in the destination domain.v0
Account DomainSubjectDomainNameSubjectDomain of that account.v0
Logon IDSubjectLogonIdSubjectLogon ID of the session that made the change, in hexadecimal. The logon event of that session (4624) on the same domain controller carries the same value.v0
Security IDTargetSidTarget AccountSID of the account that received SID History. Event Viewer resolves it to a name when it can.v0
Account NameTargetUserNameTarget AccountName of the account that received SID History.v0
Account DomainTargetDomainNameTarget AccountDomain of that account, as a NetBIOS or DNS name.v0
Security IDSourceSidSource AccountSID of that source account. Its domain part is the source domain.v0
Account NameSourceUserNameSource AccountName of the account in the source domain whose SID was copied (shown as Account Name under Source Account).v0
PrivilegesPrivilegeListAdditional InformationPrivileges used for the operation, such as SeBackupPrivilege. Often a dash.v0
SID ListSidListAdditional InformationShown as SID List: the SIDs added to the account's SID History. Microsoft's page does not describe it. The migration function adds the source account's SID and, from a native mode source domain, the source account's own SID History too, so expect more than one SID at times.v0

Values to know

SID List SidList

ValueMeaningSignal
SIDs of the source domain, during a planned migrationOrdinary migrationThe migration function adds the source account's SID and, from a source domain in Windows 2000 native mode or later, the source account's own SID History.Expected
A SID of a domain in your own forestNot from the migration functionDsAddSidHistory refuses source and destination domains in the same forest. Microsoft notes that moving an account between domains keeps its old SID in SID History; outside such a move, this SID was written some other way.Attack signal
A SID with a privileged RID (500, 512, 518, 519)The SID of an administrator account or group of the domain it belongs toThe account gains administrator access wherever that SID is honored, with no group membership to show for it.Attack signal

Account Name SubjectUserName

ValueMeaningSignal
The migration account, during a change windowPlanned migrationExpected
Any other accountSID History added outside a planned migrationThe SID History rule alerts on every 4765 and 4766.Attack signal

Volume and noise

None in normal operation. SID History is added while accounts are migrated between domains, so expect a burst of events during a planned migration, with the migration tool's account as Subject, and nothing outside it.

Keeping it manageable

  • Collect 4765 and 4766 from every domain controller and keep every event: they are rare, and the SID History rule alerts on each one.
  • During a planned migration, suppress the alert only for the migration account (SubjectUserSid) and the migration window, and check that every SID in SidList belongs to the source domain.
  • Microsoft's own threat model for the function lists an on-disk change of SID History on a domain controller as a path that does not go through it. Do not rely on 4765 alone: the SID History rule also reads the SidHistory field of 4738 and 4742.

Sample event

Version 0, with made-up values.

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-Security-Auditing" Guid="{54849625-5478-4994-a5ba-3e3b0328c30d}" />
    <EventID>4765</EventID>
    <Version>0</Version>
    <Level>0</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8020000000000000</Keywords>
    <TimeCreated SystemTime="2026-11-18T09:30:12.4567890Z" />
    <EventRecordID>1048576</EventRecordID>
    <Correlation />
    <Execution ProcessID="712" ThreadID="2408" />
    <Channel>Security</Channel>
    <Computer>DC01.corp.example.com</Computer>
    <Security />
  </System>
  <EventData>
    <Data Name="SourceUserName">bob</Data>
    <Data Name="SourceSid">S-1-5-21-2603914437-1287930421-3361720158-1108</Data>
    <Data Name="TargetUserName">bob</Data>
    <Data Name="TargetDomainName">CORP</Data>
    <Data Name="TargetSid">S-1-5-21-1004336348-1177238915-682003330-1121</Data>
    <Data Name="SubjectUserSid">S-1-5-21-1004336348-1177238915-682003330-1130</Data>
    <Data Name="SubjectUserName">svc-migration</Data>
    <Data Name="SubjectDomainName">CORP</Data>
    <Data Name="SubjectLogonId">0x5b2c11</Data>
    <Data Name="PrivilegeList">-</Data>
    <Data Name="SidList">S-1-5-21-2603914437-1287930421-3361720158-1108</Data>
  </EventData>
</Event>

Attacks this event reveals

Detection rules that read this event:

Frequently asked questions

What is SID History and why does adding it matter?

SID History keeps the SIDs an account had in another domain so that it keeps its old access after a migration. Windows puts those SIDs in the account's access token at logon. Adding the SID of a privileged account or group therefore gives that privilege without any group membership that a review of group members would show.

Can SID History change without a 4765?

Yes. Microsoft's threat model for the migration function lists a change of SID History made on the domain controller's disk, outside the function. Watch the `SidHistory` field of 4738 and 4742 as well, and directory change events (5136) where the attribute is audited.

What does a legitimate migration look like in the logs?

A burst of 4765 events in a planned window, all with the migration account as Subject and SIDs of the source domain in the SID List. In the source domain, the source accounts are added to and removed from a group named after the source domain with three dollar signs, which writes group membership events there.

References