Skip to content
RCE Write-up Intermediate

$4,800 for an Equals Sign: CSV Formula Injection That Turns an Ex

Free-text survey responses were written directly into CSV exports without neutralising leading formula characters, so a respondent could embed a spreadsheet formula. When an administrator opened the export in a permissively configured spreadsheet application, the formula could execute an external command on the administrator's machine.

T4nv1 Follow

Published on medium.com

This is the bug I’ve had the hardest time convincing people outside security actually matters. “You typed a formula into a text field, and a spreadsheet program did spreadsheet things with it” sounds, on first hearing, like a non-issue — almost a feature working as intended. It took building the full chain, from a…

T4nv1, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The export feature wrote user-supplied text into CSV cells without escaping leading characters that spreadsheet applications interpret as formula triggers.

Impact

Any respondent, including unauthenticated anonymous users, could embed a formula that may execute a command on an administrator's machine when the exported CSV is opened in a vulnerable or permissively configured spreadsheet application.

What the attacker needed

Ability to submit a survey response; administrator exports responses as CSV; administrator opens export in vulnerable spreadsheet

The fix

The platform added export-time sanitisation, prefixing formula-triggering leading characters across every export format.

How it was found

  1. Submit a survey response beginning with an equals sign.
  2. Export the responses as a CSV file.
  3. Open the CSV in a spreadsheet application and observe the cell evaluated as a formula.
  4. Submit a response containing a formula that invokes an external command.
  5. Export and open the file in an isolated virtual machine to confirm command execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A CSV file is a plain list of values separated by commas. Spreadsheet programs like Excel add extra meaning: if a cell starts with =, +, - or @, they treat it as a formula and calculate it. Here, a survey answer starting with = was saved into the export unchanged, so opening the file made the spreadsheet run the answer as a formula, which in some configurations can start a program on the computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by T4nv1

View all

113 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.