mirror of
https://github.com/nmap/nmap.git
synced 2026-09-21 15:46:45 +00:00
Avoid false positives in rexec-brute. Fixes #1090
This commit is contained in:
parent
a67e68b2d4
commit
59f819f198
2 changed files with 18 additions and 1 deletions
|
|
@ -33,6 +33,20 @@ categories = {"brute", "intrusive"}
|
|||
|
||||
portrule = shortport.port_or_service(512, "exec", "tcp")
|
||||
|
||||
--- Copied from telnet-brute
|
||||
-- Decide whether a given string (presumably received from a telnet server)
|
||||
-- indicates a failed login
|
||||
--
|
||||
-- @param str The string to analyze
|
||||
-- @return Verdict (true or false)
|
||||
local is_login_failure = function (str)
|
||||
local lcstr = str:lower()
|
||||
return lcstr:find("%f[%w]incorrect%f[%W]")
|
||||
or lcstr:find("%f[%w]failed%f[%W]")
|
||||
or lcstr:find("%f[%w]denied%f[%W]")
|
||||
or lcstr:find("%f[%w]invalid%f[%W]")
|
||||
or lcstr:find("%f[%w]bad%f[%W]")
|
||||
end
|
||||
|
||||
Driver = {
|
||||
|
||||
|
|
@ -72,7 +86,7 @@ Driver = {
|
|||
|
||||
local response
|
||||
status, response = self.socket:receive()
|
||||
if ( status ) then
|
||||
if ( status and not is_login_failure(response)) then
|
||||
return true, creds.Account:new(username, password, creds.State.VALID)
|
||||
end
|
||||
return false, brute.Error:new( "Incorrect password" )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue