安全WAF绕过WAF绕过—信息收集之反爬虫延时代理池技术
Yatming的博客WAF绕过—信息收集之反爬虫延时代理池技术

网站部署waf时,采用进程抓包工具抓取webpathbrute数据包分析,一般有2种结果:
- 1.直接误报或者无结果
- 2.扫描一段时间后突然误报
扫描探针机制
WebPathBrute-Web路径暴力探测工具:https://github.com/7kbstorm/7kbscan-WebPathBrute
使用WebPathBrute扫描网站目录,当网站服务器分别部署了以下waf时,对拦截机制进行测试分析,结果如下:
1.safedog-默认拦截机制-未开CC
- 扫描结果:出现误报,全部200状态码
- 原因:浏览器采用get方法,工具扫描采用head方法。
- 绕过方法:更改提交方式(改为get方法)或模拟用户
- 模拟用户就是先抓取一个正常用户访问的数据包,然后跑工具的时候进行替换就可以了
2.safedog-默认拦截机制-开启CC
- 扫描结果:误报
- 绕过方法:延时或代理池或爬虫引擎。
- 2.1 延时
- 2.2 代理池
- 网上搜索代理池,写python脚本,添加代理池。确定是WAF可能开启了防代理,无法绕过。
- 2.3 爬虫引擎
3.Aliyun_os-默认拦截机制
- 扫描结果:对部署在阿里云上的网站进行目录扫描时,扫着扫着网站就打不开了,大约1个小时后才能重新打开,重启服务器也不能使网站重新打开,只能等一个小时,猜测这是因为阿里云自己有一套防护体系。
- 绕过方法:无法模拟搜索引擎爬虫绕过,只能采用延时或代理池
4.BT(防火墙插件)-默认拦截机制
- 拦截机制举例:
- 60秒内,请求同一URL超过120次,封锁IP 100秒。
- 60秒内,恶意请求6次,封IP 600秒。
- 什么是恶意请求?比如宝塔检测到用户频繁请求index.php.bak等备份文件,即判断为恶意请求,拦截。对于这种拦截,绕过方法为字典重写(参考于upload-labs做字典)
- 绕过方法:爬虫未知,延时可以,代理池可以
5.阿里云(免费)+ safedog + 宝塔(付费插件)
6.python编写绕过脚本,进行目录扫描
- 自定义headers头部,模拟用户
- 休眠3秒,模拟延时(测试发现,阿里云至少休眠3秒,否则拦截)
- 添加proxy,从网上爬取代理池,按需添加,比如一个代理发10个请求,接着换另一个代理。
- 脚本如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| import requests import time headers={
} for path in open('php_b.txt',encoding='utf-8'): url='http://test.com' paths=path.replace('\n','') urls=url+paths proxy={ 'http':'127.0.0.1:7777' } try: code=requests.get(urls,headers=hearders,proxies=proxy).status_code //用get请求,将headers替换为之前的headers print(urls+'|'+str(code)) if code==200 or code==403: print(urls+'|'+str(code)) except Exception as err: print('connecting error') timr.sleep(3)
|
- 构造请求数据包的header(这里直接从抓包工具复制过来,然后两边都要加’’,我开始的net的1我以为不加,所以出错了(这里很容易出错))
- 比铸剑的优点,可以更改全部头部
开启了cc防护:所有的扫描结果都是对的,这明显不正常

更改请求方式
将HEAD方式改为GET方式
我这里还是有很多误报,然后我下调安全狗防护门槛,还是不行


既然是访问速度过快导致,那么这个工具就自带一个延时的模块,直接启动


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| baidu:Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html) Google:Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) Sogou:Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07) Yahoo:Mozilla/5.0 (compatible; Yahoo! Slurp/3.0; http://help.yahoo.com/help/us/ysearch/slurp) 百度网页搜索 User-agent Baiduspider 无线搜索 User-agent Baiduspider-mobile 图片搜索User-agent Baiduspider-image 视频搜索 User-agent Baiduspider-video 新闻搜索 User-agent Baiduspider-news 百度搜藏 User-agent Baiduspider-favo 百度联盟 User-agent Baiduspider-cpro 谷歌User-agent Googlebot MSN User-agent MSNBot 有道User-agent YoudaoBot 搜狗User-agent Sogou inst spider Sogou spider2 Sogou blog Sogou News Spider Sogou Orion spider 即刻User-agent JikeSpider 搜搜User-agent Sosospider 360User-agent 360Spider
百度爬虫,第二条为百度图片爬虫 Baiduspider+(+http://www.baidu.com/search/spider.htm") Baiduspider-image google爬虫,最后一条为google图片搜索爬虫 Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) Googlebot/2.1 (+http://www.googlebot.com/bot.html) Googlebot/2.1 (+http://www.google.com/bot.html) Googlebot-Image/1.0 即刻搜索爬虫 Mozilla/5.0 (compatible; JikeSpider; +http://shoulu.jike.com/spider.html) 雅虎爬虫(分别是雅虎中国和美国总部的爬虫) Mozilla/5.0 (compatible; Yahoo! Slurp China; http://misc.yahoo.com.cn/help.html") Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp") 新浪爱问爬虫 iaskspider/2.0(+http://iask.com/help/help_index.html") Mozilla/5.0 (compatible; iaskspider/1.0; MSIE 6.0) 搜狗爬虫,第三条为搜狗图片爬虫 Sogou web spider/3.0(+http://www.sogou.com/docs/help/webmasters.htm#07) Sogou Push Spider/3.0(+http://www.sogou.com/docs/help/webmasters.htm#07) Sogou Pic Spider/3.0(+http://www.sogou.com/docs/help/webmasters.htm#07) 搜搜爬虫 Sosospider+(+http://help.soso.com/webspider.htm) 网易有道爬虫 Mozilla/5.0 (compatible; YoudaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; ) MSN爬虫 msnbot/1.0 (+http://search.msn.com/msnbot.htm)
|
总结
—阿里云:无法模拟搜索引擎爬虫绕过 只能采用代理池或者延时
—宝塔:爬虫未知,延迟可以,代理池可以
—比较麻烦的是,我的安全狗防护的是phpStudy的网站,打开安全狗发现并不防护宝塔的网站
—在脚本扫描文件的时候,宝塔拦截的日志:在60秒内请求恶意文件路径(如configure文件)超过六次,就封锁ip六百秒,同一ip请求超过120次封锁ip100秒(1、可以通过延时绕过(一分钟5次)2、可以优化字典,将恶意文件路径去除3.将恶意文件路径进行变异,如文件上传漏洞一样,加上.或者空格(如index.php可以改为index.php.或者index.php ))
参考链接
1 2 3
| https://blog.1997sty.com/archives/3622 https://www.yuque.com/weiker/xiaodi/srrnp3 https://www.bilibili.com/read/cv14673177?spm_id_from=333.999.0.0
|
涉及资源
1 2 3
| https://www.bt.cn/ http://free.safedog.cn/website_safedog.html https://www.cnblogs.com/iack/p/3557371.html
|