目录
- 为什么是Ffuf
 - 基本使用
 - 最基本的使用
 - 多个字典同时使用
 - 带cookie扫描(-b)
 - 静默模式(-s)
 - 递归扫描(-recursion)
 - 指定扩展名(-e)
 - POST请求爆破
 - 方式1:指明请求地址和请求体【不推荐】
 - 排雷方式1:添加请求头(-H)
 - 方式2:从文本中加载【推荐】
 
- 随机User-Agent
 - 为什么要随机User-Agent
 - 直接添加User-Agent
 - 随机化User-Agent【不好用】
 
- 子域名爆破
 - 保存结果
 
- 匹配响应内容
 - 匹配 http 状态码(-mc)
 - 匹配响应包的行数(-ml)
 - 匹配字数(-mw)
 - 匹配大小(-ms)
 - 匹配正则(-mr)
 
- 过滤响应内容
 - 过滤状态码(-fc)
 - 过滤响应包的行数(-fl)
 - 过滤字数(-fw)
 - 过滤大小(-fs)
 - 过滤正则(-fr)
 
- 其他参数
 - 颜色输出(-c)
 - 设置线程(-t)
 - 请求延时(-p)
 - 跟随重定向(-r)
 - 超时时间(-timeout)
 - 测试详情(-v)
 - 代理(-x)
 - 任务最大时间(-maxtime )
 - 忽略字典的注释信息(-ic)
 
- 参考
 
ffuf是一款Go语言编写的高速Web Fuzzer工具。
这里整理学习了网上的相关文章,你可以在“参考”中看到原始的出处。
为什么是Ffuf
- 基于Go语言开发,速度极快,并且跨平台
 - 可以颜色高亮输出
 - 强大的过滤系统和代理系统
 - 能适应多种情景下的模糊测试
 - 广受好评,持续更新
 
能同时满足以上5点的,目前只有,应该只有Ffuf了,项目地址:https://github.com/ffuf/ffuf
这款工具有两点我不大满意:
- 不能够完整打印出爆破出来的URI路径。
 - user-agent特征明显,不能随机user-agent。
 
基本使用
最基本的使用
格式:ffuf -u 目标地址/FUZZ -w 字典
举例:ffuf -u http://192.168.111.131/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt
 

多个字典同时使用
靶机案例参见:https://www.yuque.com/u1881995/xwfvho/duyuuv#sIEeo
使用格式:
ffuf -u 目标地址/FUZZ1:FUZZ2 -w 字典:FUZZ1 -w 字典:FUZZ2
举例:
ffuf -u http://192.168.111.132/sqli/example1.php?FUZZ1=FUZZ2 -w /usr/share/SecLists-2022.2/Discovery/Web-Content/burp-parameter-names.txt:FUZZ1 -w /usr/share/SecLists-2022.2/Fuzzing/fuzz-Bo0oM.txt:FUZZ2
 

带cookie扫描(-b)
ffuf -u http://192.168.111.130/DVWA-master/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -b "security=low; PHPSESSID=pj0emeebmimf3t9ddpv6pknah0"
 
首先获取到cookie
 

静默模式(-s)
-s其实就是不打印附加信息,只输出结果
ffuf -u http://192.168.111.130/DVWA-master/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -s
 
递归扫描(-recursion)
一个普通的扫描如下图:
 
尝试递归扫描:
 值得注意的是字典内开头不要有 / 不然不会进行递归的,如下图(我手动给字典每行的开头位置添加了/)
.\ffuf.exe -u http://192.168.111.130/FUZZ -w D:\字典\SecLists-2022.2\Discovery\Web-Content\common.txt -recursion 2
 

正确的递归方式是确保字典开头没有/,这个时候使用 -maxtime就不行了,一起使用-maxtime-job与-recursion递归扫描,用于指定每个目录递归扫描时间,避免扫描时间过长。
.\ffuf.exe -u http://192.168.111.130/FUZZ -w D:\字典\SecLists-2022.2\Discovery\Web-Content\common.txt -recursion 2 -maxtime-job 10
 

指定扩展名(-e)
存在多个扩展的话,用逗号隔开
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -e .php,.zip
 

POST请求爆破
方式1:指明请求地址和请求体【不推荐】
获取请求地址和请求体,并开始爆破,这里有点奇怪,从BurpSuite中得知成功的响应包和长度是与失败的响应包长度不同的,但是Ffuf显示的长度一致。
ffuf -X POST -u http://192.168.111.130/pikachu-master/vul/burteforce/bf_form.php -d "username=admin&password=FUZZ&submit=Login" -w /usr/share/SecLists-2022.2/Passwords/2020-200_most_used_passwords.txt
 



排雷方式1:添加请求头(-H)
由于方式2可以爆破出来,因此怀疑可能是请求头导致的爆破失败。
 首先使用方式1中的原始命令,捕获数据包如下:
 
接着使用BurpSuite尽可能的删除请求头,发现Content-Type: application/x-www-form-urlencoded会影响到爆破测试结果
 
那么就添加此参数,数据包说明参数添加正常,测试结果说明爆破成功
ffuf -X POST -u http://192.168.111.130/pikachu-master/vul/burteforce/bf_form.php -d "username=admin&password=FUZZ&submit=Login" -H "Content-Type: application/x-www-form-urlencoded" -w /usr/share/SecLists-2022.2/Passwords/2020-200_most_used_passwords.txt
 

方式2:从文本中加载【推荐】
用别名代替测试的内容,保存为文本。
ffuf -request test.txt -request-proto http -mode clusterbomb -w /usr/share/SecLists-2022.2/Passwords/2020-200_most_used_passwords.txt
 
-mode爆破模块,目前有clusterbomb、pitchfork两个模式具体,类似burpsuite的爆破模块- 在
clusterbomb模式下,用户名单词列表中的每个单词都将与密码单词列表中的每个单词组合使用。就像如果列表 1 中有 4 个单词而列表 2 中有 5 个单词,那么总共会有 20 个请求。(集束炸弹模式) - 在
pitchfork模式下,用户名列表中第一个单词将与密码列表中第一个单词一起使用,同样,用户名列表中第二个单词将与密码列表中第二个单词一起使用。如果两个列表中的单词数量不同,那么一旦单词数量较少的列表耗尽就会停止。 
- 在
 -request标志可用于指定与原始HTTP请求文件,并且将相应使用FUZZ-request-proto与原始请求一起使用的协议(默认值:https)


随机User-Agent
为什么要随机User-Agent
Ffuf不会随机User-Agent,这导致它很容易被安全设备识别出来,更糟糕的是它不支持随机User-Agent,那我们只能自己动手丰衣足食了。
 
Ffuf有-H参数允许我们添加请求头,我们可以那它做文章。
 我在网上找到了一些User-Agent
- https://epi052.github.io/feroxbuster-docs/docs/examples/random-agent/
 - https://github.com/deibit/cansina/blob/master/core/ua.txt
 
直接添加User-Agent
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -H "User-Agent: Mozilla/5.0 Windows NT 10.0 Win64 AppleWebKit/537.36 Chrome/69.0.3497.100"
 

随机化User-Agent【不好用】
在谷歌上搜索出一个生成随机UA的工具:randomua
 一些常见的Web黑客工具允许添加自定义请求头,randomua正式利用了这一点来生成随机UA
- 下载安装
 
git clone https://github.com/picatz/randomua.git
cd randomua
gem install randomua
randomua -h
 

- 使用工具,但是不知道为什么,失败了。测试了别的工具,也不大好用,gg
 
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c "User-Agent: $(randomua -d)"
 
子域名爆破
kali自带的一些子域名字典:locate dns | grep "/usr/share" | grep ".txt"
 
ffuf -w /usr/share/SecLists-2022.2/Discovery/DNS/bitquark-subdomains-top100000.txt -u http://shoppy.htb -H "Host:FUZZ.shoppy.htb" -fs 169
 

保存结果
测试发现,需要同时用到-of(指明导出文件类型)、-o(指明导出的文件位置和文件名字)
 如果只是使用了其中的一个参数,会导致导出的结果有问题,不能正常查看。
 
下面分别是html效果和csv导出的效果
 

匹配响应内容
匹配 http 状态码(-mc)
-mc all意味着匹配所有的状态码(Ffuf本身会过滤一些如404的状态码)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -mc 200,301
 

匹配响应包的行数(-ml)
从数据包中可以看到,phpMyAdmin目录的响应体只有7行,推测Ffuf把响应头和响应体之间的回车换行算成1行
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -ml 8
 


匹配字数(-mw)
不知道这个字数代表的是什么字数
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -mw 14
 
匹配大小(-ms)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -ms 236
 
匹配正则(-mr)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -mr "phpmyadmin"
 
过滤响应内容
过滤状态码(-fc)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -fc 403
 
过滤响应包的行数(-fl)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -fl 8
 
过滤字数(-fw)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -fw 14
 
过滤大小(-fs)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -fs 236
 
过滤正则(-fr)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -fr "phpmyadmin"
 
其他参数
颜色输出(-c)
目前windows下没有颜色高亮效果(目前指的是最新版本v1.5.0)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c
 

设置线程(-t)
线程默认40,我这里修改为50
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -t 50
 

请求延时(-p)
 ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -p 0.1
 

跟随重定向(-r)
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/SecLists-2022.2/Discovery/Web-Content/common.txt -c -r
 
超时时间(-timeout)
ffuf -request test.txt -request-proto http -mode clusterbomb -w /usr/share/SecLists-2022.2/Passwords/2020-200_most_used_passwords.txt -timeout 2
 
测试详情(-v)
ffuf -request test.txt -request-proto http -mode clusterbomb -w /usr/share/SecLists-2022.2/Passwords/2020-200_most_used_passwords.txt -v
 
代理(-x)
For example: http://127.0.0.1:8080 or socks5://127.0.0.1:8080
 .\ffuf.exe -u http://192.168.111.130/FUZZ -w D:\字典\SecLists-2022.2\Discovery\Web-Content\common.txt -x http://127.0.0.1:8080
 

任务最大时间(-maxtime )
-maxtime在有限的时间内完成测试,不论是否完成都将终止,单位为秒
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -c -maxtime 60
 

忽略字典的注释信息(-ic)
如下图,有的字典可能有一些注释信息,但是ffuf不知道这是注释的,就当成字典测试了。使用-ic参数即可解决此问题。
ffuf -u http://192.168.111.130/FUZZ -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -c -ic
 

参考
https://github.com/ffuf/ffuf
https://codingo.io/tools/ffuf/bounty/2020/09/17/everything-you-need-to-know-about-ffuf.html
ffuf 基础食用指南
Ffuf使用教程

















