AddKeyCredentialLink

Summary

FSProtect ACL Alias

AddKeyCredentialLink

AD Alias

Write msDS-KeyCredentialLink

Affected Object Types

Users, Computers

Exploitation Certainty

Certain

AD Attribute

msDS-KeyCredentialLink

AD Attribute GUID

5b47d60f-6090-40b2-9f37-2a4de88f3063

AD Right

WriteProperty

Description

The AddKeyCredentialLink permission lets an account write to the msDS-KeyCredentialLink attribute on user or computer objects. This attribute stores public keys used for passwordless logon (for example, Windows Hello for Business). Keys written here are automatically trusted by Active Directory for Kerberos PKINIT authentication and do not require ADCS.

If misconfigured, an attacker can add a key (a "shadow credential"), allowing them to log in as the target account without knowing the password. This enables persistence, privilege escalation, and stealthy impersonation across the domain.

Identification

PowerShell

Active Directory Module

Using the ActiveDirectory PowerShell module, you can enumerate AddKeyCredentialLink entries.

1. Find-AddKeyCredentialLink function

2. Scan all objects in the domain

3. Scan a specific object

4. To exclude default admins acls for better vision

5. Using SearchBase to limit the searching scope

.NET Directory Services

By leveraging PowerShell’s built-in .NET DirectoryServices namespace, you can enumerate AddKeyCredentialLink entries without relying on any external modules or dependencies.

1. Find-AddKeyCredentialLinkSimple function

2. Scan all objects in the domain

3. Scan a specific object

Active Directory Users and Computers

1. Open Active Directory Users and Computers on your Windows server.

2. Right-click on the object name.

3. Select Properties from the context menu.

4. In the Properties window, navigate to the Security tab.

5. Click on the Advanced button to open the Advanced Security Settings dialog.

6. In the Advanced Security Settings window, locate and select the relevant Access Control Entry (ACE) for the user or group you wish to configure.

7. Click Edit to modify the selected ACE.

8. In the permissions list, locate and check the option Write msDS-KeyCredentialLink.

9. Click OK to save your changes and close the dialogs.

Exploitation

This permission can be exploited on Windows systems with Whisker, while on Linux systems, tools such as Certipy can be effectively used for exploitation.

Windows

An attacker can write the msDS-KeyCredentialLink attribute value on an object using this tool on Windows.

Example:

Use the certificate produced by Whisker with Rubeus to request a TGT for the vulnerable user. Rubeus can also return the user’s NTLM hash for pass-the-hash attacks.

Example:

The output of the Rubeus command is lengthy, but the key information is:

  1. The first part provides the TGT in .kirbi format.

  2. The second part displays the NTLM hash of the target user.

Linux

An attacker with control over the msDS-KeyCredentialLink attribute can use Certipy on Linux to obtain the NT hash and TGT.

Example:

Mitigation

Dangerous Access Control Entries should be removed using the steps below.

1. Open Active Directory Users and Computers and enable the Advanced Features option.

2. Double-click the affected object and open the Security tab.

3. In the Security tab, click the Advanced button, locate the dangerous Access Control Entry, and select it.

4. Remove the Write msDS-KeyCredentialLink permission.

5. Click OK and Apply to save your changes.

Detection

Adding or modifying Access Control Entries on Active Directory objects changes the nTSecurityDescriptor attribute of those objects. These changes can be detected using Windows event IDs 5136 and 4662, which can help identify dangerous modifications.

Event ID
Description
Fields/Attributes
References

5136

A directory service object was modified.

ntSecurityDescriptor

https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-5136

4662

An operation was performed on an object.

AccessList, AccessMask

https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4662

References

Last updated

Was this helpful?