Lucene search
K

iscsi-info NSE Script

🗓️ 10 Dec 2010 23:20:59Reported by Patrik KarlssonType 
nmap
 nmap
🔗 nmap.org👁 155 Views

Collects information from remote iSCSI targets without requiring authenticatio

Related
Code
ReporterTitlePublishedViews
Family
GithubExploit
Exploit for Code Injection in Samba
2 Dec 202509:55
githubexploit
GithubExploit
Exploit for Code Injection in Samba
25 May 201713:20
githubexploit
GithubExploit
Exploit for Code Injection in Samba
15 May 202106:52
githubexploit
GithubExploit
Exploit for Code Injection in Samba
30 May 201715:08
githubexploit
GithubExploit
Exploit for Code Injection in Samba
25 May 201713:20
githubexploit
GithubExploit
Exploit for CVE-2017-0143
16 May 201719:34
githubexploit
GithubExploit
Exploit for Code Injection in Samba
9 May 202102:32
githubexploit
GithubExploit
Exploit for Code Injection in Samba
5 Jun 201716:25
githubexploit
GithubExploit
Exploit for Code Injection in Samba
26 May 201700:58
githubexploit
GithubExploit
Exploit for Code Injection in Samba
1 Nov 202223:17
githubexploit
Rows per page
local iscsi = require "iscsi"
local shortport = require "shortport"
local stdnse = require "stdnse"

description = [[
Collects and displays information from remote iSCSI targets.
]]

---
-- @output
-- PORT     STATE SERVICE
-- 3260/tcp open  iscsi
-- | iscsi-info:
-- |   iqn.2006-01.com.openfiler:tsn.c8c08cad469d
-- |     Address: 192.168.56.5:3260,1
-- |     Authentication: NOT required
-- |   iqn.2006-01.com.openfiler:tsn.6aea7e052952
-- |     Address: 192.168.56.5:3260,1
-- |     Authentication: required
-- |_    Auth reason: Authentication failure
--
-- @xmloutput
-- <table key="iqn.2006-01.com.openfiler:tsn.c8c08cad469d">
--   <elem key="Address">192.168.56.5:3260,1</elem>
--   <elem key="Authentication">NOT required</elem>
-- </table>
-- <table key="iqn.2006-01.com.openfiler:tsn.6aea7e052952">
--   <elem key="Address">192.168.56.5:3260,1</elem>
--   <elem key="Authentication">required</elem>
--   <elem key="Auth reason">Authentication failure</elem>
-- </table>

-- Version 0.2
-- Created 2010/11/18 - v0.1 - created by Patrik Karlsson <[email protected]>
-- Revised 2010/11/28 - v0.2 - improved error handling <[email protected]>

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


portrule = shortport.portnumber(3260, "tcp", {"open", "open|filtered"})

-- Attempts to determine whether authentication is required or not
--
-- @return status true on success false on failure
-- @return result true if auth is required false if not
--         err string containing error message
local function requiresAuth( host, port, target )
  local helper = iscsi.Helper:new( host, port )
  local errors = iscsi.Packet.LoginResponse.Errors

  local status, err = helper:connect()
  if ( not(status) ) then return false, "Failed to connect" end

  local response
  status, response = helper:login( target )
  if ( not(status) ) then return false, response:getErrorMessage() end

  if ( status and response:getErrorCode() == errors.SUCCESS) then
    -- try to logout
    status = helper:logout()
  end

  status = helper:close()

  return true, "Authentication successful"
end

action = function( host, port )

  local helper = iscsi.Helper:new( host, port )

  local status = helper:connect()
  if ( not(status) ) then
    stdnse.debug1("failed to connect to server" )
    return
  end

  local records
  status, records = helper:discoverTargets()
  if ( not(status) ) then
    stdnse.debug1("failed to discover targets" )
    return
  end
  status = helper:logout()
  status = helper:close()

  local result = stdnse.output_table()
  for _, record in ipairs(records) do
    local result_part = stdnse.output_table()
    for _, addr in ipairs( record.addr ) do
      result_part["Address"] = addr
    end

    local status, err = requiresAuth( host, port, record.name )
    if ( not(status) ) then
      result_part["Authentication"] = "required"
      result_part["Auth reason"] = err
    else
      result_part["Authentication"] = "NOT required"
    end
    result[record.name] = result_part
  end
  return result
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

05 Nov 2015 20:41Current
0.4Low risk
Vulners AI Score0.4
EPSS0.94176
155