# Shadow Credentials Attack

### Overview

A **Shadow Attack** (Shadow Credentials abuse) is an Active Directory privilege escalation technique where an attacker adds a malicious public key to a target account’s `msDS-KeyCredentialLink` attribute.

This allows the attacker to authenticate as that account using **certificate-based authentication**, without knowing the password.

Instead of resetting the password or stealing NTLM hashes, the attacker:

* Modifies the target’s `msDS-KeyCredentialLink`
* Adds their own certificate public key
* Uses PKINIT to request a Kerberos TGT
* Authenticates as the victim account

### Why this Works

Modern Active Directory environments support:

* **Windows Hello for Business**
* Certificate-based authentication
* PKINIT (Public Key Cryptography for Initial Authentication)

The attribute:

```
msDS-KeyCredentialLink
```

Stores public key information for certificate-based logon.

If an attacker has **write access** to this attribute for a user or computer object, they can:

1. Add their own certificate
2. Authenticate using that certificate
3. Obtain a TGT as that account
4. Escalate privileges

It works because AD trusts any valid key stored in that attribute.

### Prerequsites

* Domain user credentials
* Write access to target’s `msDS-KeyCredentialLink`\
  (via GenericWrite, GenericAll, WriteProperty, etc.)
* AD domain functional level supporting PKINIT
* Domain Controller with certificate services (or PKINIT support)

### Steps

1. Use BloodHound to identify:
   * GenericWrite
   * GenericAll
   * WriteProperty on `msDS-KeyCredentialLink`&#x20;
2. Perform Shadow Credentials Attack:

   ```bash
   certipy-ad shadow auto -u lowuser@domain.local -p Password123! -account targetuser -dc-ip 10.10.11.51
   ```

&#x20;     What this does:

* Generates a key pair
* Adds the public key to target’s `msDS-KeyCredentialLink`
* Requests a TGT
* Extracts NT hash automatically

### References

1. <https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/shadow-credentials> (If you need more details)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gokulkarthik.gitbook.io/pentesting-checklist/windows-and-active-directory/post-compromise-attacks/shadow-credentials-attack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
