Challenge

Express is a small CSV editor built on Express and React, seeded with an inventory.csv. There are six API routes. The interesting one is computed columns: POST /api/dataset/columns/preview takes {name, expression} and evaluates the expression server-side against every row, with the row object as the scope.

Approach

Dead ends first

I went in expecting XXE, since spreadsheet apps love XML. It never happened. Every upload, whatever its content type or filename, including a real XLSX zip, went straight to csv-parse. There is no XML parser in the app at all.

The formula engine was the real target. Sending a parse error came back with parse error [1:21]: Expected TNAME, and fac, pow and PI all worked. That fingerprints expr-eval, which has a history of sandbox escapes, and this copy had clearly been hardened against the known ones:

  • Bracket indexing coerces every key to an integer, so "abcd"["length"] returns "a". No string-keyed reads.
  • Dot access works for most names, but some are blocked at parse time (that is the Expected TNAME): constructor, toString, valueOf, hasOwnProperty, length. name, prototype, __proto__, call, apply and bind are allowed.
  • Assigning to __proto__ is silently ignored, and constructor can’t be an assignment target, so the classic prototype swap is out.
  • No dangerous functions are in scope. Prototype pollution through JSON bodies, query strings, a column named __proto__, or the cells PATCH route went nowhere either, since csv-parse builds null-prototype records.

Getting Function

The blocklist only applies to constructor written as an identifier. A few observations chained together:

  1. A bare constructor resolves to Object through the row’s prototype chain. constructor.x is rejected, but assigning it first (o = constructor) gives an ordinary variable that dot access works on.
  2. Object.getOwnPropertyDescriptor(Function.prototype, "constructor").value is Function. Here "constructor" is just a string argument, and Function.prototype is reachable as fac.__proto__.
  3. Calling the result is the last hurdle. f(...)() and member access on a call result are both rejected, and .call was unusable. But expr-eval’s built-in map calls whatever function you hand it.

A harmless test first:

1
o = constructor ; d = o.getOwnPropertyDescriptor(fac.__proto__, "constructor") ; f = d.value ; map(f("return 7*6"), [1])
1
{"values":[[42]],"rows":1}

The server runs Node 24, where process.mainModule is undefined, so I used process.getBuiltinModule to get child_process. The flag was at /flag:

1
o = constructor ; d = o.getOwnPropertyDescriptor(fac.__proto__, "constructor") ; f = d.value ; map(f("return process.getBuiltinModule('child_process').execSync('cat /flag').toString()"), [1])

The hint that came out mid-competition was unicode escapes, meaning "constructor" in a string literal (expr-eval decodes \u escapes in strings but not in identifiers). On this instance the plain string worked, because the blocklist only ever looked at identifiers.

Flag

flag{expressions_should_not_inherit}