Skip to content
Pwnversity
AD-SHADOWCREDSexpert · 7 min · upd. 2026-11

Shadow Credentials

T1556.006T1098

Shadow Credentials abuses Key Trust: a user or computer’s msDS-KeyCredentialLink attribute holds public keys used for certificate authentication (PKINIT), the mechanism behind Windows Hello for Business. If an attacker can write that attribute on a target account, they add their own key pair and then authenticate via PKINIT as that account, obtaining its TGT and NT hash —without changing its password or leaving the account unusable. The broken invariant is that write control over an account equals being able to authenticate as it.

flowchart LR
    A["Attacker with write access<br/>over the victim"] -->|"adds their public key"| K["victim's<br/>msDS-KeyCredentialLink"]
    A -->|"PKINIT with their private key"| DC[Domain Controller]
    DC -->|"victim's TGT + NT hash"| A
    A -->|"removes the key"| K
  • Who attacks: someone with write access to the victim’s msDS-KeyCredentialLink (GenericAll, GenericWrite, WriteProperty over that attribute, WriteOwner/WriteDACL to grant it) —exactly the kind of edge BloodHound reveals by the dozen (AddKeyCredentialLink).
  • What it breaks: the separation between “administer an object” and “be that object.” Writing an authentication key into the account is, in effect, impersonating it.
  • What it gains: the victim’s TGT and NT hash, stealthily and reversibly: you add the key, authenticate, and remove it; the legitimate user never notices.
  • Versus a password reset: resetting is noisy, breaks the user’s access and is obvious. Shadow Credentials isn’t. That’s why it’s the preferred path when you have write access over an account.
  • A DC with PKINIT/Key Trust support (DC 2016+). It doesn’t require a vulnerable AD CS template like the ESCs: the domain’s Key Trust is enough (though having AD CS is the norm).
  • Write access over the victim’s msDS-KeyCredentialLink, discovered in enumeration or in BloodHound.

Each msDS-KeyCredentialLink entry associates a public key with the account for certificate authentication. Windows Hello for Business uses it legitimately: on enrollment, the TPM generates the pair and the public key is stored there. The attacker does the same with a pair they control.

After authenticating via PKINIT, the attacker doesn’t just have the TGT: the PKINIT exchange also returns the victim’s NT hash (UnPAC-the-hash). That enables pass-the-hash even though the password stays unknown.

The most direct way: certipy shadow auto adds the key, does PKINIT, recovers the NT hash and cleans the key in a single step.

Ventana de terminal
certipy shadow auto -u 'jdoe@corp.local' -p 'Passw0rd!' -dc-ip 10.10.10.10 -account 'victim'

Step by step, if you want control over each phase (add, list, remove, clear):

Ventana de terminal
certipy shadow add -u 'jdoe@corp.local' -p 'Passw0rd!' -dc-ip 10.10.10.10 -account 'victim'
certipy auth -pfx victim.pfx -dc-ip 10.10.10.10
certipy shadow clear -u 'jdoe@corp.local' -p 'Passw0rd!' -dc-ip 10.10.10.10 -account 'victim'

pywhisker manages msDS-KeyCredentialLink entries (--action add/list/remove/clear) and gettgtpkinit.py + getnthash.py do the PKINIT and UnPAC-the-hash. It’s the path when you don’t use Certipy.

If you arrive via NTLM relay to LDAP with the authentication of an account that has write access over the victim, ntlmrelayx --shadow-credentials writes the attribute directly during the relay.

Shadow Credentials over a computer’s account gives its TGT; if that computer is a DC, it leads to DCSync. It’s the natural outcome of a GenericWrite over a computer found in BloodHound, an alternative to setting up RBCD (delegation).

  1. BloodHound: do I have AddKeyCredentialLink (or equivalent write) over any valuable account?
  2. certipy shadow auto over that account → NT hash and TGT.
  3. Always clear the key (don’t leave the added entry).
  4. Chain: NT hash → pass-the-hash / lateral; if the victim is a DC → DCSync.
  • Certipy (shadow add/auto/clear): the whole flow from Linux.
  • pywhisker + PKINITtools (gettgtpkinit.py, getnthash.py): modular alternative.
  • Whisker (C#): Windows equivalent.
  • ntlmrelayx (--shadow-credentials): write the attribute via relay.

It turns a write edge into the victim’s TGT and NT hash without touching their password. Over a DC, DCSync; over a privileged user, their full identity. Along with RBCD, it’s the standard way to monetize GenericWrite/GenericAll.

  • Event 5136 (directory object modification) with a WRITE on msDS-KeyCredentialLink: the main signal. It requires directory change auditing enabled (SACL on the objects).
  • Event 4662 as an alternative if 5136 isn’t available.
  • Blind spot: an account modifying its own msDS-KeyCredentialLink is usually legitimate WHfB (enrollment). Detections exclude the “source = object” case, so watch mostly for writes by one account over another.
  • Legitimate false positives: Windows Hello for Business, Azure AD Connect and ADFS provisioning write this attribute. Correlate with the expected flow (who writes, over what object class, in what window).
  • Directory Service Changes auditing on the DCs, with a SACL on msDS-KeyCredentialLink.
  • Sigma/Elastic-style rules on 5136 + AttributeLDAPDisplayName = msDS-KeyCredentialLink.
  • Restrict writing of msDS-KeyCredentialLink to dedicated identity-management accounts; review and trim the AddKeyCredentialLink edges BloodHound shows.
  • Protect Tier 0 accounts: no low-privilege principal should have write access over a DC or a Domain Admin.
  • Keep 5136 auditing active over the attribute on all DCs.

On a suspicious write: remove the added Key Credential, investigate which account wrote it and with what permission, rotate the victim’s credentials (and, if it’s a DC, consider rotating krbtgt) and fix the write edge that allowed it.

  • Not a CVE: it’s an abuse of Key Trust’s design (MITRE T1556.006), described by Elad Shamir in “Shadow Credentials” (SpecterOps, 2021).
  • It became the stealthy alternative to password reset and RBCD for monetizing write access over accounts, and is built into Certipy, ntlmrelayx and BloodHound.
  • Do I have write access over some valuable account’s msDS-KeyCredentialLink (BloodHound)?
  • DC with PKINIT/Key Trust support (2016+)?
  • certipy shadow auto → victim’s TGT and NT hash?
  • Added key removed when done?
  • Write access over a computer/DC leading to DCSync?
  • Blue: 5136 auditing over msDS-KeyCredentialLink on? Excludes only the “source = object” case?