Shadow credentials are an Active Directory technique where an attacker adds their own authentication key to an AD object, usually through the msDS-KeyCredentialLink attribute. The attacker doesn’t need to know the user’s password afterward.
A shadow credential attack happens when an attacker has enough permissions to modify that attribute on another AD account/computer. They add a key they control, then authenticate as that account using the corresponding private key.
Shadow credentials are essentially a backdoor for an AD account. An attacker adds new and controlled public key to the account’s msDS-KeyCredentialLink attribute. The attacker keeps the corresponding private key. Then they use that key with a protocol such as PKINIT to authenticate as the victim account and obtain a Kerberos TGT.
Example with Certipy:
certipy shadow -u 'ca_svc@fluffy.htb' -hashes ca0f4f9e9eb8a092addf53bb03fc98c8 -dc-ip 10.129.232.88 -target DC01.fluffy.htb -account winrm_svc auto
In that command, ca_svc is the account you already control, while winrm_svc is the target/victim account. The NTLM hash after -hashes authenticates you as ca_svc. -account winrm_svc tells Certipy which AD object to modify. auto performs the Shadow Credentials workflow automatically: generate a key pair, add the public key to winrm_svc’s msDS-KeyCredentialLink, authenticate as winrm_svc using the private key/PKINIT, obtain credentials such as a TGT/NT hash, then clean up the added credential.
Pentesting/The Grimoire/Tools/Bloodhound mentions Whisker.exe as a great tool to take adventage of shadow credentials.
“The members of the group ITSTAFF@OUTDATED.HTB have the ability to write to the “msds-KeyCredentialLink” property on SFLOWERS@OUTDATED.HTB. Writing to this property allows an attacker to create “Shadow Credentials” on the object and authenticate as the principal using kerberos PKINIT.”
After compiling Whisker into .exe you can then run .\whisker.exe add /target:sflowers to create those shadow credentials.