My Training Period: xx hours. Before you begin, read someinstruction here.
The expected abilities:
In the security descriptor definition language (SDDL), security descriptor string use SID strings for the following components of a security descriptor:
A SID string in a security descriptor string can use either the standard string representation of a SID (S-R-I-S-S...) or one of the string constants defined insddl.h.
A SID value includes components that provide information about the SID structure and components that uniquely identify a trustee. A SID consists of the following components:
RID is a portion of a security identifier (SID) that identifies a user or group in relation to the authority that issued the SID. The combination of the identifier authority value and the sub authority values ensures that no two SIDs will be the same, even if two different SID-issuing authorities issue the same combination of RID values. Each SID-issuing authority issues a given RID only once. SIDs are stored in binary format in a SID structure. To display a SID, you can call theConvertSidToStringSid() function to convert a binary SID to string format. To convert a SID string back to a valid, functional SID, call theConvertStringSidToSid() function. These functions use the following standardized string notation for SIDs, which makes it simpler to visualize their components:
In this notation, the literal character S identifies the series of digits as a SID, R is the revision level, I is the identifier-authority value, and S... is one or more sub authority values. The following example uses this notation to display the well-known domain-relative SID of the local Administrators group:
In this example, the SID has the following components. The constants in parentheses are well-known identifier authority and RID values defined in winnt.h:
A revision level of 1.
An identifier-authority value of 5 (SECURITY_NT_AUTHORITY).
A first sub authority value of 32 (SECURITY_BUILTIN_DOMAIN_RID).
A second sub authority value of 544 (DOMAIN_ALIAS_RID_ADMINS).
The following SID string constants for well-known SIDs are defined in sddl.h.
Constant in Sddl.h
Account alias and corresponding RID
Account operators. The corresponding RID is DOMAIN_ALIAS_RID_ACCOUNT_OPS.
Alias to grant permissions to accounts that use applications compatible with Windows NT 4.0 operating systems. The corresponding RID is DOMAIN_ALIAS_RID_PREW2KCOMPACCESS.
Anonymous logon. The corresponding RID is SECURITY_ANONYMOUS_LOGON_RID.
Authenticated users. The corresponding RID is SECURITY_AUTHENTICATED_USER_RID.
Built-in administrators. The corresponding RID is DOMAIN_ALIAS_RID_ADMINS.
Built-in guests. The corresponding RID is DOMAIN_ALIAS_RID_GUESTS.
Backup operators. The corresponding RID is DOMAIN_ALIAS_RID_BACKUP_OPS.
Built-in users. The corresponding RID is DOMAIN_ALIAS_RID_USERS.
Certificate publishers. The corresponding RID is DOMAIN_GROUP_RID_CERT_ADMINS.
Creator group. The corresponding RID is SECURITY_CREATOR_GROUP_RID.
Creator owner. The corresponding RID is SECURITY_CREATOR_OWNER_RID.
Domain administrators. The corresponding RID is DOMAIN_GROUP_RID_ADMINS.
Domain computers. The corresponding RID is DOMAIN_GROUP_RID_COMPUTERS.
Domain controllers. The corresponding RID is DOMAIN_GROUP_RID_CONTROLLERS.
Domain guests. The corresponding RID is DOMAIN_GROUP_RID_GUESTS.
Domain users. The corresponding RID is DOMAIN_GROUP_RID_USERS.
Enterprise administrators. The corresponding RID is DOMAIN_GROUP_RID_ENTERPRISE_ADMINS.
Enterprise domain controllers. The corresponding RID is SECURITY_SERVER_LOGON_RID.
Everyone. The corresponding RID is SECURITY_WORLD_RID.
Group Policy administrators. The corresponding RID is DOMAIN_GROUP_RID_POLICY_ADMINS.
Interactively logged-on user. This is a group identifier added to the token of a process when it was logged on interactively. The corresponding logon type is LOGON32_LOGON_INTERACTIVE. The corresponding RID is SECURITY_INTERACTIVE_RID.
Local administrator. The corresponding RID is DOMAIN_USER_RID_ADMIN.
Local guest. The corresponding RID is DOMAIN_USER_RID_GUEST.
Local service account. The corresponding RID is SECURITY_LOCAL_SERVICE_RID.
Local system. The corresponding RID is SECURITY_LOCAL_SYSTEM_RID.
Network logon user. This is a group identifier added to the token of a process when it was logged on across a network. The corresponding logon type is LOGON32_LOGON_NETWORK. The corresponding RID is SECURITY_NETWORK_RID.
Network configuration operators. The corresponding RID is DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS.
Network service account. The corresponding RID is SECURITY_NETWORK_SERVICE_RID.
Printer operators. The corresponding RID is DOMAIN_ALIAS_RID_PRINT_OPS.
Principal self. The corresponding RID is SECURITY_PRINCIPAL_SELF_RID.
Power users. The corresponding RID is DOMAIN_ALIAS_RID_POWER_USERS.
RAS servers group. The corresponding RID is DOMAIN_ALIAS_RID_RAS_SERVERS.
Terminal server users. The corresponding RID is DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS.
Replicator. The corresponding RID is DOMAIN_ALIAS_RID_REPLICATOR.
Restricted code. This is a restricted token created using the CreateRestrictedToken() function. The corresponding RID is SECURITY_RESTRICTED_CODE_RID.
Schema administrators. The corresponding RID is DOMAIN_GROUP_RID_SCHEMA_ADMINS.
Server operators. The corresponding RID is DOMAIN_ALIAS_RID_SYSTEM_OPS.
Service logon user. This is a group identifier added to the token of a process when it was logged as a service. The corresponding logon type is LOGON32_LOGON_SERVICE. The corresponding RID is SECURITY_SERVICE_RID.
TheConvertSidToStringSid() and ConvertStringSidToSid() functions always use the standard SID string notation and do not support SDDL SID string constants.
Well-known SIDs identify generic groups and generic users. For example, there are well-known SIDs to identify the following groups and users:
There are universal well-known SIDs, which are meaningful on all secure systems using this security model, including operating systems other than Windows. In addition, there are well-known SIDs that are meaningful only on Windows systems. The Windows API defines a set of constants for well-known identifier authority and relative identifier (RID) values. You can use these constants to create well-known SIDs. The following example combines theSECURITY_WORLD_SID_AUTHORITY and SECURITY_WORLD_RID constants to show the universal well-known SID for the special group representing all users (Everyone or World):
This example uses the string notation for SIDs in whichS identifies the string as a SID, the first 1 is the revision level of the SID, and the remaining two digits are the SECURITY_WORLD_SID_AUTHORITY and SECURITY_WORLD_RID constants. You can use theAllocateAndInitializeSid() function to build a SID by combining an identifier authority value with up to eight sub authority values. For example, to determine whether the logged-on user is a member of a particular well-known group, callAllocateAndInitializeSid() to build a SID for the well-known group and use theEqualSid() function to compare that SID to the group SIDs in the user's access token. You must call the FreeSid() function to free a SID allocated byAllocateAndInitializeSid(). The following contains tables of well-known SIDs and tables of identifier authority and sub authority constants that you can use to build well-known SIDs. The following are some universal well-known SIDs.
Universal well-known SID
Null SIDValue: (S-1-0-0)
A group with no members. This is often used when a SID value is not known.
A group that includes all users.
Users who log on to terminals locally (physically) connected to the system.
Creator Owner IDValue: (S-1-3-0)
A security identifier to be replaced by the security identifier of the user who created a new object. This SID is used in inheritable ACEs.
Creator Group IDValue: (S-1-3-1)
Identifies a security identifier to be replaced by the primary-group SID of the user who created a new object. Use this SID in inheritable ACEs.
The following table lists the predefined identifier authority constants. The first four values are used with universal well-known SIDs; the last value is used with Windows well-known SIDs.
SID string prefix
The following RID values are used with universal well-known SIDs. The Identifier authority column shows the prefix of the identifier authority with which you can combine the RID to create a universal well-known SID.
Relative identifier (RID) authority
The SECURITY_NT_AUTHORITY (S-1-5) predefined identifier authority produces SIDs that are not universal but are meaningful only on Windows installations. You can use the following RID values with SECURITY_NT_AUTHORITY to create well-known SIDs.
Users who log on to terminals using a dial-up modem. This is a group identifier.
Users who log on across a network. This is a group identifier added to the token of a process when it was logged on across a network. The corresponding logon type is LOGON32_LOGON_NETWORK.
Users who log on using a batch queue facility. This is a group identifier added to the token of a process when it was logged as a batch job. The corresponding logon type is LOGON32_LOGON_BATCH.
Users who log on for interactive operation. This is a group identifier added to the token of a process when it was logged on interactively. The corresponding logon type is LOGON32_LOGON_INTERACTIVE.
A logon session. This is used to ensure that only processes in a given logon session can gain access to the window-station objects for that session. The X and Y values for these SIDs are different for each logon session. The value SECURITY_LOGON_IDS_RID_COUNT is the number of RIDs in this identifier (5-X-Y).
Accounts authorized to log on as a service. This is a group identifier added to the token of a process when it was logged as a service. The corresponding logon type is LOGON32_LOGON_SERVICE.
Anonymous logon or null session logon.
The PRINCIPAL_SELF security identifier can be used in the ACL of a user or group object. During an access check, the system replaces the SID with the SID of the object. The PRINCIPAL_SELF SID is useful for specifying an inheritable ACE that applies to the user or group object that inherits the ACE. It the only way of representing the SID of a created object in the default security descriptor of the schema.
The authenticated users.
Terminal Services. Automatically added to the security token of a user who logs on to a Terminal Server.
A special account used by the operating system.
SIDS are not unique.
The built-in system domain.
The following RIDs are relative to each domain.
The administrative user account in a domain.
The guest-user account in a domain. Users who do not have an account can automatically log on to this account.
The domain administrators' group. This account exists only on systems running server operating systems.
A group that contains all user accounts in a domain. All users are automatically added to this group.
The guest-group account in a domain.
The domain computers' group. All computers in the domain are members of this group.
The domain controllers' group. All DCs in the domain are members of this group.
The certificate publishers' group. Computers running Certificate Services are members of this group.
The schema administrators' group. Members of this group can modify the Active Directory schema.
The enterprise administrators' group. Members of this group have full access to all domains in the Active Directory forest. Enterprise administrators are responsible for forest-level operations such as adding or removing new domains.
The policy administrators' group.
The following table has examples of domain-relative RIDs that you can use to form well-known SIDs for local groups (aliases).
A local group used for administration of the domain.
A local group that represents all users in the domain.
A local group that represents guests of the domain.
A local group used to represent a user or set of users who expect to treat a system as if it were their personal computer rather than as a workstation for multiple users.
A local group that exists only on systems running server operating systems. This local group permits control over non administrator accounts.
A local group that exists only on systems running server operating systems. This local group performs system administrative functions, not including security functions. It establishes network shares, controls printers, unlocks workstations, and performs other operations.
A local group that exists only on systems running server operating systems. This local group controls printers and print queues.
A local group used for controlling assignment of file backup-and-restore privileges.
A local group responsible for copying security databases from the primary domain controller to the backup domain controllers. These accounts are used only by the system.
A local group that represents RAS and IAS servers. This group permits access to various attributes of user objects.
A local group that exists only on systems running Windows 2000 Server. It provides access rights and privileges equal to anonymous access under Windows NT, which is Everyone access.
The WELL_KNOWN_SID_TYPE enumeration defines the list of commonly used SIDs. Additionally, the SDDL uses SID strings to reference well-known SIDs in a string format.
-------------------------------Windows Access Control Story, Part II---------------------------
Further reading and digging:
Microsoft C references, online MSDN.
Microsoft Visual C++, online MSDN.
Linux Access Control Lists (ACL) info can be found atAccess Control Lists.
Structure, enum, union and typedef story can be foundC/C++ struct, enum, union & typedef.
Notation used in MSDN is Hungarian Notation instead of CamelCase and is discussedWindows programming notations.
Windows data type information is inWindows data types used in Win32 programming.