二、WAF识别工具
一些WAF可以自定义返回的消息内容,或者全部返回自定义的404页面或200页面,有一些工具会协助作为WAF设备的识别。
Wafw00f
用python编写的一个小工具,开源地址:
http://code.google.com/p/waffit/source/browse/trunk/wafw00f.py
Wafw00f用来判断WAF设备的函数如下:
AdminFolder = '/Admin_Files/'
xssstring = ''
dirtravstring = '../../../../etc/passwd'
cleanhtmlstring = 'hello'
isaservermatch = 'Forbidden ( The server denied the specified Uniform Resource Locator (URL). Contact the server administrator. )'
使用“python wafw00f.py -h”可以查看工具的使用方法,运行示例:
python wafw00f.py http://www.victim.org/
基于Cookie的检测
Wafw00f的探测大部分是基于Cookie的检测。
F5asm的检测规则如下:
def isf5asm(self):
# credit goes to W3AF
return self.matchcookie('^TS[a-zA-Z0-9]{3,6}=')
基于响应头的检测
Profense在响应头会包含'server','profense'的信息。
def isprofense(self):
"""
Checks for server headers containing "profense"
"""
return self.matchheader(('server','profense'))
sqlmap
Sqlmap是一款检测和利用SQLi漏洞工具,也是基于python编写,业内认同率较高,sqlmap用来探测WAF类型想比较Wafw00f来说还多一些。
参考:
https://github.com/sqlmapproject/sqlmap/tree/master/waf
Sqlmap用来探测每种WAF设备都是一个python文件,同样是从cookie信息或者返回头信息进行判断。
以Mod_Security为例
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "ModSecurity: Open Source Web Application Firewall (Trustwave)"
def detect(get_page):
retval = False
for vector in WAF_ATTACK_VECTORS:
page, headers, code = get_page(get=vector)
retval = code == 501 and re.search(r"Reference #[0-9A-Fa-f.]+", page, re.I) is None
retval |= re.search(r"Mod_Security|NOYB", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
if retval:
break
return retval
Sqlmap用来探测WAF的命令如下:
python sqlmap.py -u “http://www.victim.org/ex.php?id=1” --identify-waf
貌似必须是或自己修改的类似动态参数才能使用。
xenoitx
检测和利用XSS漏洞的神器,WAF检测也是其中的功能之一。
【编辑推荐】
【责任编辑:蓝雨泪 TEL:(010)68476606】
内容导航
第 1 页:WAF指纹