quentinhardy / msdat

MSDAT: Microsoft SQL Database Attacking Tool
832 stars 139 forks source link

xp_cmdshell Restore Service to Identified State #13

Open Zamanry opened 1 year ago

Zamanry commented 1 year ago

My team uses msdat non-interactively against a ton of machines using GNU's parallel command. We like to check and see if xp_cmdshell can be executed. Currently xp_cmdshell allows the user to enable or disable the xp. However, I'd like to be able to restore the xp_cmdshell to how we found it so that I am not leaving xp_cmdshell enabled if was already disabled on client environments.

So the breakdown would be:

  1. If xp_cmdshell is disabled and can be enabled:
    1. Enable
    2. Execute
    3. Disable
  2. If xp_cmdshell is enabled:
    1. Execute