4.0 KiB
4.0 KiB
Nuclei 实战指南(2026 版)
来源:ProjectDiscovery 官方文档 + nuclei-templates(2026) 适用场景:漏洞扫描、自定义检测模板编写、Bug Bounty 自动化
概述
Nuclei 是基于模板的快速漏洞扫描器。截至 2026 年:
- 9000+ 社区模板
- 100,000+ 安全工程师贡献
- 支持 HTTP/DNS/TCP/SSL/文件/代码等多种协议
- 已集成到 Kali 官方仓库(
apt install nuclei)
快速使用
# 安装(Kali)
apt install nuclei
# 或最新版
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
# 更新模板
nuclei -update-templates
# 基础扫描
nuclei -u https://target.com
# 指定严重级别
nuclei -u https://target.com -severity critical,high
# 指定模板类别
nuclei -u https://target.com -tags cve,sqli,xss,ssrf
# 批量目标
nuclei -l urls.txt -severity critical,high -o results.txt
# 配合 httpx 使用(推荐)
cat subdomains.txt | httpx -silent | nuclei -severity critical,high
自定义模板编写
基础结构
id: custom-check-id
info:
name: Custom Vulnerability Check
author: your-name
severity: high
description: Description of what this checks
tags: custom,webapp
http:
- method: GET
path:
- "{{BaseURL}}/vulnerable-endpoint"
matchers:
- type: word
words:
- "sensitive_data"
condition: and
- type: status
status:
- 200
最佳实践
- ID 命名:使用
vendor-product-vulnerability格式 - 严重级别:严格按 CVSS 评分对应(critical/high/medium/low/info)
- Matcher 精确:避免误报,组合多个 matcher
- 提取器:用 extractor 提取关键证据
- 条件组合:用
condition: and减少误报
高级模板示例(SSTI 检测)
id: ssti-detection
info:
name: Server-Side Template Injection
author: security-team
severity: high
tags: ssti,injection
http:
- method: GET
path:
- "{{BaseURL}}/?q={{url_encode('{{7*7}}')}}"
- "{{BaseURL}}/?search={{url_encode('${7*7}')}}"
matchers:
- type: word
words:
- "49"
part: body
extractors:
- type: regex
regex:
- "49"
part: body
与 AI 结合使用
AI 生成 Nuclei 模板
当发现新漏洞模式时,可以让 AI 自动生成 Nuclei 模板:
用户:我发现 /api/v1/users 端点存在 IDOR,通过修改 user_id 参数可以访问其他用户数据
AI:[生成对应的 Nuclei 模板]
Pentest Swarm AI 集成
Pentest Swarm AI 原生集成 Nuclei,在 swarm 模式下:
- Recon agent 发现子域名和端点
- Classifier agent 用 Nuclei 模板扫描
- 高 pheromone 的发现触发 Exploit agent
推荐模板仓库
| 仓库 | 内容 | 链接 |
|---|---|---|
| projectdiscovery/nuclei-templates | 官方 9000+ 模板 | GitHub |
| 0xKayala/Custom-Nuclei-Templates | 社区精选 | GitHub |
| emadshanab/Nuclei-Templates-Collection | 大型集合 | GitHub |
常用命令速查
# 扫描单个目标
nuclei -u https://target.com -severity critical,high
# 使用自定义模板
nuclei -u https://target.com -t ~/custom-templates/
# 输出 JSON(便于后续处理)
nuclei -u https://target.com -json -o results.json
# 限速(避免被 WAF 拦截)
nuclei -u https://target.com -rate-limit 10 -bulk-size 5
# 使用代理
nuclei -u https://target.com -proxy http://127.0.0.1:8080
# 排除特定模板
nuclei -u https://target.com -exclude-tags dos,fuzz
# 新模板检测(只跑最近添加的)
nuclei -u https://target.com -new-templates
# 配合 subfinder + httpx 全流程
subfinder -d target.com -silent | httpx -silent | nuclei -severity critical,high -o report.txt