参考如下文档,并进行整合
Nmap脚本使用指南 (倾旋)
https://zhuanlan.zhihu.com/p/26618074
延伸阅读
Nmap脚本编写指南
https://zhuanlan.zhihu.com/p/27224457
脚本参数
1 2 3 4 5 6 7 8 9 10 11
| SCRIPT SCAN: -sC: equivalent to --script=default --script=<Lua scripts>: <Lua scripts> is a comma separated list of directories, script-files or script-categories --script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts --script-args-file=filename: provide NSE script args in a file --script-trace: Show all data sent and received --script-updatedb: Update the script database. --script-help=<Lua scripts>: Show help about scripts. <Lua scripts> is a comma-separated list of script-files or script-categories.
|
-sC
是指的是采用默认配置扫描,与--script=default
参数等价
具体调用的函数列表包括
default NSE Category(https://nmap.org/nsedoc/categories/default.html)
--script=脚本名称
,脚本一般都在Nmap的安装目录下的scripts目录中
那么Linux下可以查看脚本数量:
1
| ls /usr/share/nmap/scripts/ | sed 's/.nse//' > scripts.list
|
举个例子
1
| nmap -p 23 --script telnet-brute --script-args userdb=myusers.lst,passdb=mypwds.lst,telnet-brute.timeout=8s <target>
|
运营商内网漏洞举例
(以下行为为原作者进行)
下面我们来实战一下,今日刚发现的运营商漏洞,就出在 Telnet 上。
我家上网是没有分配公网IP的,就是路由那里是一个内网,于是我先用nmap探测了一下这个内网,发现有某些网络设备。
1
| nmap -sT -Pn -F 10.14.16.0/24
|
在结果中发现了一台主机的信息:
1 2 3 4 5 6 7 8 9
| Nmap scan report for bogon (10.14.16.106) Host is up (0.021s latency). Not shown: 95 filtered ports PORT STATE SERVICE 23/tcp open telnet 53/tcp open domain 1723/tcp open pptp 8081/tcp open blackice-icecap 49152/tcp open unknown
|
作为一个搞Web安全的,首先去看的是8081,但是未果。于是准备从Telnet碰碰运气,会不会运营商也用弱口令?
我把字典放到了 /usr/share/nmap/nselib/data
,因为这个目录中是专门存放Nmap默认字典的。
其他常用脚本
1 2
| http-ls 目录扫描 http-brute HTTP认证爆破
|
Nmap目录扫描
1
| nmap --script=http-ls vault.centos.org
|
扫描结果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| root@ThundeRobot:/usr/share/nmap/nselib/data# nmap --script=http-ls vault.centos.org Starting Nmap 7.01 ( https://nmap.org ) at 2017-04-28 04:01 CST Nmap scan report for vault.centos.org (109.72.83.61) Host is up (0.38s latency). Other addresses for vault.centos.org (not scanned): 2607:ff28:0:28:5054:ff:fe4b:3e8a Not shown: 998 filtered ports PORT STATE SERVICE 80/tcp open http | http-ls: Volume / | maxfiles limit reached (10) | SIZE TIME FILENAME | - 19-Aug-2009 01:36 2.1/ | 1.2M 19-Aug-2009 01:36 2.1/centos2-scripts-v1.tar | - 07-Sep-2004 13:04 2.1/extras/ | - 13-May-2004 03:26 2.1/final/ | - 15-Apr-2004 05:11 2.1/i386/ | - 08-Jan-2004 00:50 2.1/source/ | - 30-Dec-2003 06:18 2.1/updates/ | - 31-Jul-2005 16:05 3.1/ | - 20-Apr-2012 10:14 3.1/SRPMS/ | - 15-Sep-2004 14:17 3.1/addons/ |_ 873/tcp open rsync Nmap done: 1 IP address (1 host up) scanned in 58.35 seconds root@ThundeRobot:/usr/share/nmap/nselib/data#
|
Nmap HTTP认证爆破
1
| nmap --script=http-brute dvwa.vuln.leafsec.com
|
MS-08067/MS17-010
1 2
| nmap --script smb-vuln-ms08-067.nse -p445 10.203.9.131 [--system-dns] nmap -sU --script smb-vuln-ms08-067.nse -p U:137 10.203.9.131 [--system-dns]
|
批量扫描
1
| nmap --script smb-vuln* 10.203.9.131/16 # 耗时约五小时
|
补充脚本
https://github.com/nmap/nmap/tree/master/scripts
https://github.com/cldrn/nmap-nse-scripts/tree/master/scripts
延伸阅读
漏洞利用方面:vuln NSE Category
https://nmap.org/nsedoc/categories/vuln.html
权限验证方面:auth NSE Category
https://nmap.org/nsedoc/categories/auth.html
暴力破解方面:brute NSE Category
https://nmap.org/nsedoc/categories/brute.html
服务信息发现:discovery NSE Category
https://nmap.org/nsedoc/categories/discovery.html
DOS攻击方面:dos NSE Category
https://nmap.org/nsedoc/categories/dos.html
漏洞利用方面: exploit NSE Category
https://nmap.org/nsedoc/categories/exploit.html
外部扩展方面:external NSE Category (集成了shodanAPI)
https://nmap.org/nsedoc/categories/external.html
FUZZ测试方面:fuzzer NSE Category
https://nmap.org/nsedoc/categories/fuzzer.html
一些针对的服务入侵模块:intrusive NSE Category
https://nmap.org/nsedoc/categories/intrusive.html
恶意后门方面:malware NSE Category
https://nmap.org/nsedoc/categories/malware.html
版本识别:version NSE Category
https://nmap.org/nsedoc/categories/version.html
以下参数都可以作为–script的通配参数,例如:--script=vuln
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| auth broadcast brute default discovery dos exploit external fuzzer intrusive malware safe version vuln all
|