mcpField
F
ffuf-web-fuzzing

ffuf-web-fuzzing

github.com/jthack安全214404 次安装54 周前更新
代码仓库

关于 ffuf-web-fuzzing

此技能介绍如何在渗透测试和网站探测中使用 Go 编写的 ffuf 模糊测试工具。内容涵盖路径、参数、标头及认证请求测试,并说明如何筛选响应和控制请求速率。

主要功能

  1. 01发现目录、文件和子域名
  2. 02模糊测试参数、标头和请求正文
  3. 03使用原始 HTTP 文件测试认证请求
  4. 04匹配并筛选响应
  5. 05控制请求速率与并发
  6. 06将结果保存为 JSON、HTML 或 CSV

适用场景

  1. 01查找隐藏的网站路径和文件
  2. 02枚举子域名与 API 端点
  3. 03测试参数和输入中的漏洞
  4. 04使用捕获的请求模糊测试认证路由

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/jthack/ffuf_claude_skill --skill ffuf-web-fuzzing

安装后在 Claude Code 中输入/ffuf-web-fuzzing确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

ffuf_helper.py
resources/
REQUEST_TEMPLATES.md
WORDLISTS.md

详细介绍

FFUF(Fuzz Faster U Fool)技能

概述

FFUF 是一款使用 Go 编写的快速 Web 模糊测试工具,旨在发现隐藏内容、目录、文件、子域名,并在渗透测试期间检测漏洞。它的速度明显快于 dirb 或 dirbuster 等传统工具。

安装

# Using Go
go install github.com/ffuf/ffuf/v2@latest

# Using Homebrew (macOS)
brew install ffuf

# Binary download
# Download from: https://github.com/ffuf/ffuf/releases/latest

核心概念

FUZZ 关键字

FUZZ 关键字用作占位符,会被字典中的条目替换。你可以将它放在任意位置:

  • URL:https://target.com/FUZZ
  • 请求头:-H "Host: FUZZ"
  • POST 数据:-d "username=admin&password=FUZZ"
  • 在多个位置使用自定义关键字:-w wordlist.txt:CUSTOM,然后使用 CUSTOM 代替 FUZZ
多字典模式
  • clusterbomb:测试所有组合(默认)——笛卡尔积
  • pitchfork:并行遍历多个字典(一对一匹配)
  • sniper:每次测试一个位置(适用于多个 FUZZ 位置)

常见用例

1. 目录和文件发现
# Basic directory fuzzing
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ

# With file extensions
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -e .php,.html,.txt,.pdf

# Colored and verbose output
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -c -v

# With recursion (finds nested directories)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -recursion -recursion-depth 2
2. 子域名枚举
# Virtual host discovery
ffuf -w /path/to/subdomains.txt -u https://target.com -H "Host: FUZZ.target.com" -fs 4242

# Note: -fs 4242 filters out responses of size 4242 (adjust based on default response size)
3. 参数模糊测试
# GET parameter names
ffuf -w /path/to/params.txt -u https://target.com/script.php?FUZZ=test_value -fs 4242

# GET parameter values
ffuf -w /path/to/values.txt -u https://target.com/script.php?id=FUZZ -fc 401

# Multiple parameters
ffuf -w params.txt:PARAM -w values.txt:VAL -u https://target.com/?PARAM=VAL -mode clusterbomb
4. POST 数据模糊测试
# Basic POST fuzzing
ffuf -w /path/to/passwords.txt -X POST -d "username=admin&password=FUZZ" -u https://target.com/login.php -fc 401

# JSON POST data
ffuf -w entries.txt -u https://target.com/api -X POST -H "Content-Type: application/json" -d '{"name": "FUZZ", "key": "value"}' -fr "error"

# Fuzzing multiple POST fields
ffuf -w users.txt:USER -w passes.txt:PASS -X POST -d "username=USER&password=PASS" -u https://target.com/login -mode pitchfork
5. 请求头模糊测试
# Custom headers
ffuf -w /path/to/wordlist.txt -u https://target.com -H "X-Custom-Header: FUZZ"

# Multiple headers
ffuf -w /path/to/wordlist.txt -u https://target.com -H "User-Agent: FUZZ" -H "X-Forwarded-For: 127.0.0.1"

过滤与匹配

匹配器(包含结果)
  • -mc:匹配状态码(默认:200-299、301、302、307、401、403、405、500)
  • -ml:匹配行数
  • -mr:匹配正则表达式
  • -ms:匹配响应大小
  • -mt:匹配响应时间(例如,>100 或 <100 毫秒)
  • -mw:匹配字数
过滤器(排除结果)
  • -fc:过滤状态码(例如,-fc 404,403,401)
  • -fl:过滤行数
  • -fr:过滤正则表达式(例如,-fr "error")
  • -fs:过滤响应大小(例如,-fs 42,4242)
  • -ft:过滤响应时间
  • -fw:过滤字数
自动校准(默认启用!)

**重要:**除非有特定理由,否则始终使用 -ac。在让 Claude 分析结果时,这一点尤其重要,因为它能大幅减少噪声和误报。

# Auto-calibration - ALWAYS USE THIS
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -ac

# Per-host auto-calibration (useful for multiple hosts)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -ach

# Custom auto-calibration string (for specific patterns)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -acc "404NotFound"

-ac 至关重要的原因:

  • 自动检测并过滤重复的误报响应
  • 去除带有随机内容的动态网站产生的噪声
  • 让人类和 Claude 都能更轻松地分析结果
  • 防止成千上万个相同的 404/403 响应挤满输出
  • 根据目标的特定行为进行适配

Claude 分析 ffuf 结果时,必须使用 -ac——否则,Claude 会浪费时间筛查成千上万个误报,而不是查找值得关注的异常。

速率限制与时间设置

速率控制
# Limit to 2 requests per second (stealth mode)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -rate 2

# Add delay between requests (0.1 to 2 seconds random)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -p 0.1-2.0

# Set number of concurrent threads (default: 40)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -t 10
时间限制
# Maximum total execution time (60 seconds)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -maxtime 60

# Maximum time per job (useful with recursion)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -maxtime-job 60 -recursion

输出选项

输出格式
# JSON output
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -o results.json

# HTML output
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -of html -o results.html

# CSV output
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -of csv -o results.csv

# All formats
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -of all -o results

# Silent mode (no progress, only results)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -s

# Pipe to file with tee
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -s | tee results.txt

高级技巧

使用原始 HTTP 请求(对已认证的模糊测试至关重要)

这是 ffuf 最强大的功能之一,尤其适用于带有复杂请求头、Cookie 或令牌的已认证请求。

工作流:

  1. 捕获完整的已认证请求(来自 Burp Suite、浏览器 DevTools 等)
  2. 将其保存到文件(例如,req.txt)
  3. 将要进行模糊测试的值替换为 FUZZ 关键字
  4. 使用 --request 标志
# From a file containing raw HTTP request
ffuf --request req.txt -w /path/to/wordlist.txt -ac

req.txt 文件示例:

POST /api/v1/users/FUZZ HTTP/1.1
Host: target.com
User-Agent: Mozilla/5.0
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Cookie: session=abc123xyz; csrftoken=def456
Content-Type: application/json
Content-Length: 27

{"action":"view","id":"1"}

用例:

  • 对带有复杂身份验证请求头的已认证端点进行模糊测试
  • 测试带有 JWT 令牌的 API 端点
  • 使用 CSRF 令牌、会话 Cookie 和自定义请求头进行模糊测试
  • 测试需要特定 User-Agent 或 Accept 请求头的端点
  • 执行带身份验证的 POST/PUT/DELETE 请求

实用技巧:

  • 可以在多个位置放置 FUZZ:URL 路径、请求头、请求正文
  • 如果需要,可使用 -request-proto https(默认值为 https)
  • 始终使用 -ac 过滤已认证请求的“未找到”或错误响应
  • 非常适合 IDOR 测试:在已认证环境中对用户 ID、文档 ID 等进行模糊测试
# Common authenticated fuzzing patterns
ffuf --request req.txt -w user_ids.txt -ac -mc 200 -o results.json

# With multiple FUZZ positions using custom keywords
ffuf --request req.txt -w endpoints.txt:ENDPOINT -w ids.txt:ID -mode pitchfork -ac
代理使用
# HTTP proxy (useful for Burp Suite)
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -x http://127.0.0.1:8080

# SOCKS5 proxy
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -x socks5://127.0.0.1:1080

# Replay matched requests through proxy
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -replay-proxy http://127.0.0.1:8080
Cookie 和身份验证
# Using cookies
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -b "sessionid=abc123; token=xyz789"

# Client certificate authentication
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -cc client.crt -ck client.key
编码
# URL encoding
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -enc 'FUZZ:urlencode'

# Multiple encodings
ffuf -w /path/to/wordlist.txt -u https://target.com/FUZZ -enc 'FUZZ:urlencode b64encode'
漏洞测试
# SQL injection testing
ffuf -w sqli_payloads.txt -u https://target.com/page.php?id=FUZZ -fs 1234

# XSS testing
ffuf -w xss_payloads.txt -u https://target.com/search?q=FUZZ -mr "<script>"

# Command injection
ffuf -w cmdi_payloads.txt -u https://target.com/execute?cmd=FUZZ -fr "error"
批量处理多个目标
# Process multiple URLs
cat targets.txt | xargs -I@ sh -c 'ffuf -w wordlist.txt -u @/FUZZ -ac'

# Loop through multiple targets with results
for url in $(cat targets.txt); do 
    ffuf -w wordlist.txt -u $url/FUZZ -ac -o "results_$(echo $url | md5sum | cut -d' ' -f1).json"
done

最佳实践

1. 始终使用自动校准

默认在每次扫描中使用 -ac。这是高效渗透测试不可或缺的一步:

ffuf -w wordlist.txt -u https://target.com/FUZZ -ac
2. 使用原始请求进行身份验证

处理复杂身份验证时,不必费心设置命令行标志。捕获完整请求并使用 --request:

# 1. Capture authenticated request from Burp/DevTools
# 2. Save to req.txt with FUZZ keyword in place
# 3. Run with -ac
ffuf --request req.txt -w wordlist.txt -ac -o results.json
3. 使用合适的字典
  • 目录发现:SecLists Discovery/Web-Content(raft-large-directories.txt、directory-list-2.3-medium.txt)
  • 子域名:SecLists Discovery/DNS(subdomains-top1million-5000.txt)
  • 参数:SecLists Discovery/Web-Content(burp-parameter-names.txt)
  • 用户名:SecLists Usernames
  • 密码:SecLists Passwords
  • 来源:https://github.com/danielmiessler/SecLists
3. 通过速率限制保持隐蔽

使用 -rate 避免触发 WAF/IDS 或使服务器不堪重负:

ffuf -w wordlist.txt -u https://target.com/FUZZ -rate 2 -t 10
4. 策略性地筛选
  • 先检查默认响应,识别常见的响应大小、状态码或模式
  • 使用 -fs 按大小筛选,或使用 -fc 按状态码筛选
  • 组合筛选条件:-fc 403,404 -fs 1234
5. 妥善保存结果

始终将结果保存到文件中,以供后续分析:

ffuf -w wordlist.txt -u https://target.com/FUZZ -o results.json -of json
6. 使用交互模式

执行期间按 ENTER 进入交互模式,在此模式下你可以:

  • 即时调整筛选条件
  • 保存当前结果
  • 重新开始扫描
  • 管理队列
7. 递归深度

请谨慎设置递归深度,以免陷入无限循环或使服务器不堪重负:

ffuf -w wordlist.txt -u https://target.com/FUZZ -recursion -recursion-depth 2 -maxtime-job 120

常见模式和单行命令

快速目录扫描
ffuf -w ~/wordlists/common.txt -u https://target.com/FUZZ -mc 200,301,302,403 -ac -c -v
使用扩展名进行全面扫描
ffuf -w ~/wordlists/raft-large-directories.txt -u https://target.com/FUZZ -e .php,.html,.txt,.bak,.old -ac -c -v -o results.json
已验证身份的模糊测试(原始请求)
# 1. Save your authenticated request to req.txt with FUZZ keyword
# 2. Run:
ffuf --request req.txt -w ~/wordlists/api-endpoints.txt -ac -o results.json -of json
API 端点发现
ffuf -w ~/wordlists/api-endpoints.txt -u https://api.target.com/v1/FUZZ -H "Authorization: Bearer TOKEN" -mc 200,201 -ac -c
使用自动校准进行子域名发现
ffuf -w ~/wordlists/subdomains-top5000.txt -u https://FUZZ.target.com -ac -c -v
POST 登录暴力破解
ffuf -w ~/wordlists/passwords.txt -X POST -d "username=admin&password=FUZZ" -u https://target.com/login -fc 401 -rate 5 -ac
使用身份验证测试 IDOR
# Use req.txt with authenticated headers and FUZZ in the ID parameter
ffuf --request req.txt -w numbers.txt -ac -mc 200 -fw 100-200

配置文件

创建 ~/.config/ffuf/ffufrc 以设置默认选项:

[http]
headers = ["User-Agent: Mozilla/5.0"]
timeout = 10

[general]
colors = true
threads = 40

[matcher]
status = "200-299,301,302,307,401,403,405,500"

故障排除

误报过多
  • 使用 -ac 进行自动校准
  • 检查默认响应,并使用 -fs 按大小筛选
  • 使用 -fr 进行正则表达式筛选
速度太慢
  • 增加线程数:-t 100
  • 缩小字典
  • 如果不需要响应内容,请使用 -ignore-body
被拦截
  • 降低速率:-rate 2
  • 添加延迟:-p 0.5-1.5
  • 减少线程数:-t 10
  • 随机化 User-Agent
  • 使用代理轮换
缺少结果
  • 检查筛选条件是否过于严格
  • 使用 -mc all 查看所有响应
  • 暂时禁用自动校准
  • 使用详细模式 -v 查看运行情况

资源

速查卡

任务命令模板
目录发现ffuf -w wordlist.txt -u https://target.com/FUZZ -ac
子域名发现ffuf -w subdomains.txt -u https://FUZZ.target.com -ac
参数模糊测试ffuf -w params.txt -u https://target.com/page?FUZZ=value -ac
POST 数据模糊测试ffuf -w wordlist.txt -X POST -d "param=FUZZ" -u https://target.com/endpoint
使用扩展名添加 -e .php,.html,.txt
按状态筛选添加 -fc 404,403
按大小筛选添加 -fs 1234
速率限制添加 -rate 2
保存输出添加 -o results.json
详细模式添加 -c -v
递归添加 -recursion -recursion-depth 2
使用代理添加 -x http://127.0.0.1:8080

更多资源

此技能在 resources/ 目录中包含补充材料:

资源文件
  • WORDLISTS.md:SecLists 字典的全面指南,涵盖不同场景的推荐列表、文件扩展名和快速参考模式
  • REQUEST_TEMPLATES.md:适用于常见身份验证场景(JWT、OAuth、会话 Cookie、API 密钥等)的预构建 req.txt 模板及使用示例
辅助脚本
  • ffuf_helper.py:用于辅助完成以下任务的 Python 脚本:
    • 分析 ffuf JSON 结果,查找异常和有趣的发现
    • 根据命令行参数创建 req.txt 模板文件
    • 生成用于 IDOR 测试的数字字典

辅助脚本用法:

# Analyze results to find interesting anomalies
python3 ffuf_helper.py analyze results.json

# Create authenticated request template
python3 ffuf_helper.py create-req -o req.txt -m POST -u "https://api.target.com/users" \
    -H "Authorization: Bearer TOKEN" -d '{"action":"FUZZ"}'

# Generate IDOR testing wordlist
python3 ffuf_helper.py wordlist -o ids.txt -t numbers -s 1 -e 10000

何时使用资源:

  • 用户需要字典推荐 → 参考 WORDLISTS.md
  • 用户需要有关已验证请求的帮助 → 参考 REQUEST_TEMPLATES.md
  • 用户想要分析结果 → 使用 ffuf_helper.py analyze
  • 用户需要生成 req.txt → 使用 ffuf_helper.py create-req
  • 用户需要用于 IDOR 的数字范围 → 使用 ffuf_helper.py wordlist

给 Claude 的说明

帮助用户使用 ffuf 时:

  1. 始终在每条命令中加入 -ac —— 这是有效渗透测试和结果分析的必要条件
  2. 用户提到已验证的模糊测试,或提供身份验证令牌/Cookie 时:
    • 建议创建包含完整 HTTP 请求的 req.txt 文件
    • 说明如何在需要进行模糊测试的位置插入 FUZZ
    • 使用 ffuf --request req.txt -w wordlist.txt -ac
  3. 始终建议从使用 -ac 进行自动校准开始
  4. 根据任务推荐合适的 SecLists 字典
  5. 提醒用户对生产环境目标使用速率限制(-rate)
  6. 建议将输出保存到文件以便记录:-o results.json
  7. 根据初步侦察结果建议筛选策略
  8. 始终使用关键字 FUZZ(区分大小写)
  9. 考虑隐蔽性:针对敏感目标降低线程数、限制速率并增加延迟
  10. 对于渗透测试报告,使用 -of html 或 -of csv 生成便于客户端查看的格式
  11. 为用户分析 ffuf 结果时:
    • 假定他们使用了 -ac(否则结果会过于嘈杂)
    • 重点关注异常:不同的状态码、响应大小和时间
    • 查找有趣的端点:admin、api、backup、config、.git 等
    • 标记潜在漏洞:错误消息、堆栈跟踪、版本信息
    • 建议对有趣的发现进行后续模糊测试

评论

支持 Markdown