ffuf/ffuf

GitHub: ffuf/ffuf

ffuf 是一款用 Go 编写的高性能 Web 模糊测试工具,专注于目录发现、参数探测和虚拟主机枚举等安全测试场景。

Stars: 15686 | Forks: 1518

![ffuf mascot](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/302e6e314d132208.png) # ffuf - Fuzz Faster U Fool 一个用 Go 编写的快速 Web Fuzzer。 - [安装](https://github.com/ffuf/ffuf#installation) - [使用示例](https://github.com/ffuf/ffuf#example-usage) - [内容发现](https://github.com/ffuf/ffuf#typical-directory-discovery) - [Vhost 发现](https://github.com/ffuf/ffuf#virtual-host-discovery-without-dns-records) - [参数 Fuzzing](https://github.com/ffuf/ffuf#get-parameter-fuzzing) - [POST 数据 Fuzzing](https://github.com/ffuf/ffuf#post-data-fuzzing) - [使用外部 Mutator](https://github.com/ffuf/ffuf#using-external-mutator-to-produce-test-cases) - [配置文件](https://github.com/ffuf/ffuf#configuration-files) - [帮助](https://github.com/ffuf/ffuf#usage) - [交互模式](https://github.com/ffuf/ffuf#interactive-mode) ## 安装 - 从 [releases 页面](https://github.com/ffuf/ffuf/releases/latest) [下载](https://github.com/ffuf/ffuf/releases/latest) 预编译的二进制文件,解压并运行! _或者_ - 如果你在 macOS 上并安装了 [homebrew](https://brew.sh),可以使用以下命令安装 ffuf:`brew install ffuf` _或者_ - 如果你安装了最新版本的 Go 编译器:`go install github.com/ffuf/ffuf/v2@latest`(同样的命令也适用于更新) _或者_ - `git clone https://github.com/ffuf/ffuf ; cd ffuf ; go get ; go build` Ffuf 依赖于 Go 1.16 或更高版本。 ## 使用示例 下面的使用示例仅展示了使用 `ffuf` 可以完成的最简单的任务。 更详尽的文档,包含许多功能和示例,可以在 ffuf wiki 中找到:[https://github.com/ffuf/ffuf/wiki](https://github.com/ffuf/ffuf/wiki) 如需包含真实使用示例和技巧的更广泛文档,请务必查看这份精彩的指南: Michael Skelton ([@codingo](https://github.com/codingo)) 编写的“[关于 FFUF 你需要知道的一切](https://codingo.io/tools/ffuf/bounty/2020/09/17/everything-you-need-to-know-about-ffuf.html)”。 你也可以针对包含不同课程和用例的实时主机练习你的 ffuf 扫描,既可以通过使用 Docker 容器 https://github.com/adamtlangley/ffufme 在本地进行,也可以针对由 Adam Langley [@adamtlangley](https://twitter.com/adamtlangley) 创建的在线托管版本 http://ffuf.me 进行。 ### 典型的目录发现 [![asciicast](https://asciinema.org/a/211350.png)](https://asciinema.org/a/211350) 通过在 URL (`-u`) 的末尾使用 `FUZZ` 关键字: ``` ffuf -w /path/to/wordlist -u https://target/FUZZ ``` ### 虚拟主机发现(无 DNS 记录) [![asciicast](https://asciinema.org/a/211360.png)](https://asciinema.org/a/211360) 假设默认虚拟主机响应大小为 4242 字节,我们可以在 Fuzzing Host 头时过滤掉所有该大小的响应 (`-fs 4242`): ``` ffuf -w /path/to/vhost/wordlist -u https://target -H "Host: FUZZ" -fs 4242 ``` ### GET 参数 Fuzzing GET 参数名 Fuzzing 与目录发现非常相似,通过在 URL 的一部分定义 `FUZZ` 关键字来实现。这也假设无效 GET 参数名的响应大小为 4242 字节。 ``` ffuf -w /path/to/paramnames.txt -u https://target/script.php?FUZZ=test_value -fs 4242 ``` 如果参数名已知,可以用同样的方式 Fuzz 值。此示例假设错误的参数值返回 HTTP 响应码 401。 ``` ffuf -w /path/to/values.txt -u https://target/script.php?valid_name=FUZZ -fc 401 ``` ### POST 数据 Fuzzing 这是一个非常直接的操作,同样通过使用 `FUZZ` 关键字。此示例仅 Fuzz POST 请求的一部分。我们再次过滤掉 401 响应。 ``` ffuf -w /path/to/postdata.txt -X POST -d "username=admin\&password=FUZZ" -u https://target/login.php -fc 401 ``` ### 最大执行时间 如果你不想让 ffuf 无限期运行,可以使用 `-maxtime`。这会在给定时间(以秒为单位)后停止__整个__进程。 ``` ffuf -w /path/to/wordlist -u https://target/FUZZ -maxtime 60 ``` 在使用递归时,你可以使用 `-maxtime-job` 控制__每个任务__的最大时间。这将在给定时间(以秒为单位)后停止当前任务并继续下一个。当递归功能检测到子目录时,会创建新任务。 ``` ffuf -w /path/to/wordlist -u https://target/FUZZ -maxtime-job 60 -recursion -recursion-depth 2 ``` 也可以同时使用这两个标志,限制每个任务的最大执行时间以及总体执行时间。如果你不使用递归,那么这两个标志的行为是相同的。 ### 使用外部 Mutator 生成测试用例 在这个示例中,我们将 Fuzz 通过 POST 发送的 JSON 数据。使用 [Radamsa](https://gitlab.com/akihe/radamsa) 作为 Mutator。 当使用 `--input-cmd` 时,ffuf 将根据其位置显示匹配项。这个相同的位置值将作为环境变量 `$FFUF_NUM` 提供给被调用者。我们将使用这个位置值作为 Mutator 的种子。文件 example1.txt 和 example2.txt 包含有效的 JSON Payload。我们匹配所有响应,但过滤掉响应码 `400 - Bad request`: ``` ffuf --input-cmd 'radamsa --seed $FFUF_NUM example1.txt example2.txt' -H "Content-Type: application/json" -X POST -u https://ffuf.io.fi/FUZZ -mc all -fc 400 ``` 当然,为每个 Payload 调用 Mutator 效率不高,所以我们也可以预先生成 Payload,仍然以 [Radamsa](https://gitlab.com/akihe/radamsa) 为例: ``` # 生成 1000 个示例 payload radamsa -n 1000 -o %n.txt example1.txt example2.txt # 这会生成文件 1.txt ... 1000.txt # 现在我们可以直接在循环中从文件读取 payload 数据供 ffuf 使用 ffuf --input-cmd 'cat $FFUF_NUM.txt' -H "Content-Type: application/json" -X POST -u https://ffuf.io.fi/ -mc all -fc 400 ``` ### 配置文件 运行 ffuf 时,它首先检查是否存在默认配置文件。`ffufrc` 文件的默认路径是 `$XDG_CONFIG_HOME/ffuf/ffufrc`。你可以在此文件中配置一个或多个选项,它们将应用于 随后的每一个 ffuf 任务。可以在 [这里](https://github.com/ffuf/ffuf/blob/master/ffufrc.example) 找到一个 ffufrc 文件的示例。 关于配置文件位置的更详细描述可以在 wiki 中找到: [https://github.com/ffuf/ffuf/wiki/Configuration](https://github.com/ffuf/ffuf/wiki/Configuration) 命令行提供的配置选项将覆盖从默认 `ffufrc` 文件加载的选项。 注意:这不适用于可以多次提供的 CLI 标志。其中一个例子是 `-H` (header) 标志。 在这种情况下,命令行提供的 `-H` 值将_追加_到配置文件中的值之后。 此外,如果你希望针对不同的用例使用一系列配置文件,可以通过定义 配置文件路径来实现,即使用 `-config` 命令行标志,该标志将配置文件的路径作为其 参数。

## 用法 要为 ffuf 定义测试用例,请在 URL (`-u`)、headers (`-H`) 或 POST data (`-d`) 中的任何位置使用关键字 `FUZZ`。 ``` Fuzz Faster U Fool - v2.1.0 HTTP OPTIONS: -H Header `"Name: Value"`, separated by colon. Multiple -H flags are accepted. -X HTTP method to use -b Cookie data `"NAME1=VALUE1; NAME2=VALUE2"` for copy as curl functionality. -cc Client cert for authentication. Client key needs to be defined as well for this to work -ck Client key for authentication. Client certificate needs to be defined as well for this to work -d POST data -http2 Use HTTP2 protocol (default: false) -ignore-body Do not fetch the response content. (default: false) -r Follow redirects (default: false) -raw Do not encode URI (default: false) -recursion Scan recursively. Only FUZZ keyword is supported, and URL (-u) has to end in it. (default: false) -recursion-depth Maximum recursion depth. (default: 0) -recursion-strategy Recursion strategy: "default" for a redirect based, and "greedy" to recurse on all matches (default: default) -replay-proxy Replay matched requests using this proxy. -sni Target TLS SNI, does not support FUZZ keyword -timeout HTTP request timeout in seconds. (default: 10) -u Target URL -x Proxy URL (SOCKS5 or HTTP). For example: http://127.0.0.1:8080 or socks5://127.0.0.1:8080 GENERAL OPTIONS: -V Show version information. (default: false) -ac Automatically calibrate filtering options (default: false) -acc Custom auto-calibration string. Can be used multiple times. Implies -ac -ach Per host autocalibration (default: false) -ack Autocalibration keyword (default: FUZZ) -acs Custom auto-calibration strategies. Can be used multiple times. Implies -ac -c Colorize output. (default: false) -config Load configuration from a file -json JSON output, printing newline-delimited JSON records (default: false) -maxtime Maximum running time in seconds for entire process. (default: 0) -maxtime-job Maximum running time in seconds per job. (default: 0) -noninteractive Disable the interactive console functionality (default: false) -p Seconds of `delay` between requests, or a range of random delay. For example "0.1" or "0.1-2.0" -rate Rate of requests per second (default: 0) -s Do not print additional information (silent mode) (default: false) -sa Stop on all error cases. Implies -sf and -se. (default: false) -scraperfile Custom scraper file path -scrapers Active scraper groups (default: all) -se Stop on spurious errors (default: false) -search Search for a FFUFHASH payload from ffuf history -sf Stop when > 95% of responses return 403 Forbidden (default: false) -t Number of concurrent threads. (default: 40) -v Verbose output, printing full URL and redirect location (if any) with the results. (default: false) MATCHER OPTIONS: -mc Match HTTP status codes, or "all" for everything. (default: 200-299,301,302,307,401,403,405,500) -ml Match amount of lines in response -mmode Matcher set operator. Either of: and, or (default: or) -mr Match regexp -ms Match HTTP response size -mt Match how many milliseconds to the first response byte, either greater or less than. EG: >100 or <100 -mw Match amount of words in response FILTER OPTIONS: -fc Filter HTTP status codes from response. Comma separated list of codes and ranges -fl Filter by amount of lines in response. Comma separated list of line counts and ranges -fmode Filter set operator. Either of: and, or (default: or) -fr Filter regexp -fs Filter HTTP response size. Comma separated list of sizes and ranges -ft Filter by number of milliseconds to the first response byte, either greater or less than. EG: >100 or <100 -fw Filter by amount of words in response. Comma separated list of word counts and ranges INPUT OPTIONS: -D DirSearch wordlist compatibility mode. Used in conjunction with -e flag. (default: false) -e Comma separated list of extensions. Extends FUZZ keyword. -enc Encoders for keywords, eg. 'FUZZ:urlencode b64encode' -ic Ignore wordlist comments (default: false) -input-cmd Command producing the input. --input-num is required when using this input method. Overrides -w. -input-num Number of inputs to test. Used in conjunction with --input-cmd. (default: 100) -input-shell Shell to be used for running command -mode Multi-wordlist operation mode. Available modes: clusterbomb, pitchfork, sniper (default: clusterbomb) -request File containing the raw http request -request-proto Protocol to use along with raw request (default: https) -w Wordlist file path and (optional) keyword separated by colon. eg. '/path/to/wordlist:KEYWORD' OUTPUT OPTIONS: -debug-log Write all of the internal logging to the specified file. -o Write output to file -od Directory path to store matched results to. -of Output file format. Available formats: json, ejson, html, md, csv, ecsv (or, 'all' for all formats) (default: json) -or Don't create the output file if we don't have results (default: false) EXAMPLE USAGE: Fuzz file paths from wordlist.txt, match all responses but filter out those with content-size 42. Colored, verbose output. ffuf -w wordlist.txt -u https://example.org/FUZZ -mc all -fs 42 -c -v Fuzz Host-header, match HTTP 200 responses. ffuf -w hosts.txt -u https://example.org/ -H "Host: FUZZ" -mc 200 Fuzz POST JSON data. Match all responses not containing text "error". ffuf -w entries.txt -u https://example.org/ -X POST -H "Content-Type: application/json" \ -d '{"name": "FUZZ", "anotherkey": "anothervalue"}' -fr "error" Fuzz multiple locations. Match only responses reflecting the value of "VAL" keyword. Colored. ffuf -w params.txt:PARAM -w values.txt:VAL -u https://example.org/?PARAM=VAL -mr "VAL" -c More information and examples: https://github.com/ffuf/ffuf ``` ### 交互模式 在 ffuf 执行期间按 `ENTER`,进程将暂停并进入一个类似 Shell 的交互模式: ``` entering interactive mode type "help" for a list of commands, or ENTER to resume. > help available commands: afc [value] - append to status code filter fc [value] - (re)configure status code filter afl [value] - append to line count filter fl [value] - (re)configure line count filter afw [value] - append to word count filter fw [value] - (re)configure word count filter afs [value] - append to size filter fs [value] - (re)configure size filter aft [value] - append to time filter ft [value] - (re)configure time filter rate [value] - adjust rate of requests per second (active: 0) queueshow - show job queue queuedel [number] - delete a job in the queue queueskip - advance to the next queued job restart - restart and resume the current ffuf job resume - resume current ffuf job (or: ENTER) show - show results for the current job savejson [filename] - save current matches to a file help - you are looking at it > ``` 在此模式下,可以重新配置过滤器、管理队列以及将当前状态保存到磁盘。 当(重新)配置过滤器时,它们会被追溯应用,并且内存中所有本应被新添加的过滤器过滤掉的 误报匹配项都会被删除。 匹配项的新状态可以通过 `show` 命令打印出来,该命令将打印出所有匹配项,就像它们 是被 `ffuf` 发现的一样。 由于“负面”匹配项不会存储在内存中,遗憾的是放宽过滤器无法找回丢失的匹配项。 对于这种情况,用户可以使用 `restart` 命令,该命令会重置状态并从头开始当前 任务。

## 许可证 ffuf 在 MIT 许可证下发布。参见 [LICENSE](https://github.com/ffuf/ffuf/blob/master/LICENSE)。
标签:CISA项目, EVTX分析, EVTX分析, EVTX分析, Fuzzer, Go语言, HTTP请求, Linux取证, Linux安全, Vhost发现, Web安全, 二进制发布, 参数Fuzzing, 大数据, 密码管理, 开源工具, 日志审计, 爆破工具, 目录扫描, 程序破解, 网络安全, 蓝队分析, 路径发现, 隐私保护