SID, RID and Windows Identity: The Foundational Mental Model
Concept
Section titled βConceptβA Security Identifier (SID) is a variable-length binary data structure utilized by Windows to definitively identify security principals:
- Users (human operators and service accounts).
- Security Groups (local, domain global, domain local, universal).
- Computers (
COMPUTER$domain machine accounts). - Built-in contexts and special authorities (Well-Known SIDs).
The Relative Identifier (RID) is the terminal numerical sub-authority segment of the SID. It is assigned sequentially by the issuing authority (either the local host SAM or the Active Directory RID Master FSMO role holder).
Why This Matters in DFIR
Section titled βWhy This Matters in DFIRβFor digital forensics and incident response analysts, SID fluency is essential to avoid catastrophic misattributions:
- Account Recreation Traps: An adversary creates
svc_temp, performs actions, and deletes it. A system administrator later legitimately creates an account with the same name. Log records contain the original SID (e.g., RID1142), definitively proving the current account (RID1185) did not author the historic malicious activity. - Offline Disk Triage: When analyzing disk images without live Domain Controller connectivity, Windows cannot resolve SIDs to text strings. Analysts must decompose raw SIDs to determine privileges.
- Persistence via
sIDHistory: Threat actors usingMimikatzcan inject high-privileged SIDs (such asDomain AdminsRID512) into thesIDHistoryattribute of a standard user. The account appears unprivileged in LDAP inspection, yet its logon access token contains administrative authority (see Doc 18: Cross-Domain Group Membership and Foreign Security Principals).
How It Works
Section titled βHow It Worksβ1. Structural Anatomy of a SID
Section titled β1. Structural Anatomy of a SIDβConsider the following SID string: S-1-5-21-3623811015-3361044348-30300820-1013
S - 1 - 5 - 21 - 3623811015 - 3361044348 - 30300820 - 1013β β β β ββββββββββββββββββββββββββββββββββββ βββ RID (Relative Identifier)β β β β Domain Identifier (Sub-Authority)β β β βββ Non-unique Sub-Authority specifier (NT Authority)β β βββββββ Top-Level Authority (5 = SECURITY_NT_AUTHORITY)β βββββββββββ Revision Level (always 1 in current Windows)βββββββββββββββ String Literal PrefixS: Standard string prefix identifying a SID.1: Specification revision level.5: Security Authority (SECURITY_NT_AUTHORITY).21: Specifies that the subsequent authority identifies an Active Directory domain or local host SAM.3623811015-3361044348-30300820: The Domain SID. A 96-bit random integer set assigned during OS setup or AD domain promotion. Every account belonging to this authority shares this identical prefix.1013: The RID. Monotonically increasing identifier uniquely indexing the object within this domain or SAM.
2. Reserved RIDs & Well-Known SIDs
Section titled β2. Reserved RIDs & Well-Known SIDsβCertain RIDs and SIDs are universal across every Windows machine and Active Directory installation:
| SID / RID | Representation | Authority & Scope |
|---|---|---|
RID 500 | Built-in Administrator | ...-500 exists on every SAM host and AD domain. |
RID 501 | Built-in Guest | Disabled by default. |
RID 502 | krbtgt Service Account | Key distribution center service account in Active Directory. |
RID 512 | Domain Admins | Domain-wide administrative group. |
RID 513 | Domain Users | Standard domain user baseline group. |
RID 516 | Domain Controllers | Computer accounts of all DCs in the domain. |
RID 519 | Enterprise Admins | Forest-root administrative group. |
S-1-5-18 | NT AUTHORITY\SYSTEM | Operating system kernel identity (LocalSystem). |
S-1-5-19 | NT AUTHORITY\LOCAL SERVICE | Restricted local service context. |
S-1-5-20 | NT AUTHORITY\NETWORK SERVICE | Local service presenting host machine identity (COMPUTER$) on the network. |
S-1-5-32-544 | BUILTIN\Administrators | Local machine administrative group present on every Windows OS. |
What Is Possible
Section titled βWhat Is Possibleβ- Renaming Without Altering Identity: Renaming
AdministratortoGuest_Supportdoes not alter its RID500. It retains full administrative powers. - Determining Authority by Inspection: Comparing the 3 sub-authority blocks immediately demonstrates whether two log entries share the same domain authority or belong to separate SAMs.
- Tracking Orphaned ACLs: When an NTFS permission displays
S-1-5-21-...-1045rather than a name, it proves the principal was deleted from the directory or originates from an unreachable foreign domain.
What Is Not Possible
Section titled βWhat Is Not Possibleβ- Inheriting Permissions via Recreation: Deleting
CORP\alice(RID1105) and recreatingCORP\aliceyields RID1106. The new object inherits none of the direct ACL permissions granted to RID1105. - Duplicate RIDs Within a Single Authority: The RID Master guarantees strict monotonicity and uniqueness within the issuing domain.
- Unprivileged SID Forgery: Standard users cannot modify or forge SIDs inside an active logon token; this requires kernel-level or LocalSystem privileges (
SeTcbPrivilege).
Forensic Traps
Section titled βForensic TrapsβConcrete DFIR Scenario: SIDHistory Abuse
Section titled βConcrete DFIR Scenario: SIDHistory AbuseβIn a forest with two domains (CHILD.CORP and ROOT.CORP), an adversary compromises CHILD.CORP and seeks persistent, undetected control over ROOT.CORP:
- The attacker selects standard user
CHILD\jdoe(SID:S-1-5-21-222-333-444-1102). - Using
Mimikatz(misc::addsid), the attacker writes the SID ofROOT.CORPβsDomain Adminsgroup (S-1-5-21-999-888-777-512) intojdoeβssIDHistoryattribute. - When
jdoeauthenticates, the KDC includes both the primary SID and allsIDHistorySIDs in the Kerberos authorization data (PAC). - When accessing services in
ROOT.CORP, the target host inspects the token, locatesS-1-5-21-999-888-777-512, and grants complete administrative control, despite ADUC showingjdoeas a standard user.
This mechanism is analyzed further in Doc 18: Cross-Domain Group Membership and Foreign Security Principals and Doc 24: Lateral Movement Across Active Directory Domains.
Forensic Artifacts
Section titled βForensic ArtifactsβEventID: 4720 # User Account CreatedTargetUserName: attacker_backupTargetSid: S-1-5-21-3623811015-3361044348-30300820-1185 <-- Note assigned RIDSubjectUserSid: S-1-5-21-3623811015-3361044348-30300820-500
EventID: 4765 # SID History Added (Critical Alert)TargetUserName: jdoeTargetSid: S-1-5-21-222-333-444-1102SidHistoryValue: S-1-5-21-999-888-777-512 <-- Domain Admins injectedInvestigation Methods
Section titled βInvestigation Methodsβ- Detect Accounts with sIDHistory via PowerShell:
Terminal window Get-ADUser -Filter 'sidhistory -like "*"' -Properties sidhistory |Select-Object Name, SID, @{Name="sIDHistory";Expression={$_.sidhistory}} - Translate SID to Account Offline / Scripting:
Terminal window $objSID = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-21-3623811015-3361044348-30300820-500")$objUser = $objSID.Translate([System.Security.Principal.NTAccount])$objUser.Value
Key Takeaways
Section titled βKey Takeawaysβ- The SID is the only identity validated by the Windows security engine.
- The RID distinguishes unique objects within the same issuing domain or SAM.
- RID
500is permanently the built-in Administrator, regardless of language or renamed strings. - Deleting and recreating a user creates an entirely new SID and invalidates prior ACL rights.
sIDHistoryallows an account to carry authorizations across domains.