chainreactors / spray

Next Generation HTTP Dir/File Fuzz Tool
https://chainreactors.github.io/wiki/spray/
GNU General Public License v3.0
458 stars 39 forks source link

HostSpray host头碰撞时存在一些问题 #63

Open NorthShad0w opened 2 weeks ago

NorthShad0w commented 2 weeks ago
./spray --mod=host --client=standard -u https://*.*.*.*:* -d 10k_subdomain

会产生类似

[-] parse "https://*.*.*.*:*\x00eiZw.Dk": net/url: invalid control character in URL , 2024-08-26 15:46.50
[-] parse "https://*.*.*.*:*\x00DJWl.OZ": net/url: invalid control character in URL , 2024-08-26 15:46.50

的错误信息

./spray --mod=host --client=standard -u https://*.*.*.*:* -d 10k_subdomain --force

则正常

简单看了下代码 和hostspray的check逻辑出问题有关

RandHost 随机数带入 source为 parsers.CheckSource https://github.com/chainreactors/spray/blob/bf6d1c5f0ba55518b47bd15caa305731110f4473/internal/pool/brutepool.go#L264

path参数 source参数入unit https://github.com/chainreactors/spray/blob/bf6d1c5f0ba55518b47bd15caa305731110f4473/internal/pool/types.go#L12

判断失误 进了PathSpray 逻辑 https://github.com/chainreactors/spray/blob/bf6d1c5f0ba55518b47bd15caa305731110f4473/internal/pool/brutepool.go#L302-L306

将判断删去即可解决问题 没读明白为什么要做这个check

M09Ic commented 2 weeks ago

已确认这个bug, 感谢你的反馈

check是用来爆破时校验基准值是否发现变化的, 如果基准值发生变化, 有可能时被waf重定向到WAF页面。

M09Ic commented 2 weeks ago

已发布新版本, 并带来了一些改动. https://github.com/chainreactors/spray/releases/tag/v1.1.1

用法会相对复杂一点, 因为对于要爆破的host无法完全自动解析.

host爆破

spray -u http://123.123.123.123 -w "{?0}.example.com" -d 1.txt

1.txt:

aaa
bbb
ccc
...

或者

1.txt

aaa.example.com
bbb.example.com
...
spray -u http://123.123.123.123  -d 1.txt
M09Ic commented 2 weeks ago

关于host的新特性是, 现在crawl,common,bak,active插件能作用于-m host了, 在爆破到有效目录时会调用对应的插件规则.

NorthShad0w commented 2 weeks ago

common 插件会导致问题

./spray --common --random-agent --mod=host -u https://*.*.*.*/ -d test.list

[index]     200 12  140ms   https://*.*.*.*/ [nginx]
[append]    404 555 43ms    https://*.*.*.*/readme.md [404 Not Found] [nginx]
[append]    404 153 91ms    https://*.*.*.*/README.md [404 Not Found] [nginx]
[word]      403 555 240ms   https://*.*.*.*/ (example.com) [403 Forbidden] [nginx]
[-] parse "https://*.*.*.*/%EXT%.log": invalid URL escape "%EX" , 2024-08-29 21:38.47

假如某站点的aaa.example.com 存在readme.md的文件 使用

./spray --common --random-agent --mod=host -u https://*.*.*.*/readme.md -d test.list

无法发现

使用

./spray --random-agent --mod=host -u https://47.238.87.1/readme.md -d test.list

可以 但是会多发一个https://47.238.87.1/readme.md/readme.md

如果接受外部贡献的话,我可以尝试修复,不知道有无代码要求和单元测试文件

M09Ic commented 2 weeks ago

非常欢迎外部的贡献。 暂时没有代码要求和单元测试要求。期待你的PR

M09Ic commented 2 weeks ago

这个错误看起来是在对dirsearch的适配没有生效到append中, 欢迎你成为spray的第一个外部贡献者 :)

M09Ic commented 5 days ago

已在https://github.com/chainreactors/spray/releases/tag/v1.1.2 中修复