Alright then, we’ve covered SIDs, SIDHistory, and Tickets. Let’s move onto Access Tokens.
The Privilege Access Certificate or PAC is a Microsoft extension to Kerberos utilizing the Authorization Data field in the tickets. This is sometimes referred to as the Access Token, however strictly speaking the Access Token is the structure generated by the LSA on the destination server. Whilst that uses data from the PAC, it is not the same.
The PAC is limited in size to 64KB maximum, although modern OSes default this via MaxTokenSize to 48KB, to allow for Base64 encoding in IIS.
The PAC is broken down into many structures, which contain a whole swathe of information about the user who’s trying to make the request. The main structures are:
Out of those the Logon Information has all of the group information and much more. Check out the fields within a Logon Information Structure:
Some interesting things about the PAC:
As we said, the Access Token is generated by the LSA on the machine that hosts the service you’re accessing. The LSA uses the information from inside the PAC to help with this process.
I can’t actually find a definitive answer on exactly what the Access Token structure looks like, but we can see that GetTokenInformation is passed a value from the TOKEN_INFORMATION enumeration, which includes a lot of structures, of which the more interesting ones are:
The user’s SID and an attributes field
The number of groups and the list of SIDs plus their respective attributes field
The number of privileges and the privilege IDs plus their respective attributes field
The SID of the owner for any newly created objects
The SID of the group for any newly created objects
The Discretionary ACL added to any newly created objects
The name and identifier for where this access token came from (e.g. Session Manager, LAN Manager, and RPC Server)
A flag as to whether this is the primary token or an impersonation token
A flag indicating the impersonation level (Anonymous, Identification, Impersonation or Delegation)
A structure with some general statistics about this access token. It is a combination of attributes that are available in other structures too, like Group Count, Privilege Count, etc.
The number of groups and the list of SIDs plus their respective attributes field. This is only populated if an application has created a restricted token by effectively disabling some groups/privileges
The Terminal Services session id associated with this token (or zero if not a terminal services session related token)
The combination of TokenGroups, TokenPrivileges, TokenRestructureSids and the AuthenticationId of the authenticator of this token
A flag to indicate whether per user file/registry virtualization is allowed for this token
A flag to indicate whether per user file/registry virtualization is enabled for this token
The Mandatory Integrity Level of this token (i.e. does it have Mandatory High, or Admin rights allows)
The list of claims associated with this user
The list of claims associated with this user’s device
The list of claims associated with this user that have been restricted by an application
The list of claims associated with this user’s device that have been restricted by an application
The number of groups and the list of SIDs plus their respective attributes field for this user’s device
The number of groups and the list of SIDs plus their respective attributes field for this user’s device, if an application has created a restricted token by effectively disabling some groups/privileges
Of course we’re mostly interested in how the LSA takes the groups from the PAC and fills the TokenGroups structure. It’s interesting to note that while a Kerberos ticket supports Group SID Compression, the Access Token does not. Every SID in the Access Token uses up 40 bytes (the 8 byte pointer, the 4 byte Attributes, and the 28 byte SID)
The main thing that the LSA adds to the list of groups is any implicit memberships that need to be granted, including:
As well as an local groups on the machine that the LSA runs.
Let’s take a look at the communication flows in more detail in part 6