performing-web-application-scanning-with-nikto について
Nikto を使って、許可を得た Web サーバーやアプリケーションをスキャンする方法を解説するガイドです。スキャン設定、レポート出力、結果の解釈と検証を扱い、サーバーや設定上の問題に重点を置きます。
主な機能
- 01ホストと指定ポートのスキャン
- 02スキャン条件とタイムアウトの調整
- 03複数形式でのレポート出力
- 04SSL/TLS 設定の確認
- 05検出結果と誤検知の解釈
- 06他ツールとの併用
活用シーン
- 01許可済み Web セキュリティ評価の実施
- 02定期的な脆弱性チェック
- 03サーバー設定と公開ファイルの確認
- 04報告前のスキャン結果の検証
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill performing-web-application-scanning-with-niktoインストール後、Claude Code で/performing-web-application-scanning-with-niktoを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
LICENSEassets/template.mdreferences/api-reference.mdstandards.mdworkflows.mdscripts/agent.pyprocess.py詳細
Nikto を使用した Web アプリケーションのスキャン
概要
Nikto はオープンソースの Web サーバーおよび Web アプリケーションスキャナーです。7,000 を超える危険性がある可能性のあるファイルやプログラムに対するテスト、1,250 を超えるサーバーの古いバージョンの確認、270 を超えるサーバーのバージョン固有の問題の特定を行います。XSS、SQL インジェクション、サーバーの設定ミス、デフォルトの認証情報、既知の脆弱な CGI スクリプトなどを含む包括的なテストを実施します。
使用する場面
- Nikto を使用した Web アプリケーションのスキャンを伴うセキュリティ評価を実施する場合
- 関連するセキュリティイベントのインシデント対応手順に従う場合
- 定期的なセキュリティテストや監査を実施する場合
- 実地テストを通じてセキュリティ制御を検証する場合
前提条件
- Nikto がインストールされていること(Perl ベースで、Kali Linux に含まれています)
- 対象の Web サーバーをスキャンするための書面による許可
- 対象の Web アプリケーションへのネットワークアクセス
- HTTP/HTTPS プロトコルに関する理解
基本概念
Nikto が検出するもの
- サーバーの設定ミスや危険なデフォルトファイル
- 既知の CVE がある古いサーバーソフトウェアのバージョン
- 一般的な CGI の脆弱性や危険なスクリプト
- デフォルトの認証情報や管理者ページ
- 無効にするべき HTTP メソッド(PUT、DELETE、TRACE)
- SSL/TLS の設定ミスや脆弱な暗号スイート
- セキュリティヘッダーの欠落(X-Frame-Options、CSP、HSTS)
- ヘッダーやエラーページを通じた情報漏えい
Nikto とその他の Web スキャナーの比較
| 機能 | Nikto | OWASP ZAP | Burp Suite | Nuclei |
|---|---|---|---|---|
| ライセンス | オープンソース | オープンソース | 商用 | オープンソース |
| 対象 | サーバー/設定 | アプリケーションロジック | ペネトレーションテスト全般 | テンプレートベース |
| 速度 | 高速 | 中程度 | 低速 | 非常に高速 |
| 誤検知 | 中程度 | 少ない | 少ない | 少ない |
| 認証 | 基本 | 完全 | 完全 | テンプレート |
| 活発なコミュニティ | はい | はい | はい | はい |
ワークフロー
ステップ 1:基本的なスキャン
# Basic scan against a target
nikto -h https://target.example.com
# Scan specific port
nikto -h target.example.com -p 8443
# Scan multiple ports
nikto -h target.example.com -p 80,443,8080,8443
# Scan with SSL enforcement
nikto -h target.example.com -ssl
# Scan from a host list file
nikto -h targets.txt
ステップ 2:高度なスキャンオプション
# Comprehensive scan with all tuning options
nikto -h https://target.example.com \
-Tuning 123456789abcde \
-timeout 10 \
-Pause 2 \
-Display V \
-output report.html \
-Format htm
# Tuning options control test types:
# 0 - File Upload
# 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
# a - Authentication Bypass
# b - Software Identification
# c - Remote Source Inclusion
# d - WebService
# e - Administrative Console
# Scan with specific tuning (XSS + SQL injection + auth bypass)
nikto -h https://target.example.com -Tuning 49a
# Scan with authentication
nikto -h https://target.example.com -id admin:password
# Scan through a proxy
nikto -h https://target.example.com -useproxy http://proxy:8080
# Scan with custom User-Agent
nikto -h https://target.example.com -useragent "Mozilla/5.0 (Security Scan)"
# Scan specific CGI directories
nikto -h https://target.example.com -Cgidirs /cgi-bin/,/scripts/
# Evasion techniques (IDS avoidance for authorized testing)
# 1-Random URI encoding, 2-Directory self-reference
# 3-Premature URL ending, 4-Prepend long random string
nikto -h https://target.example.com -evasion 1234
ステップ 3:出力とレポート
# Generate multiple output formats
nikto -h https://target.example.com -output scan.csv -Format csv
nikto -h https://target.example.com -output scan.xml -Format xml
nikto -h https://target.example.com -output scan.html -Format htm
nikto -h https://target.example.com -output scan.txt -Format txt
# JSON output (newer versions)
nikto -h https://target.example.com -output scan.json -Format json
# Save to multiple formats simultaneously
nikto -h https://target.example.com \
-output scan_report \
-Format htm
ステップ 4:複数の対象をスキャン
# Create targets file (one per line)
cat > targets.txt << 'EOF'
https://app1.example.com
https://app2.example.com:8443
http://internal-app.corp.local
192.168.1.100:8080
EOF
# Scan all targets
nikto -h targets.txt -output multi_scan.html -Format htm
# Parallel scanning with GNU parallel
cat targets.txt | parallel -j 5 "nikto -h {} -output {/}_report.html -Format htm"
ステップ 5:SSL/TLS 評価
# Comprehensive SSL scan
nikto -h https://target.example.com -ssl \
-Tuning b \
-Display V
# Check for specific SSL vulnerabilities
# Nikto checks for:
# - Expired certificates
# - Self-signed certificates
# - Weak cipher suites
# - SSLv2/SSLv3 enabled
# - BEAST, POODLE, Heartbleed indicators
# - Missing HSTS header
ステップ 6:他のツールとの連携
# Pipe Nmap results into Nikto
nmap -p 80,443,8080 --open -oG - 192.168.1.0/24 | \
awk '/open/{print $2}' | \
while read host; do nikto -h "$host" -output "${host}_nikto.html" -Format htm; done
# Export to Metasploit-compatible format
nikto -h target.example.com -output msf_import.xml -Format xml
# Parse Nikto XML output with Python for custom reporting
python3 -c "
import xml.etree.ElementTree as ET
tree = ET.parse('scan.xml')
for item in tree.findall('.//item'):
print(f\"[{item.get('id')}] {item.findtext('description', '')[:100]}\")
"
結果の解釈
重大度の分類
- OSVDB/CVE 参照情報:NVD と照合し、CVSS スコアを確認します
- サーバー情報の漏えい:バージョンバナー、技術スタック
- 危険な HTTP メソッド:PUT、DELETE、TRACE が有効
- デフォルトファイル/バックアップファイル:.bak、.old、.swp、web.config.bak
- 管理者向けインターフェース:/admin、/manager、/console が公開されている
- セキュリティヘッダーの欠落:CSP、X-Frame-Options、HSTS
よくある誤検知
- カスタム 404 ページによって一般的なチェックが誤って検出される
- フォームの脆弱性として誤検出されるアンチ CSRF トークン
- 脆弱性があると誤認される CDN/WAF の応答
- ロードバランサーのヘルスチェックページ
ベストプラクティス
- スキャンの前に、必ず書面による許可を得てください
- Nikto をアプリケーションレベルのスキャナー(ZAP、Burp)と併用してください
- 本番サーバーへの負荷を抑えるため、
-Pauseフラグを使用してください - 報告する前に、検出結果を手動で検証してください
- 包括的に確認するため、SSL テストツール(testssl.sh、sslyze)と組み合わせてください
- 継続的な脆弱性管理の一環として、定期スキャンを設定してください
- 最新の脆弱性チェックを行えるよう、Nikto のデータベースを最新の状態に保ってください
- 許可を得た IDS テストに限り、適切な回避設定を使用してください
よくある落とし穴
- 許可を得ずに Nikto を実行すること(法的責任が生じます)
- Nikto を完全な Web アプリケーションスキャナーとして扱うこと(主にサーバーや設定の問題を対象としています)
- 結果を検証せず、誤検知を含むレポートを作成すること
- 本番システムに対して過度に積極的なスキャンを行うこと
- SSL/TLS の検出結果を「情報提供のみ」として無視すること
関連スキル
- scanning-infrastructure-with-nessus
- scanning-apis-for-security-vulnerabilities
- performing-network-vulnerability-assessment
コメント
Markdown 対応