NMAP(網路資產管理平台):
用於漏洞管理的功能包括:網路資產探索和監控、漏洞掃描、風險評估、漏洞管理、報告和警報、合規性、整合性。
漏洞庫可供腳本使用,以一個常見的格式來記錄和保存漏洞。
漏洞報告的資訊需要被儲存在表格裡,每個漏洞都必須有自己的狀態:
NOT_VULN(非漏洞):已確認程式無漏洞問題。
LIKELY_VULN(可能有漏洞):程式可能有漏洞,這可能發生在進行簡單版本比較時,這個狀態也包含了可能的誤報情況。
VULN(有漏洞):已確認程式存在漏洞。
EXPLOIT(已被利用):已確認程式存在漏洞並已成功被攻擊利用。
DoS(拒絕服務攻擊):已確認程式容易受到拒絕服務攻擊,VULN狀態將會被自動設定。
為了匹配不同的漏洞狀態,例如 VULN 和 EXPLOIT、或 VULN 和 DoS 狀態,可以使用位元運算(Bitwise operations),這些操作通常應用於二進制數值的每個位元,並允許您進行位元級別的操作,如位元 AND、OR、XOR、左移、右移等。。
漏洞表格
local vuln_table = {
title = "BSD ftpd Single Byte Buffer Overflow", -- mandatory field
state = vulns.STATE.EXPLOIT, -- mandatory field
當然,我們必須確認是否被利用,否則如果確認了漏洞,只需標記為 vulns.STATE.VULN;狀態包括:'NOT_VULN'(無漏洞)、'LIKELY_VULN'(可能有漏洞)、'VULN'(有漏洞)、'DoS'(拒絕服務攻擊)和 'EXPLOIT'(已被利用)。
以下欄位都是選擇性的。
IDS = { -- Table of IDs
-- ID Type ID (must be a string)
CVE = 'CVE-2001-0053',
BID = '2124',
},
risk_factor = "High", -- 'High', 'Medium' or 'Low'
scores = { -- A map of the different scores
CVSS = "10.0",
CVSSv2 = "...",
},
description = [[
One-byte buffer overflow in BSD-based ftpd allows remote attackers
to gain root privileges.]],
dates = {
disclosure = { year = 2000, month = 12, day = 18},
},
check_results = { -- A string or a list of strings
-- This field can store the results of the vulnerability check.
-- Did the server return anything ? some specialists can
-- investigate this and decide if the program is vulnerable.
},
exploit_results = { -- A string or a list of strings
-- This field can store the results of the exploitation.
},
extra_info = { -- A string or a list of strings
-- This field can be used to store and shown any useful
-- information about the vulnerability, server, etc.
},
references = { -- List of references
'http://www.openbsd.org/advisories/ftpd_replydirname.txt',
-- If some popular IDs like 'CVE' and 'OSVBD' are provided
-- then their links will be automatically constructed.
},
}
以下範例可了解如何使用這個函式庫。
portrule 和 hostrule 腳本的範例:
-- portrule and hostrule scripts must use the vulns.Report class
-- to report vulnerabilities
local vuln_table = {
title = "BSD ftpd Single Byte Buffer Overflow", -- mandatory field
references = { -- List of references
'http://www.openbsd.org/advisories/ftpd_replydirname.txt',
},
...
}
...
vuln_table.state = vulns.STATE.VULN
local report = vulns.Report:new(SCRIPT_NAME, host, port)
return report:make_output(vuln_table, ...)
local vuln_table = {
title = "BSD ftpd Single Byte Buffer Overflow", -- mandatory field
references = { -- List of references
'http://www.openbsd.org/advisories/ftpd_replydirname.txt',
},
...
}
...
vuln_table.state = vulns.STATE.VULN
local report = vulns.Report:new(SCRIPT_NAME, host, port)
report:add(vuln_table, ...)
return report:make_output()
prerule 和 postrule 腳本的範例:
local FID -- my script FILTER ID
prerule = function()
FID = vulns.save_reports()
if FID then
return true
end
return false
end
postrule = function()
if nmap.registry[SCRIPT_NAME] then
FID = nmap.registry[SCRIPT_NAME].FID
if vulns.get_ids(FID) then
return true
end
end
return false
end
prerule_action = function()
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
nmap.registry[SCRIPT_NAME].FID = FID
return nil
end
postrule_action = function()
return vulns.make_output(FID) -- show all the vulnerabilities
end
local tactions = {
prerule = prerule_action,
postrule = postrule_action,
}
action = function(...) return tactions[SCRIPT_TYPE](...) end
函式庫中的除錯訊息:
級別 2:顯示“NOT VULNERABLE” 記錄。
級別 3:顯示所有儲存在登錄檔 (registry) 中的漏洞。
級別 5:顯示所有其他的除錯訊息。
注意:在漏洞表格儲存到登錄檔之前,總是會重新處理它們。希望確保不會有其他物件引用(指向)這些漏洞表格,如果其他物件引用了這些表格,那麼它們就不能被Lua的垃圾回收器回收,從而釋放系統資源。
腳本引數 (Script Arguments)
vulns.short
如果設定了 "vulns.short",則漏洞將以簡短格式輸出,即一行中包含目標主機的目標名稱或IP、狀態,以及CVE ID或漏洞的標題,不影響XML輸出。
vulns.showall
如果設定了該選項,函式庫將顯示並報告所有已註冊的漏洞,包括 "NOT VULNERABLE" 的漏洞;預設情況下,函式庫僅報告 "VULNERABLE" 狀態的紀錄:VULNERABLE、LIKELY VULNERABLE、VULNERABLE(DoS)和VULNERABLE(Exploitable)。
此引數影響以下函數:
vulns.Report.make_output():用於portule/hostrule腳本的預設輸出函數
vulns.make_output():用於postrule腳本的默認輸出函數
vulns.format_vuln() 和 vulns.format_vuln_table() 函數。
延伸閱讀
NetAlly 滲透測試及網路測試總覽 > CyberScope Nmap 滲透測試手持式網路分析儀,整合了 Nmap 功能,為站點存取層提供全面的網路安全風險評估、分析、和報告——包括所有的端點和網路探索、有線與無線網路安全、漏洞評估 (Nmap) 以及網段和配置驗證;IT 人員透過單一工具以及單一介面,即可快速且即時的掌握企業或組織的各種混合式網路環境 (有線、無線、PoE)、各種連網終端裝置的拓樸、架構、設置、網段、效能、直到網路安全評估。