Skip to content

Commit 256e27c

Browse files
committed
Land rapid7#10866, libssh_auth_bypass check updates
2 parents 6920470 + e1a7c35 commit 256e27c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/auxiliary/scanner/ssh/libssh_auth_bypass.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ def initialize(info = {})
5858

5959
# Vulnerable since 0.6.0 and patched in 0.7.6 and 0.8.4
6060
def check_banner(ip, version)
61-
version =~ /libssh_([\d.]+)$/ && $1 && (v = Gem::Version.new($1))
61+
version =~ /libssh[_-]?([\d.]*)$/ && $1 && (v = Gem::Version.new($1))
6262

6363
if v.nil?
6464
vprint_error("#{ip}:#{rport} - #{version} does not appear to be libssh")
6565
Exploit::CheckCode::Unknown
66+
elsif v == Gem::Version.new('')
67+
vprint_warning("#{ip}:#{rport} - libssh version not reported")
68+
Exploit::CheckCode::Detected
6669
elsif v.between?(Gem::Version.new('0.6.0'), Gem::Version.new('0.7.5')) ||
6770
v.between?(Gem::Version.new('0.8.0'), Gem::Version.new('0.8.3'))
6871
vprint_good("#{ip}:#{rport} - #{version} appears to be unpatched")
@@ -110,8 +113,10 @@ def run_host(ip)
110113
version = ssh.transport.server_version.version
111114

112115
# XXX: The OOB authentication leads to false positives, so check banner
113-
return if datastore['CHECK_BANNER'] &&
114-
check_banner(ip, version) != Exploit::CheckCode::Appears
116+
if datastore['CHECK_BANNER']
117+
return if check_banner(ip, version) !=
118+
(Exploit::CheckCode::Appears || Exploit::CheckCode::Detected)
119+
end
115120

116121
report_vuln(
117122
host: ip,

0 commit comments

Comments
 (0)