Lucene search

K
nmapPatrik KarlssonNMAP:VMAUTHD-BRUTE.NSE
HistoryJan 02, 2012 - 11:12 a.m.

vmauthd-brute NSE Script

2012-01-0211:12:46
Patrik Karlsson
nmap.org
306

9.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

10 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:L/Au:N/C:C/I:C/A:C

0.973 High

EPSS

Percentile

99.8%

Performs brute force password auditing against the VMWare Authentication Daemon (vmware-authd).

Script Arguments

passdb, unpwdb.passlimit, unpwdb.timelimit, unpwdb.userlimit, userdb

See the documentation for the unpwdb library.

creds.[service], creds.global

See the documentation for the creds library.

brute.credfile, brute.delay, brute.emptypass, brute.firstonly, brute.guesses, brute.mode, brute.passonly, brute.retries, brute.start, brute.threads, brute.unique, brute.useraspass

See the documentation for the brute library.

Example Usage

nmap -p 902 <ip> --script vmauthd-brute

Script Output

PORT    STATE SERVICE
902/tcp open  iss-realsecure
| vmauthd-brute:
|   Accounts
|     root:00000 - Valid credentials
|   Statistics
|_    Performed 183 guesses in 40 seconds, average tps: 4

Requires


local brute = require "brute"
local creds = require "creds"
local match = require "match"
local nmap = require "nmap"
local shortport = require "shortport"
local stdnse = require "stdnse"

description = [[
Performs brute force password auditing against the VMWare Authentication Daemon (vmware-authd).
]]

---
-- @usage
-- nmap -p 902 <ip> --script vmauthd-brute
--
-- @output
-- PORT    STATE SERVICE
-- 902/tcp open  iss-realsecure
-- | vmauthd-brute:
-- |   Accounts
-- |     root:00000 - Valid credentials
-- |   Statistics
-- |_    Performed 183 guesses in 40 seconds, average tps: 4
--

author = "Patrik Karlsson"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"brute", "intrusive"}


portrule = shortport.port_or_service(902, {"ssl/vmware-auth", "vmware-auth"}, "tcp")

local function fail(err) return stdnse.format_output(false, err) end
Driver = {

  new = function(self, host, port, options)
    local o = { host = host, port = port }
    setmetatable(o, self)
    self.__index = self
    return o
  end,

  connect = function(self)
    self.socket = brute.new_socket()
    return self.socket:connect(self.host, self.port)
  end,

  login = function(self, username, password)
    local status, line = self.socket:receive_buf(match.pattern_limit("\r\n", 2048), false)
    if ( line:match("^220 VMware Authentication Daemon.*SSL Required") ) then
      self.socket:reconnect_ssl()
    end

    status = self.socket:send( ("USER %s\r\n"):format(username) )
    if ( not(status) ) then
      local err = brute.Error:new( "Failed to send data to server" )
      err:setRetry( true )
      return false, err
    end

    local status, response = self.socket:receive_buf(match.pattern_limit("\r\n", 2048), false)
    if ( not(status) or not(response:match("^331") ) ) then
      local err = brute.Error:new( "Received unexpected response from server" )
      err:setRetry( true )
      return false, err
    end

    status = self.socket:send( ("PASS %s\r\n"):format(password) )
    if ( not(status) ) then
      local err = brute.Error:new( "Failed to send data to server" )
      err:setRetry( true )
      return false, err
    end
    status, response = self.socket:receive_buf(match.pattern_limit("\r\n", 2048), false)

    if ( response:match("^230") ) then
      return true, creds.Account:new(username, password, creds.State.VALID)
    end

    return false, brute.Error:new( "Login incorrect" )
  end,

  disconnect = function(self)
    return self.socket:close()
  end

}

local function checkAuthd(host, port)
  local socket = nmap.new_socket()
  local status = socket:connect(host, port)

  if( not(status) ) then
    return false, "Failed to connect to server"
  end

  local status, line = socket:receive_buf(match.pattern_limit("\r\n", 2048), false)
  socket:close()
  if ( not(status) ) then
    return false, "Failed to receive response from server"
  end

  if ( not( line:match("^220 VMware Authentication Daemon") ) ) then
    return false, "Failed to detect VMWare Authentication Daemon"
  end
  return true
end


action = function(host, port)
  local status, err = checkAuthd(host, port)
  if ( not(status) ) then
    return fail(err)
  end

  local engine = brute.Engine:new(Driver, host, port)
  engine.options.script_name = SCRIPT_NAME
  local result
  status, result = engine:start()
  return result
end

9.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

10 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:L/Au:N/C:C/I:C/A:C

0.973 High

EPSS

Percentile

99.8%

Related for NMAP:VMAUTHD-BRUTE.NSE