How a Windows SID is structured
Read any Windows security identifier at a glance: the revision, the authority, the sub-authorities that identify a domain or machine, and the trailing RID that names the principal.
A Windows security identifier (SID) names a security principal — a user, a group, a computer or a built-in identity. Every access check, every ACL entry and every token is written in terms of SIDs, not names. Once you can read the parts, most well-known SIDs become self-explanatory.
The parts
Take S-1-5-21-3623811015-3361044348-30300820-1013:
S— the literal prefix, marking the string form of a SID.1— the revision. Always1to date.5— the identifier authority.5isNT Authority, the authority behind almost every SID you'll meet. (1= World,3= Creator,16= Mandatory Label, etc.)21-3623811015-3361044348-30300820— the sub-authorities. For an account SID,21introduces a locally-issued identifier and the three numbers that follow identify the issuing domain or machine. This part is unique per domain.1013— the relative identifier (RID): the principal within that domain.500is the built-in Administrator,512Domain Admins, and RIDs≥ 1000are issued to the accounts and groups you create.
Well-known vs. domain-relative
Two families matter when you read a SID:
- Well-known SIDs have the same value everywhere —
S-1-5-18(Local System),S-1-5-32-544(Builtin Administrators),S-1-1-0(Everyone). No domain part; recognise them by sight. - Domain-relative SIDs share a domain prefix and differ only in the RID —
S-1-5-21-…-512is Domain Admins in that domain. Defenders key on the trailing RID because the prefix changes but the RID does not.
Resolving one
([System.Security.Principal.SecurityIdentifier]'S-1-5-32-544').Translate(
[System.Security.Principal.NTAccount]).Value
A SID that won't translate is worth a second look: it may be an orphaned ACL entry from a deleted account, or a SID from a domain the host no longer trusts. Browse the well-known SID catalogue to put a name to the ones you meet.