以Less-1为例
查看源代码
union联合查询
可以看到get到id后没有经过任何处理就放入到了后面的查询语句中,很明显存在SQL注入漏洞

1、判断注入点
利用’来初步判断是否可注入
union联合查询
2、判断查询列数
union联合查询
3OK,4报错,说明当前使用的表只有三列
3、判断显示位
union联合查询
使用union联合查询,需要使得前面的语句逻辑为假,且和前面的语句必须有相同数量的列,查看Less-1源代码可知,前面使用的是select *,且判断出有三列,构造后面的语句时应拥有相同数量的列。由此条语句和显示可以得出,显示位为第2,3列
4、获取所有数据库名
利用select schema_name from information_schema.schemata;查库
union联合查询
提示查询结果超过了一行,可以使用limit和group_contact来进行显示
limit
union联合查询
group_concat
union联合查询
5、获取数据库所有表名
利用select table_name from information_schema.tables where table_schema = '库名';查表
union联合查询
可以用十六进制来代替字符串,字符串转成十六进制的数字后,在前面加上0x
6、获取字段名
利用select column_name from information_schema.columns where table_name = 'users';查询字段
union联合查询
7、获取字段中的数据
利用select username from security.users;查数据
根据我们找出来的库表列,来查询我们想要得到的数据
union联合查询
至此,利用union联合查询一个简单的SQL注入就完成了

相关文章:

  • 2021-06-13
  • 2022-12-23
  • 2021-12-24
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
猜你喜欢
  • 2021-03-31
  • 2022-12-23
  • 2021-12-08
  • 2021-11-08
  • 2022-03-13
  • 2022-01-26
  • 2022-12-23
相关资源
相似解决方案