セキュリティ勉強中です。脆弱性チェック、ちゃんとしていきたいですよね。
はじめに
Nikto 2.1.6が現在のところ最新版です。
https://github.com/sullo/nikto/tree/2.1.6
脆弱性チェックしたいWebサーバにインストールし実行してみます。
インストール方法
$ git clone https://github.com/sullo/nikto
$ cd nikto
$ git fetch --tags
$ git checkout -b {ブランチ名} refs/tags/2.1.6
$ cd program
$ perl nikto.pl
- ***** SSL support not available (see docs for SSL install) *****
- Nikto v2.1.6
---------------------------------------------------------------------------
(略)
使用方法
ローカルホストに対し脆弱性チェックを実行します。
$ perl ./nikto.pl -h 127.0.0.1 -C all
- ***** SSL support not available (see docs for SSL install) *****
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP: 127.0.0.1
+ Target Hostname: 127.0.0.1
+ Target Port: 80
+ Start Time: 2019-04-24 15:52:06 (GMT9)
---------------------------------------------------------------------------
+ Server: Apache/2.X.X (CentOS) PHP/7.X.XX
+ Server leaks inodes via ETags, header found with file /, fields: 0x16 0x5864c8524d6c6
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ 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
+ Apache/2.X.X appears to be outdated (current is at least Apache/2.4.12). Apache 2.0.65 (final release) and 2.2.29 are also current.
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS, 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.
+ 26146 requests: 0 error(s) and 9 item(s) reported on remote host
+ End Time: 2019-04-24 15:52:33 (GMT9) (27 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested
こんな感じで脆弱性がリストアップされます。
それぞれ対応していって、こんな感じに減らしていきます。Apacheの対応策はこのあたりの記事が詳しかったです。
$ perl ./nikto.pl -h 127.0.0.1 -C all
- ***** SSL support not available (see docs for SSL install) *****
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP: 127.0.0.1
+ Target Hostname: 127.0.0.1
+ Target Port: 80
+ Start Time: 2019-04-24 15:38:30 (GMT9)
---------------------------------------------------------------------------
+ Server: Apache
+ Server leaks inodes via ETags, header found with file /, fields: 0x16 0x5864c8524d6c6
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS
+ 26147 requests: 0 error(s) and 2 item(s) reported on remote host
+ End Time: 2019-04-24 15:39:01 (GMT9) (31 seconds)
---------------------------------------------------------------------------
ETagsの対応方法はよくわからなかったです、ご存知の方、コメントいただけると幸いです。
おわりに
最近NiktoもDockerコンテナ化されていて、DevSecOpsに導入しやすいようになってますね。弊社はまだSecの部分は自動化できていないですが、うまくこの辺りを使ってなんとかしたいです。