2022年5月27日 星期五

[研究] Nikto2 v2.1.6 - Web Server Scanner 安裝與使用 (CentOS Stream 9)

 [研究] Nikto2 v2.1.6 - Web Server Scanner 安裝與使用 (CentOS Stream 9)

2022-05-27

Nikto - 維基百科,自由的百科全書
https://zh.wikipedia.org/wiki/Nikto

Nikto2 是 Web Server Scanner。

Nikto是一款開源的(GPL)網頁伺服器掃描器,它可以對網頁伺服器進行全面的多種掃描,包含超過3300種有潛在危險的文件/CGIs;超過625種伺服器版本;超過230種特定伺服器問題。掃描項和插件可以自動更新(如果需要)。基於Whisker/libwhisker完成其底層功能。這是一款非常棒的工具,但其軟體本身並不經常更新,最新和最危險的可能檢測不到。

官方網站
http://www.cirt.net/nikto2

Nikto 最新為 v2.1.6 版,釋出時間 2015-07-09。
CentOS Stream 9 Linux 預設 yum 不提供 Nikto安裝,就算安裝了 epel-release 後也如此。
參考官方用 Git 安裝,然後自己安裝 perl 套件 
https://github.com/sullo/nikto

[user1@localhost ~]$ sudo yum info nikto
Last metadata expiration check: 0:00:33 ago on Fri 27 May 2022 08:22:46 PM CST.
Error: No matching Packages to list
[user1@localhost ~]$ 

[user1@localhost ~]$ sudo yum -y install epel-release
Last metadata expiration check: 0:01:28 ago on Fri 27 May 2022 08:22:46 PM CST.
Dependencies resolved.
================================================================================
 Package                 Architecture Version         Repository           Size
================================================================================
Installing:
 epel-release            noarch       9-2.el9         extras-common        17 k
Installing weak dependencies:
 epel-next-release       noarch       9-2.el9         extras-common       8.1 k

Transaction Summary
================================================================================
Install  2 Packages

Total download size: 25 k
Installed size: 26 k
Downloading Packages:
(1/2): epel-next-release-9-2.el9.noarch.rpm      44 kB/s | 8.1 kB     00:00    
(2/2): epel-release-9-2.el9.noarch.rpm           80 kB/s |  17 kB     00:00    
--------------------------------------------------------------------------------
Total                                           9.1 kB/s |  25 kB     00:02     
CentOS Stream 9 - Extras packages               2.1 MB/s | 2.1 kB     00:00    
Importing GPG key 0x1D997668:
 Userid     : "CentOS Extras SIG (https://wiki.centos.org/SpecialInterestGroup) <security@centos.org>"
 Fingerprint: 363F C097 2F64 B699 AED3 968E 1FF6 A217 1D99 7668
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : epel-release-9-2.el9.noarch                            1/2 
  Installing       : epel-next-release-9-2.el9.noarch                       2/2 
  Running scriptlet: epel-next-release-9-2.el9.noarch                       2/2 
  Verifying        : epel-next-release-9-2.el9.noarch                       1/2 
  Verifying        : epel-release-9-2.el9.noarch                            2/2 

Installed:
  epel-next-release-9-2.el9.noarch          epel-release-9-2.el9.noarch         

Complete!
[user1@localhost ~]$ sudo yum -y install epel-release
Extra Packages for Enterprise Linux 9 - x86_64  698 kB/s | 6.4 MB     00:09    
Extra Packages for Enterprise Linux 9 - Next -  571 kB/s | 1.3 MB     00:02    
Last metadata expiration check: 0:00:02 ago on Fri 27 May 2022 08:24:35 PM CST.
Package epel-release-9-2.el9.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[user1@localhost ~]$ sudo yum info nikto
Last metadata expiration check: 0:00:10 ago on Fri 27 May 2022 08:24:35 PM CST.
Error: No matching Packages to list
[user1@localhost ~]$ 


user1@localhost ~]$ git clone https://github.com/sullo/nikto
bash: git: command not found...
Install package 'git-core' to provide command 'git'? [N/y] y


 * Waiting in queue... 
The following packages have to be installed:
 git-core-2.31.1-2.el9.2.x86_64	Core package of git with minimal functionality
Proceed with changes? [N/y] y


 * Waiting in queue... 
 * Waiting for authentication... 
 * Waiting in queue... 
 * Downloading packages... 
 * Requesting data... 
 * Testing changes... 
 * Installing packages... 
Cloning into 'nikto'...
remote: Enumerating objects: 6973, done.
remote: Counting objects: 100% (984/984), done.
remote: Compressing objects: 100% (290/290), done.
remote: Total 6973 (delta 724), reused 921 (delta 693), pack-reused 5989
Receiving objects: 100% (6973/6973), 4.65 MiB | 7.81 MiB/s, done.
Resolving deltas: 100% (5041/5041), done.

[user1@localhost ~]$ cd nikto/program
[user1@localhost program]$ ./nikto.pl -h 192.168.128.140
ERROR: Required module not found: Net::hostent
ERROR: Required module not found: Time::HiRes qw(sleep ualarm gettimeofday tv_interval)
[user1@localhost program]$ perl ./nikto.pl -h 192.168.128.140
ERROR: Required module not found: Net::hostent
ERROR: Required module not found: Time::HiRes qw(sleep ualarm gettimeofday tv_interval)
[user1@localhost program]$ sudo yum -y install perl

測試

先自己用  sudo  yum  -y  install  httpd 安裝 Web Server

用  sudo  service  httpd  restart 啟動,開始測試自己
  (-h 參數表示目的主機;某些版本測自己會出現 Permission denied,測別台才行。)

[user1@localhost program]$ ./nikto.pl -h 192.168.128.140
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          192.168.128.140
+ Target Hostname:    192.168.128.140
+ Target Port:        80
+ Start Time:         2022-05-27 20:49:16 (GMT8)
---------------------------------------------------------------------------
+ Server: Apache/2.4.51 (CentOS Stream)
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type.
+ Allowed HTTP Methods: OPTIONS, HEAD, GET, POST, TRACE 
+ OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST
+ OSVDB-3268: /icons/: Directory indexing found.
+ OSVDB-3233: /icons/README: Apache default file found.
+ 8916 requests: 0 error(s) and 6 item(s) reported on remote host
+ End Time:           2022-05-27 20:49:32 (GMT8) (16 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested


      *********************************************************************
      Portions of the server's headers (Apache/2.4.51) are not in
      the Nikto 2.1.6 database or are newer than the known string. Would you like
      to submit this information (*no server specific data*) to CIRT.net
      for a Nikto update (or you may email to sullo@cirt.net) (y/n)? n

[user1@localhost program]$

參數說明

[user1@localhost program]$ ./nikto.pl -Help

   Options:
       -ask+               Whether to ask about submitting updates
                               yes   Ask about each (default)
                               no    Don't ask, don't send
                               auto  Don't ask, just send
       -Cgidirs+           Scan these CGI dirs: "none", "all", or values like "/cgi/ /cgi-a/"
       -config+            Use this config file
       -Display+           Turn on/off display outputs:
                               1     Show redirects
                               2     Show cookies received
                               3     Show all 200/OK responses
                               4     Show URLs which require authentication
                               D     Debug output
                               E     Display all HTTP errors
                               P     Print progress to STDOUT
                               S     Scrub output of IPs and hostnames
                               V     Verbose output
       -dbcheck           Check database and other key files for syntax errors
       -evasion+          Encoding technique:
                               1     Random URI encoding (non-UTF8)
                               2     Directory self-reference (/./)
                               3     Premature URL ending
                               4     Prepend long random string
                               5     Fake parameter
                               6     TAB as request spacer
                               7     Change the case of the URL
                               8     Use Windows directory separator (\)
                               A     Use a carriage return (0x0d) as a request spacer
                               B     Use binary value 0x0b as a request spacer
       -Format+           Save file (-o) format:
                               csv   Comma-separated-value
                               json  JSON Format
                               htm   HTML Format
                               nbe   Nessus NBE format
                               sql   Generic SQL (see docs for schema)
                               txt   Plain text
                               xml   XML Format
                               (if not specified the format will be taken from the file extension passed to -output)
       -Help              This help information
       -host+             Target host/URL
       -404code           Ignore these HTTP codes as negative responses (always). Format is "302,301".
       -404string         Ignore this string in response body content as negative response (always). Can be a regular expression.
       -id+               Host authentication to use, format is id:pass or id:pass:realm
       -key+              Client certificate key file
       -list-plugins      List all available plugins, perform no testing
       -maxtime+          Maximum testing time per host (e.g., 1h, 60m, 3600s)
       -mutate+           Guess additional file names:
                               1     Test all files with all root directories
                               2     Guess for password file names
                               3     Enumerate user names via Apache (/~user type requests)
                               4     Enumerate user names via cgiwrap (/cgi-bin/cgiwrap/~user type requests)
                               5     Attempt to brute force sub-domain names, assume that the host name is the parent domain
                               6     Attempt to guess directory names from the supplied dictionary file
       -mutate-options    Provide information for mutates
       -nointeractive     Disables interactive features
       -nolookup          Disables DNS lookups
       -nossl             Disables the use of SSL
       -no404             Disables nikto attempting to guess a 404 page
       -Option            Over-ride an option in nikto.conf, can be issued multiple times
       -output+           Write output to this file ('.' for auto-name)
       -Pause+            Pause between tests (seconds)
       -Plugins+          List of plugins to run (default: ALL)
       -port+             Port to use (default 80)
       -RSAcert+          Client certificate file
       -root+             Prepend root value to all requests, format is /directory
       -Save              Save positive responses to this directory ('.' for auto-name)
       -ssl               Force ssl mode on port
       -Tuning+           Scan tuning:
                               1     Interesting File / Seen in logs
                               2     Misconfiguration / Default File
                               3     Information Disclosure
                               4     Injection (XSS/Script/HTML)
                               5     Remote File Retrieval - Inside Web Root
                               6     Denial of Service
                               7     Remote File Retrieval - Server Wide
                               8     Command Execution / Remote Shell
                               9     SQL Injection
                               0     File Upload
                               a     Authentication Bypass
                               b     Software Identification
                               c     Remote Source Inclusion
                               d     WebService
                               e     Administrative Console
                               x     Reverse Tuning Options (i.e., include all except specified)
       -timeout+          Timeout for requests (default 10 seconds)
       -Userdbs           Load only user databases, not the standard databases
                               all   Disable standard dbs and load only user dbs
                               tests Disable only db_tests and load udb_tests
       -useragent         Over-rides the default useragent
       -until             Run until the specified time or duration
       -update            Update databases and plugins from CIRT.net
       -url+              Target host/URL (alias of -host)
       -useproxy          Use the proxy defined in nikto.conf, or argument http://server:port
       -Version           Print plugin and database versions
       -vhost+            Virtual host (for Host header)
   		+ requires a value

[user1@localhost program]$ 



(完)

參考
[研究] Nikto2 v2.1.6 - Web Server Scanner 安裝與使用 (CentOS Stream 9)
https://shaurong.blogspot.com/2022/05/nikto2-v216-web-server-scanner-centos.html

[研究] Nikto2 v2.1.6 - Web Server Scanner 安裝與使用 (Fedora 36 x64_86)
https://shaurong.blogspot.com/2022/05/nikto2-v216-web-server-scanner-fedora.html

[研究] Nikto2 v2.1.5 安裝與使用 (CentOS 7.0 x64_86)
http://shaurong.blogspot.tw/2014/08/nikto2-v215-centos-70-x6486.html

[研究] Nikto2 v2.1.5 安裝與使用 (CentOS 6.3 x86)
http://shaurong.blogspot.tw/2012/12/nikto2-v215-centos-63-x86.html

[研究] Nikto2 v2.1.4 安裝與使用 (Fedora 15 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20385

[研究] Nikto2 v2.1.4 Web Scanner 安裝與使用 (CentOS 6.0 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?p=63655

沒有留言:

張貼留言