安全掃描工具nikto簡單使用
簡介
Nikto是一款開源的(GPL)網頁服務器掃描器,它可以對網頁服務器進行全面的多種掃描,包含超過3300種有潛在危險的文件/CGIs;超過625種服務器版本;超過230種特定服務器問題。掃描項和插件可以自動更新(如果需要)。基於Whisker/libwhisker完成其底層功能。
github源碼
https://github.com/sullo/nikto
docker極速安裝
官方說安裝程序之前要裝好Perl, Perl Modules, OpenSSL, LibWhisker 或者其他依賴,對於使用者來說最麻煩的就是安裝環境依賴了,最近一直在嘗試docker部署各種公共服務,果斷看下docker上有沒有現成環境拿來用
# docker search nikto NAME DESCRIPTION STARS OFFICIAL AUTOMATED k0st/alpine-nikto Nikto web scanner on Alpine (size: ~50 MB) 2 [OK] kenney/nikto Image with nikto-2.1.5 that is useful for ... 2 activeshadow/nikto 0 [OK] infoslack/nikto 0 [OK] adamoss/nikto this is nikto with ssl support for X86 0 awilson/hydra-nikto Built on Ubuntu Trusty, has THC-Hydra and ... 0
選了kenney/nikto拿來用,在裝有docker的機器上拉取鏡像
docker pull kenney/nikto
docker inspect kenney/nikto
發現這個鏡像的啟動命令是bash,說明是一個腳本型的鏡像,而不是服務型的鏡像。
"Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "FILES=nikto-2.1.5" ], "Cmd": [ "bash" ],
這個鏡像實際上提供好了環境和安裝好的腳本,使用者要做的就是直接將執行命令傳過去,如下簡單示例,指定host和端口進行默認的掃描
docker run --rm -t kenney/nikto:latest nikto -h www.163.com -p 443
這里的–rm指的是執行完清理容器,這樣就不會有日志什么的殘留在主機上
等待一會可以看到結果輸出
# docker run --rm -t kenney/nikto:latest nikto -h www.163.com -p 443 - Nikto v2.1.5 --------------------------------------------------------------------------- + Target IP: 122.228.237.158 + Target Hostname: www.163.com + Target Port: 443 --------------------------------------------------------------------------- + SSL Info: Subject: /C=CN/O=Sinorail Certification Authority/OU=\x94\xC1\x8D\xEF[\xA2b7g\x0DR\xA1N-_\xC3/CN=kyfw.12306.cn Ciphers: ECDHE-RSA-AES256-GCM-SHA384 Issuer: /C=CN/O=Sinorail Certification Authority/CN=SRCA + Start Time: 2015-11-01 09:19:38 (GMT0) --------------------------------------------------------------------------- + Server: Cdn Cache Server V2.0 + The anti-clickjacking X-Frame-Options header is not present. + Uncommon header 'x-via' found, with contents: 1.0 czdx90:88 (Cdn Cache Server V2.0), 1.0 wenzhoudianxin53:10 (Cdn Cache Server V2.0) + No CGI Directories found (use '-C all' to force check all possible dirs) + "robots.txt" retrieved but it does not contain any 'disallow' entries (which is odd). + Hostname 'www.163.com' does not match certificate's CN 'kyfw.12306.cn' + /kboard/: KBoard Forum 0.3.0 and prior have a security problem in forum_edit_post.php, forum_post.php and forum_reply.php + /lists/admin/: PHPList pre 2.6.4 contains a number of vulnerabilities including remote administrative access, harvesting user info and more. Default login to admin interface is admin/phplist + /ssdefs/: Siteseed pre 1.4.2 has 'major' security problems. + /sshome/: Siteseed pre 1.4.2 has 'major' security problems. + /tiki/tiki-install.php: Tiki 1.7.2 and previous allowed restricted Wiki pages to be viewed via a 'URL trick'. Default login/pass could be admin/admin
簡單命令說明
Nikto掃描最基本的就是需要主機目標IP、主機端口。默認掃描的是80端口。掃描主機目標IP地址可以使用選項-h(host),指定端口可以使用選項-p(port)。如下所示:
perl nikto.pl –h 192.168.0.1 –p 443
Nikto也可以同時掃描多個端口,使用選項-p(port),可以掃描一段范圍(比如:80-90),也可以掃描多個端口(比如:80,88,90)。下面掃描主機的80/88/443端口,如下所示:
Perl nikto.pl –h 192.168.0.1 –p 80,88,443
如果運行Nikto的主機是通過HTTP proxy來訪問互聯網的,也可以使用代理來掃描,使用選項-u(useproxy)。下面將通過HTTP proxy來掃描,
Nikto的升級可以通過從http://updates.cirt.net/網站下載來更新插件和數據庫,也可以通過-update的命令來更新插件和數據庫:如下所示:
Perl nikto.pl –update
Nikto的選項說明:
-
-Cgidirs
掃描CGI目錄。
-
-config
使用指定的config文件來替代安裝在本地的config.txt文件
-
-dbcheck
選擇語法錯誤的掃描數據庫。
-
-evasion
使用LibWhisker中對IDS的躲避技術,可使用以下幾種類型:
1. 隨機URL編碼(非UTF-8方式)
2. 自選擇路徑(/./)
3. 虛假的請求結束
4. 長的URL請求
5. 參數隱藏
6. 使用TAB作為命令的分隔符
7. 大小寫敏感
8. 使用Windows路徑分隔符\替換/
9. 會話重組
-
-findonly
僅用來發現HTTP和HTTPS端口,而不執行檢測規則
-
-Format
指定檢測報告輸出文件的格式,默認是txt文件格式(csv/txt/htm)
-
-host
目標主機,主機名、IP地址、主機列表文件。
-
-id
ID和密碼對於授權的HTTP認證。格式:id:password
-
-mutate
變化猜測技術
1.使用所有的root目錄測試所有文件
2.猜測密碼文件名字
3.列舉Apache的用戶名字(/~user)
4.列舉cgiwrap的用戶名字(/cgi-bin/cgiwrap/~user)
-
-nolookup
不執行主機名查找
-
-output
報告輸出指定地點
-
-port
掃描端口指定,默認為80端口。
-
-Pause
每次操作之間的延遲時間
-
-Display
控制Nikto輸出的顯示
1.直接顯示信息
2.顯示的cookies信息
3.顯示所有200/OK的反應
4.顯示認證請求的URLs
5.Debug輸出
-
-ssl
強制在端口上使用SSL模式
-
-Single
執行單個對目標服務的請求操作。
-
-timeout
每個請求的超時時間,默認為10秒
-
-Tuning
Tuning 選項控制Nikto使用不同的方式來掃描目標。
0.文件上傳
1.日志文件
2.默認的文件
3.信息泄漏
4.注射(XSS/Script/HTML)
5.遠程文件檢索(Web 目錄中)
6.拒絕服務
7.遠程文件檢索(服務器)
8.代碼執行-遠程shell
9.SQL注入
a.認證繞過
b.軟件關聯
g.屬性(不要依懶banner的信息)
x.反向連接選項
-
-useproxy
使用指定代理掃描
-
-update
更新插件和數據庫
查看結果
將本地目錄掛載到容器中,將結果輸出到該目錄,使得我們能在運行結束后拿到結果
docker run -v /home/root/data/:/root --rm -t kenney/nikto:latest nikto -h c.163.com -p 443 -o /root/result.html -F htm
運行完后查看主機目錄
/home/root/data# ls -lrt total 8 drwxr-xr-x 2 root root 4096 Nov 1 16:06 log -rw-r--r-- 1 root root 3825 Nov 1 19:04 result.html
結果如下