Shadow Credentials in Active Directory: Detection and Prevention

Manish Garg
Manish Garg Associate of (ISC)² · RingSafe
Dec 4, 2026
5 min read
Read as

“Shadow Credentials” is an Active Directory account-takeover technique: anyone who can write to an account’s msDS-KeyCredentialLink attribute can add their own key to it and then sign in as that user or computer through certificate-based Kerberos authentication, without knowing or changing its password. It is quiet, survives password resets, and works wherever Windows Hello for Business-style key trust is supported. Prevent it by removing unnecessary write permissions on accounts, and detect it by auditing changes to msDS-KeyCredentialLink (event 5136) and unusual certificate-based logons (event 4768).

Many Active Directory compromises do not need an exploit. They abuse permissions that already exist: a helpdesk group that can modify user objects, a service account with GenericWrite on computers, an old delegation nobody remembers. Shadow Credentials turns one of those everyday write permissions into full control of the target account. It was described publicly by security researcher Elad Shamir in 2021 and is now a standard part of both real intrusions and penetration tests.

Background: key trust in Active Directory

Windows Hello for Business and some other passwordless features let a user or computer authenticate with a key pair instead of a password. The public key is stored on the account in AD, in the attribute msDS-KeyCredentialLink. When the device signs in, the domain controller checks the signature against that stored key using PKINIT (certificate-based Kerberos pre-authentication) and issues a Kerberos ticket.

This requires domain controllers running Windows Server 2016 or later with a certificate for PKINIT, which most current domains already have.

How the attack works (at a high level)

  1. The attacker controls an account that has write permission on a target user or computer object, for example through GenericAll, GenericWrite, or WriteProperty on the key credential attribute.
  2. They add a key pair they generated to the target’s msDS-KeyCredentialLink.
  3. They authenticate to the domain controller with that key and receive a Kerberos ticket as the target account. In some configurations they can also recover the target’s NTLM hash from the response.

The target’s password is never changed, so the legitimate user notices nothing, and resetting their password does not remove the attacker’s key.

Where the dangerous permissions come from

  • Helpdesk or support groups delegated broad rights over user OUs (“full control of all users in Branch-OU”).
  • Accounts that created computer objects: the creator often keeps write access to the computer account.
  • Service accounts for provisioning, HR or identity tools with write access to many users.
  • Old exchange-related or migration permissions left at the domain level.
  • NTLM relay: if relayed authentication can reach LDAP without signing or channel binding, an attacker may be able to write this attribute using a relayed machine account’s rights.

Prevention

1. Find who can write to sensitive accounts

BloodHound shows this as the AddKeyCredentialLink edge, alongside GenericWrite and GenericAll. Run a collection and look at inbound control edges on Tier-0 objects: domain admins, domain controllers, AD CS servers, SCCM servers, and service accounts with high privilege. Each non-admin principal with such an edge is a finding to fix.

You can also review permissions on a specific object with PowerShell:

Import-Module ActiveDirectory
$dn = (Get-ADUser svc-backup).DistinguishedName
(Get-Acl "AD:$dn").Access |
  Where-Object { $_.ActiveDirectoryRights -match 'GenericAll|GenericWrite|WriteProperty' -and $_.AccessControlType -eq 'Allow' } |
  Select-Object IdentityReference, ActiveDirectoryRights, ObjectType, IsInherited

An ObjectType of 5b47d60f-6090-40b2-9f37-2a4de88f3063 is the schema GUID for msDS-KeyCredentialLink; an empty GUID with WriteProperty means “write any property”, which includes it.

2. Tighten delegation

  • Replace “Full control” delegations with the specific rights a group needs (for example, reset password and unlock account only).
  • Put Tier-0 accounts in the Protected Users group and in OUs where only Tier-0 admins have rights, and keep AdminSDHolder permissions clean.
  • Set ms-DS-MachineAccountQuota to 0 so ordinary users cannot create computer accounts they then control.

3. Block relay into LDAP

Enforce LDAP signing and LDAP channel binding on domain controllers, so relayed NTLM authentication cannot be used to modify AD objects.

4. Clean up existing keys

If you do not use Windows Hello for Business key trust or similar features, msDS-KeyCredentialLink should be empty on almost every account. If you do use them, entries should appear only on accounts of enrolled users and devices. Periodically list accounts that have a value:

Get-ADObject -LDAPFilter "(msDS-KeyCredentialLink=*)" -Properties msDS-KeyCredentialLink, whenChanged |
  Select-Object Name, ObjectClass, whenChanged

Any entry on a privileged account, service account or server that has no reason to use key trust deserves investigation.

Detection

  • Directory Service Changes (event 5136) where Attribute LDAP Display Name is msDS-KeyCredentialLink. Enable Audit Directory Service Changes on domain controllers and add a SACL that audits writes to this attribute. Legitimate writes normally come from the Windows Hello provisioning process or the Entra Connect sync account; writes by any other account are suspicious.
  • Kerberos TGT requests with certificate pre-authentication (event 4768) where certificate fields (issuer, serial, thumbprint) are populated for accounts that do not normally use certificates or Windows Hello, especially computer accounts of servers or service accounts.
  • Microsoft Defender for Identity includes detections for suspicious modifications of this attribute and related certificate-based authentication.

Response

  1. Remove the unauthorised value from msDS-KeyCredentialLink on the affected account.
  2. Because the attacker may have obtained the account’s NTLM hash, also reset the password (twice for krbtgt or service accounts, following Microsoft guidance) and review what the account did since the change.
  3. Fix the permission that allowed the write, then hunt for the same change on other objects.

For Indian organisations

Many Indian enterprises have Active Directory forests that are 10–20 years old, with delegations added during mergers, branch rollouts and outsourcing projects. Those permissions are exactly what Shadow Credentials abuses. An ACL review focused on Tier-0 objects is one of the highest-value AD hardening tasks, and auditors under ISO 27001, RBI and SEBI frameworks increasingly ask for evidence of privileged access reviews.

RingSafe’s Active Directory security assessment maps these permission paths and helps you remove them safely. Contact us.

Need a real pentest?

Get a VAPT scoping call

Senior practitioner-led VAPT — not a checklist run by juniors. CVSS-scored findings, free retest, attestation letter. India's SMBs and SaaS teams.

Book VAPT scoping call Replies in 4 working hrs · India-only · Senior consultants