简介
Nikto 是一款开源的 Web 服务器扫描工具,由 CIRT.net 开发,用于发现 Web 服务器的安全漏洞、配置问题和潜在风险。
📥 安装
Linux/macOS:
# Via apt
sudo apt-get install nikto
# Via Perl手动安装
git clone https://github.com/sullo/nikto
cd nikto/program
Windows:
- 需要 Perl 环境(如 Strawberry Perl)
🎯 核心功能
| 功能 | 说明 |
|---|---|
| 漏洞扫描 | 检测服务器上已知的安全漏洞 |
| 服务器指纹 | 识别服务器类型、版本、操作系统 |
| 配置检查 | 发现配置错误和安全风险 |
| 敏感文件扫描 | 查找老旧/备份文件、配置文件泄露 |
| CGI 检测 | 发现可能存在风险的 CGI 脚本 |
📋 常用命令
- 基础扫描:
nikto -h http://target.com
- 指定端口扫描:
nikto -h http://target.com -p 8080,8443
- HTTPS 扫描:
nikto -h https://target.com -ssl
- 扫描多个主机:
nikto -h targets.txt # 主机列表文件
- 保存报告:
# HTML 格式
nikto -h http://target.com -o report.html -Format html
# CSV 格式
nikto -h http://target.com -o report.csv -Format csv
# XML 格式
nikto -h http://target.com -o report.xml -Format xml
- 交互式选项:
nikto -h http://target.com -Display V # 显示详细扫描过程
nikto -h http://target.com -Tuning 1 # 仅扫描信息类漏洞
⚙️ 常用参数
| 参数 | 作用 |
|---|---|
| -h | 目标主机 |
| -p | 指定端口(默认80/443) |
| -ssl | 强制 SSL/HTTPS |
| -o | 输出文件 |
| -Format | 输出格式(html, csv, xml, txt) |
| -Tuning | 调优扫描类型(1-9,不同类别) |
| -mutate | 暴力猜测子域名/文件名 |
| -evasion | 使用编码绕过简单 IDS |
| -timeout | 超时时间 |
| -id | HTTP 认证(user:pass) |
| -cookie | 设置 Cookie |
| -Pause | 每请求间隔时间 |
🎮 扫描类型调优(-Tuning)
| 类型 | 说明 |
|---|---|
| -Tuning 1 | 文件上传/执行类漏洞 |
| -Tuning 2 | 默认文件/错误文件 |
| -Tuning 3 | 信息泄露 |
| -Tuning 4 | 注入(XSS/SQL等) |
| -Tuning 5 | 远程文件获取 |
| -Tuning 9 | 拒绝服务 |
💡 使用场景
场景1:上线前安全检测
nikto -h https://your-site.com -o pre-deploy-scan.html -Format html
Web 应用上线前,扫描是否存在已知漏洞
场景2:渗透测试信息收集
nikto -h http://target.com -p 80,443,8080 -ssl
快速了解目标服务器的指纹和暴露面
场景3:CTF 比赛
nikto -h http://challenge-server -Tuning 1,2,3
发现比赛环境中的配置错误和可利用点
场景4:授权红队测试
nikto -h 192.168.1.100 -p 1-1000 -ssl
对内网 Web 系统进行全面的漏洞排查
场景5:监控复检
nikto -h https://site.com -o scan_v2.xml -Format xml
# 与之前版本对比,验证修复
⚠️ 注意事项
- 仅扫描已授权目标 --- 未授权扫描属违法行为!
- 扫描可能触发 IDS/IPS --- 目标有防护会报警
- 扫描速度较慢 --- 全量扫描可能要几十分钟
- 不能替代人工测试 --- Nikto 只做已知漏洞匹配,逻辑漏洞发现不了
- 误报率较高 --- 扫描结果需人工验证
🔧 实战示例
# 完整扫描 + 报告
nikto -h https://example.com -ssl -o full_scan.html -Format html -Tuning 1,2,3,4,5
# 快速探查
nikto -h http://example.com -p 80 -Tuning 9
# 带认证扫描
nikto -h http://example.com -id admin:password123
# 绕过简单防护(编码混淆)
nikto -h http://example.com -evasion 1,2
📊典型输出示例
- Nikto v2.1.6
-
Target IP: 192.168.1.10
-
Target Hostname: www.example.com
-
Target Port: 443
-
Start Time: 2026-04-08 18:00
-
Server: Apache/2.4.41 (Ubuntu)
-
/robots.txt - Retrieval of robots.txt rules (permitted)
-
/admin/ - Admin page found (403 Forbidden)
-
/backup.zip - Potentially dangerous file found
-
/config.php~ - Backup file found (critical!)
-
Apache mod_ssl/2.4.41 - OpenSSL vulnerability (CVE-XXXX-XXXX)
总结:Nikto 是 Web 安全测试的入门级扫描器,适合快速发现已知漏洞和配置问题,但不能替代专业的渗透测试工具(如 Burp Suite、OWASP ZAP)。用于授权的安全检测和CTF都很不错 👍