Express Sheets
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,applyandbindare allowed. - Assigning to
__proto__is silently ignored, andconstructorcan’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, sincecsv-parsebuilds null-prototype records.
Getting Function
The blocklist only applies to constructor written as an identifier. A few observations chained together:
- A bare
constructorresolves toObjectthrough the row’s prototype chain.constructor.xis rejected, but assigning it first (o = constructor) gives an ordinary variable that dot access works on. Object.getOwnPropertyDescriptor(Function.prototype, "constructor").valueisFunction. Here"constructor"is just a string argument, andFunction.prototypeis reachable asfac.__proto__.- Calling the result is the last hurdle.
f(...)()and member access on a call result are both rejected, and.callwas unusable. But expr-eval’s built-inmapcalls whatever function you hand it.
A harmless test first:
| |
| |
The server runs Node 24, where process.mainModule is undefined, so I used process.getBuiltinModule to get child_process. The flag was at /flag:
| |
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}