版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
1、漏洞描述:
XFF,是X-Forwarded-for的缩写,XFF注入是SQL注入的一种,该注入原理是通过修改X-Forwarded-for头对带入系统的dns进行sql注入,从而得到网站的数据库内容。
2、检测条件:
HTTP Header中存在X-Forwarded-for参数的调用
3、检测方法
1、检测方法,通过火狐的插件X-Forwarded-for header 1.0.1.1进行对本地IP地址进行修改,为其带入的IP地址加入敏感字符。
2、修改后,找到网站登录页面或者其它功能交互页面,提交数据后,查看是否会报错,如果会报错,则说明存在该漏洞。
4、修复方案
1、过滤http头中的X-Forwarded-for header中的内容,不允许其插入敏感字符,过滤字符参考sql注入修复方案。
2、过滤以下敏感字符。需要过滤的特殊字符及字符串有:
net user
xp_cmdshell
add
exec master.dbo.xp_cmdshell
net localgroup administrators
select
count
Asc
char
mid
'
:
"
insert
delete from
drop table
update
truncate
from
%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-095d4a0b23.css" rel="stylesheet">
</div>