TechBuzzPro

Confidentiality Bit: Restrict Active Directory Attributes

· 7 min read · Apps & Browsers

In this article
  1. What Is the Confidentiality Bit?
  2. How the Confidentiality Bit Works
  3. Why Use the Confidentiality Bit?
  4. How to Set the Confidentiality Bit
  5. Common Problems and Pitfalls
  6. Alternatives and Comparisons
  7. Frequently Asked Questions

Yes, the confidentiality bit (ms-DS-Claims-Trust-Anchors, or more precisely the searchFlags attribute value of 128) can restrict access to Active Directory attributes by preventing them from being returned in LDAP search results to users who lack the necessary permissions. Setting this bit hides sensitive attributes from normal queries, but it requires careful configuration of ACLs (Access Control Lists) to actually enforce the restriction.

What Is the Confidentiality Bit?

The confidentiality bit is a flag set on an Active Directory attribute's searchFlags property. When set to 128, it marks the attribute as confidential. This flag is part of the attribute schema definition and tells the directory service that the attribute's values should not be returned in LDAP search responses unless the requesting user has been explicitly granted the Control Access right on the attribute.

The bit is stored in the searchFlags attribute of the attributeSchema object. For example, the employeeID attribute might have searchFlags set to 128 to indicate confidentiality. However, simply setting the flag does not automatically hide the attribute; you must also modify the ACL on the attribute to remove the default Read Property permission for authenticated users and add a specific Control Access permission for the users or groups that should see it.

How the Confidentiality Bit Works

When an LDAP client performs a search, the directory service evaluates the ACL on each attribute in the result set. If an attribute has the confidentiality bit set, the service requires that the requesting user have Control Access permission on that attribute. Without this permission, the attribute is omitted from the search results, even if the user has Read Property on the entire object.

This behavior is implemented in Windows Server 2003 and later versions of Active Directory. The Control Access right is a special extended right that can be granted on an attribute in the ACL editor. When you grant this right, you are essentially saying that the user can read the attribute despite the confidentiality flag. The flag itself is a schema change, so it replicates to all domain controllers in the forest.

It is important to note that the confidentiality bit only affects LDAP search operations. It does not prevent a user who has Read Property on the attribute from viewing it in other ways, such as through the Active Directory Users and Computers snap-in if they have the necessary permissions. The snap-in uses LDAP queries, so the same restriction applies.

Why Use the Confidentiality Bit?

The primary reason to use the confidentiality bit is to protect sensitive data that is stored in Active Directory attributes but should not be visible to all users who can read objects. Common examples include:

  • Employee identification numbers (e.g., employeeID)
  • Social security numbers or national identification numbers
  • Salary information
  • Personal phone numbers or addresses
  • Security questions and answers

By default, most attributes are readable by any authenticated user. If you have a custom attribute that stores sensitive information, you can use the confidentiality bit to ensure that only authorized personnel can retrieve it via LDAP. This is particularly useful in environments where many users have read access to directory objects, such as in a large organization with a self-service portal.

How to Set the Confidentiality Bit

Setting the confidentiality bit involves two main steps: modifying the schema and adjusting the ACLs. Both require elevated privileges.

  1. Enable schema snap-in: Register the Active Directory Schema snap-in by running regsvr32 schmmgmt.dll from an elevated command prompt.
  2. Open the schema: Open the Active Directory Schema snap-in, right-click the attribute you want to change, and select Properties.
  3. Set the searchFlags value: In the Attribute Properties dialog, click the Attribute Editor tab (if available) or use ADSI Edit. Locate the searchFlags attribute and add 128 to its current value. For example, if the current value is 0, set it to 128.
  4. Apply the change: Click OK. The schema change will replicate to all domain controllers.
  5. Modify the ACL: Open ADSI Edit, navigate to the object that contains the attribute, and open its properties. Go to the Security tab, click Advanced, and add a new permission. Select the principal (user or group) that should be allowed to read the attribute, set Type to Allow, and choose Control Access in the Permissions drop-down. In the Object field, select the specific attribute from the list.
  6. Remove default read: Ensure that the default Read Property permission for Authenticated Users is removed for that attribute. You can do this by editing the existing ACE or adding a Deny ACE, but a deny ACE can be tricky; it is better to remove the allow ACE for read property.

After these steps, only users with the Control Access right on that attribute will see its values in LDAP searches. All others will see the attribute as if it does not exist.

Common Problems and Pitfalls

One common mistake is setting the confidentiality bit but not adjusting the ACLs. Without removing the default read permission, the bit has no effect. Another issue is that the Control Access right must be granted on the specific attribute, not on the entire object. If you grant it on the object, it may not work as expected.

Another pitfall is that the confidentiality bit can break applications that expect to read the attribute. For example, if a line-of-business application reads employeeID for all users, it will stop working for users who do not have the Control Access right. You must ensure that all service accounts and applications that need the data are granted the appropriate permission.

Additionally, the confidentiality bit does not prevent a user with Control Access from reading the attribute if they also have Read Property on the object. It only adds an extra requirement. Also, the bit does not encrypt the attribute; it only restricts LDAP read access. The data is still stored in plaintext in the database.

Alternatives and Comparisons

There are other ways to restrict access to Active Directory attributes:

  • ACL-based security: You can set Read Property permissions on the attribute for specific groups, without using the confidentiality bit. This is simpler but requires you to explicitly deny read to all others, which is harder to maintain.
  • Attribute encryption: You can encrypt the attribute value using a custom solution, but this requires application changes and does not integrate with LDAP search.
  • Separate storage: Store sensitive data outside of Active Directory, such as in a database, and only store a reference in the directory.

The confidentiality bit is more robust than ACL-only because it automatically hides the attribute from users who do not have the extended right, even if they have read access to the object. It is also easier to manage because you only need to grant Control Access to the authorized users, rather than denying read to everyone else.

Frequently Asked Questions

Does the confidentiality bit work on all attributes?

Yes, it works on any attribute that has a searchFlags property, which includes most attributes in the schema. However, some system attributes may not allow modification of searchFlags.

Can I set the confidentiality bit using PowerShell?

Yes, you can use the Active Directory module for Windows PowerShell. You would need to modify the searchFlags attribute on the schema object using Set-ADObject. For example: Set-ADObject -Identity "CN=employeeID,CN=Schema,CN=Configuration,DC=contoso,DC=com" -Replace @{searchFlags=128}. Then adjust the ACLs using Set-ACL or the ActiveDirectory module's Set-ADObject with the SecurityDescriptor parameter.

Will the confidentiality bit affect replication?

No, the bit itself replicates as part of the schema, but it does not change the replication of attribute values. The restriction is applied at query time on each domain controller.

Can I set the confidentiality bit on a multi-valued attribute?

Yes, the bit works the same way on multi-valued attributes. The entire attribute is hidden if the user lacks the Control Access right.

How do I test if the confidentiality bit is working?

Use an LDAP query from a user account that does not have the Control Access right. For example, run ldp.exe or PowerShell with Get-ADUser -Properties employeeID. If the attribute is not returned, the bit is working. Ensure that the user you are testing with does not have the extended right.

Is the confidentiality bit the same as the "confidential" attribute flag in the schema?

Yes, the term "confidential" is often used to refer to the searchFlags value of 128. In the schema, the attribute is called ms-DS-Confidential-Attribute in some documentation, but the actual flag is stored in searchFlags.