关于 performing-web-application-scanning-with-nikto
本指南介绍如何使用 Nikto 对获授权的 Web 服务器和应用进行安全扫描,涵盖扫描配置、报告输出、结果解读与验证,重点关注服务器及配置问题。
主要功能
- 01扫描主机与指定端口
- 02调整扫描选项与超时
- 03导出多种格式的报告
- 04检查 SSL/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