Skip to content

Commit 3fed973

Browse files
committed
vsftpd_232: Add report_note (if service down, host up)
1 parent 5932c72 commit 3fed973

1 file changed

Lines changed: 26 additions & 29 deletions

File tree

modules/auxiliary/dos/ftp/vsftpd_232.rb

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,47 +51,45 @@ def sanitize_ftp_response(str)
5151
def check
5252
# attempt to connect
5353
begin
54-
if !connect_login
55-
print_error('Connection refused')
56-
return Exploit::CheckCode::Unknown('Failed to connect or authenticate via FTP')
57-
end
58-
59-
if banner
60-
vprint_status("FTP banner: #{sanitize_ftp_response(banner)}")
61-
62-
# Cleaned up FTP banner
63-
report_service(
64-
host: rhost,
65-
port: rport,
66-
proto: 'tcp',
67-
name: 'ftp',
68-
info: sanitize_ftp_response(banner)
69-
)
70-
71-
# Raw FTP banner
72-
report_note(
73-
host: rhost,
74-
port: rport,
75-
proto: 'tcp',
76-
type: 'ftp.banner',
77-
data: { banner: banner.strip }
78-
)
79-
end
54+
return Exploit::CheckCode::Unknown('Failed to connect or authenticate via FTP') unless connect_login
8055
rescue Rex::ConnectionRefused
81-
print_error('Connection refused')
56+
report_host(host: rhost)
8257
return Exploit::CheckCode::Unknown('Connection refused by the target')
8358
rescue Rex::ConnectionTimeout
84-
print_error('Connection timed out')
59+
report_host(host: rhost)
8560
return Exploit::CheckCode::Unknown('Connection timed out')
8661
end
8762

63+
if banner
64+
vprint_status("FTP banner: #{@banner_version}")
65+
66+
# Cleaned up FTP banner
67+
report_service(
68+
host: rhost,
69+
port: rport,
70+
proto: 'tcp',
71+
name: 'ftp',
72+
info: @banner_version
73+
)
74+
75+
# Raw FTP banner
76+
report_note(
77+
host: rhost,
78+
port: rport,
79+
proto: 'tcp',
80+
type: 'ftp.banner',
81+
data: { banner: banner.strip }
82+
)
83+
end
84+
8885
s = ''
8986
loop do
9087
# get each line until our desired line shows or end line shows
9188
s = send_cmd(['STAT'], true)
9289
break if (s =~ /vsFTPd \d+\.\d+\.\d+/) || (s == "211 End of status\r\n")
9390
end
9491
disconnect
92+
9593
# check if version was found
9694
if s !~ /vsFTPd \d+\.\d+\.\d+/
9795
print_error('Did not find FTP version in FTP session')
@@ -117,7 +115,6 @@ def run
117115

118116
attempts = 0
119117
max = datastore['MAX_ATTEMPTS'].to_i
120-
121118
loop do
122119
attempts += 1
123120
if max > 0 && attempts > max

0 commit comments

Comments
 (0)