首页 > 其他分享 >DASCTF X CBCTF 2023 yet another sandbox

DASCTF X CBCTF 2023 yet another sandbox

时间:2023-11-26 13:44:05浏览次数:26  
标签:code shadowRealm res app express sandbox CBCTF another DASCTF

本来想直接复现昨天的DASCTF,但是前面的一个DASCTF已经开始看了,那就放到下次再写。

yet another sandbox

js沙箱逃逸。

下载复现获得一个c写的readflag,

有个js的模块文件app.mjs:

import express from 'express';
import path from 'path';


const __dirname = path.resolve();

const app = express();
app.use(express.json());

app.use('/asserts', express.static('asserts'));

function runInShadowRealm(code) {
    let shadowRealm = new ShadowRealm();
    let result = shadowRealm.evaluate(code);
    shadowRealm = null;
    return result;
}

app.get('/', (_, res) => {
    return res.sendFile(__dirname+'/index.html');
});

app.post('/api/run', async (req, res) => {
    try{
        let { code } = req.body;
        var msg = await runInShadowRealm(code);
    } catch(error) {
        var msg = error.toString();
    }
    res.json({"msg": msg});
});


app.listen(1337, () => {
    console.log('Server listening on port 1337');
})

网上搜了下说是shadowRealm沙盒:

Javascript 新特性前瞻 —— ShadowRealms - 掘金 (juejin.cn)

这里的evaluate跟eval差不多,就是在独立环境运行的而已,而code就是框里我们传的东西:

但好像也没有ban掉什么东西,所以直接在框里写个import就能RCE了:

我们队里wp是直接用的/readflag:

 

(后面的题好难

标签:code,shadowRealm,res,app,express,sandbox,CBCTF,another,DASCTF
From: https://www.cnblogs.com/EddieMurphy-blogs/p/17856763.html

相关文章

  • [Codeforces] CF1703F Yet Another Problem About Pairs Satisfying an Inequality
    时间限制\(2s\)|空间限制\(250M\)题目描述给你一个序列$a_1,a_2,\dotsa_n$。请计算出满足下面条件的$(i,j)(1\leqi,j\leqn)$个数。$a_i<i<a_j<j$.输入格式第一行包含一个整数$t$($1\leqt\leq1000$)—测试数据的个数每一个......
  • [Codeforces] CF1858C Yet Another Permutation Problem
    YetAnotherPermutationProblem-洛谷这题本来很简单,思路我也想到了,但是代码一直没写对,思路也一直换来换去(悲然而发现最开始的思路是对的题意Alex收到了一个名为"GCD排列"的游戏作为生日礼物。这个游戏的每一轮进行如下操作:首先,Alex选择一个整数序列\(a_1,a_2,…,a_......
  • CF1858C Yet Another Permutation Problem
    CF1858CYetAnotherPermutationProblemYetAnotherPermutationProblem-洛谷这题本来很简单,思路我也想到了,但是代码一直没写对,思路也一直换来换去(悲然而发现最开始的思路是对的题意Alex收到了一个名为"GCD排列"的游戏作为生日礼物。这个游戏的每一轮进行如下操作:......
  • 率先支持Kuasar!iSulad Sandbox API 简化调用链,沙箱管理能力增强
    本文分享自华为云社区《率先支持Kuasar!iSuladSandboxAPI简化调用链,可靠性倍增》,作者:云容器大未来。沙箱隔离技术是一种将进程有效隔离到独立环境中运行的技术。随着容器技术的兴起,沙箱隔离技术也在云原生领域中得到了广泛的应用。iSulad率先通过SandboxAPI支持Kuasar,提供......
  • [题解] CF1748E Yet Another Array Counting Problem
    YetAnotherArrayCountingProblem给你一个长度为\(n\)的序列和一个数\(m\),求有多少个长度为\(n\)的序列\(b\)满足:\(\foralli\in[1,n],b_i\in[1,m]\)。对于每个区间\([l,r]\),\(b\)中最大值最靠左的位置和\(a\)相同。\(n,m\le2\times10^5,n\ti......
  • CF1359D Yet Another Yet Another Task
    貌似没有线段树做法。记\(s\)为\(a\)的前缀和数组。对于一个确定的右端点\(r\)和左端点\(l\),它对于答案的贡献是\(s_r-s_{l-1}-max\{a_i\},l\lei\ler\),如果枚举右端点,令\(c_l=s_{l-1}+max\{a_i\},l\lei\)。那么其实就是要求\(1\lek\ler-1\)的\(min\{c_k\}\)。线......
  • How can I move a MySQL database from one server to another?
     Myfavoritewayistopipeasqldumpcommandtoasqlcommand.Youcandoalldatabasesoraspecificone.So,forinstance,mysqldump-uuser-ppasswordmyDatabase|mysql-hremoteserver-uremoteuser-premoteserverpasswordYoucandoalldatabaseswithmysq......
  • [PG] Another example of FCSA
    functionactualargumentsandcadidatesT=(193341,23,23)C=[(193341,1700,1700),(1700,1700,1700),(1043,1700,1700)]querytypeinformation,selectoid,typname,typcategorytypcat,typispreferredpreferredfrompg_typewhereoidin(193341,2......
  • 修改token有效期工具 Another Redis Desktop Manager
     1、获取到redis的host和密码登录2、根据要使用的token查询出数据,修改TTL字段值未-1保存即可。 ......
  • Dasctf&CBctf-pwn部分题目复现
    打了一下Dasctf&CBCTF的pwn题目,感觉有些思路,但是就是做不出来,赛后发WP才恍然大悟,还是太菜了喵(---------------------------------------------------------------------------------------------------------------------------------------------------------------------------......