Skip to content
RCE Disclosed report Beginner CVE-2014-3524

CSV Injection at https://assets-paris-demo.codefi.network/

The web application allowed a user-supplied client name to be exported into a CSV file without sanitisation, so a value beginning with a formula character would be interpreted as a formula when the file is opened in a spreadsheet program. An attacker could craft a client name that executes a command on the computer of anyone who downloads and opens the exported CSV.

0xjackal Follow

Originally disclosed on HackerOne

Bounty$500 Medium View original
  • Fixed in 7 days
  • Paid in 7 days
  • Disclosed after 2 months

Summary:

Hi consensys Security Team.

I have found CSV Injection when generate report at https://assets-paris-demo.codefi.network/

CSV Injection, also known as Formula Injection, occurs when websites embed untrusted input inside CSV files. When a spreadsheet program such as Microsoft Excel or LibreOffice Calc is used to open a CSV, any cells starting with = will be interpreted by the software as a formula. Maliciously crafted formulas can be used for three key attacks:

- Hijacking the user’s computer by exploiting vulnerabilities in the spreadsheet software, such as CVE-2014-3524.
- Hijacking the user’s computer by exploiting the user’s tendency to ignore security warnings in spreadsheets that they downloaded from their own website.
- Exfiltrating contents from the spreadsheet, or other open spreadsheets.

Steps To Reproduce:

  1. Create an account at https://assets-paris-demo.codefi.network/
  2. Go to Client management
  3. Create new client
  4. At Client name* Put this paylaod:- =cmd|' /C notepad'!'A1'
  5. After create new client Download the data.

Supporting Material/References:

bandicam_2022-10-25_10-50-26-062.mp4 From the original on HackerOne

##Similar valid reports at hackerone:-

Please let me know if need more info. Best Regards. @doosec101

Impact

This vulnerability can be harm for normal user because if malicious user injected any malicious script in token note and when customer user download CSV file then inserted command directly runs when CSV file open.

##FIX:- Prefix =, +, - and @ symbols with a ' in issues when exporting them to a .csv file.

The original report as published on HackerOne, by 0xjackal. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target is the demo instance of an asset management application hosted at https://assets-paris-demo.codefi.network/, reported through the MetaMask program on HackerOne. The feature in question is the client management module: an authenticated user can create a client record and then download the data as a CSV file. That export is the point where untrusted input reaches a spreadsheet program.

CSV Injection, also called Formula Injection, occurs when a website embeds untrusted input inside CSV files. When a spreadsheet program such as Microsoft Excel or LibreOffice Calc opens a CSV, any cell starting with = is interpreted by the software as a formula. The researcher lists three key attacks that maliciously crafted formulas enable:

  • Hijacking the user's computer by exploiting vulnerabilities in the spreadsheet software, such as CVE-2014-3524.
  • Hijacking the user's computer by exploiting the user's tendency to ignore security warnings in spreadsheets that they downloaded from their own website.
  • Exfiltrating contents from the spreadsheet, or other open spreadsheets.

Setup

No special tooling is described. The preconditions are an account on the demo instance and access to the client management feature. The researcher used a screen recording tool, as the supporting video filename suggests, to capture the reproduction.

Finding it

The researcher supplied a formula payload in the client name and then downloaded the exported data. Because the export is downloaded from the application's own domain, a victim opening it in a spreadsheet application has a plausible reason to trust the file, which is exactly the second attack class listed above.

Exploitation

Step 1: Create an account

Register an account at https://assets-paris-demo.codefi.network/.

Step 2: Open client management

Navigate to Client management in the application.

Step 3: Create a new client

Start creating a new client record.

Step 4: Inject the payload in the client name

In the Client name* field, enter the following payload:

Text
=cmd|' /C notepad'!'A1'

The cell begins with =, so a spreadsheet application treats it as a formula rather than text. The cmd component invokes the Windows command interpreter, /C notepad runs Notepad, and the trailing !'A1' supplies the argument the formula syntax expects. The payload is a formula that, if evaluated on opening, would launch a program.

Step 5: Download the data

After creating the client, download the data.

bandicam_2022-10-25_10-50-26-062.mp4 From the original on HackerOne

The video, bandicam_2022-10-25_10-50-26-062.mp4, is listed as supporting material.

Root cause

The report's fix section addresses characters that spreadsheet applications treat as the start of a formula. The report's fix section names the characters involved: =, +, - and @. Any cell beginning with one of these is interpreted as a formula by the spreadsheet, so the application's own output becomes the delivery mechanism.

Impact

The researcher frames the impact around a normal user: if a malicious user injects a malicious script into a token note, and a customer user then downloads the CSV file, the inserted command runs directly when the CSV file is opened. The payload targets Notepad, which is benign, but the same mechanism could run other commands. The attack depends on the victim opening the exported file in a spreadsheet application that evaluates formulas, and on the usual warnings around such files being ignored or accepted.

Fix

The report recommends prefixing =, +, - and @ symbols with a ' in issues when exporting them to a .csv file. The apostrophe forces the spreadsheet to treat the cell as text instead of a formula.

Variants to test

  • Try the other formula-leading characters named in the fix, +, - and @, in the same client name field. A positive result is an exported cell that the spreadsheet evaluates rather than displays as text.
  • Try the payload in other free-text fields that end up in the export, such as notes. A positive result is the same formula evaluation on opening the downloaded file.
  • Try other export formats and other download actions in the application. A positive result is any generated file where user input lands in a cell without neutralisation.

Hunting notes

This class of bug hides in export and reporting features: anywhere a user-supplied string is written into a CSV, spreadsheet or similar tabular file that a person will open. During recon, look for download and export buttons in authenticated areas, then check whether values you control, such as names, descriptions and notes, appear verbatim in the downloaded file. The signal is a field you filled in showing up unchanged as the first characters of a cell. To show impact, a payload that visibly executes on opening, as in the recorded reproduction here, is enough to demonstrate the mechanism without causing harm.

Similar reports

The researcher cites three similar valid reports on HackerOne as references:

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

A security researcher found a way to make a website produce a file that can run a program on the computer of whoever opens it. The website is a demo of an asset management application at https://assets-paris-demo.codefi.network/, and the report was submitted through the MetaMask program on HackerOne.

The trick is called CSV Injection, or Formula Injection. It does not break into the website's server. Instead, it abuses the way spreadsheet programs like Microsoft Excel or LibreOffice Calc read CSV files. A CSV file is a plain text file where each line is a row of a table and commas separate the columns. It is the simplest way to move a table of data between programs.

Spreadsheet programs have a feature: if a cell starts with an equals sign =, the program treats what follows as a formula and calculates it. That is normally helpful, for example =2+2 shows 4. But some formulas can call out to the operating system and start other programs. If a website lets a user type text that later ends up at the start of a cell in an exported CSV, and that text begins with =, the spreadsheet will run it as a formula when the file is opened.

In this application, a user can create a client record and give it a name. The name is then written into a CSV file that can be downloaded. The researcher put a formula into the client name and downloaded the CSV. The demonstration program is Notepad, which is harmless, but the same mechanism could run other commands.

Context

The target is the demo instance of an asset management application. "Asset management" here means a tool for keeping track of things a business owns or manages, and the demo instance is a public copy meant for trying the product out. The feature involved is the client management module: a logged-in user can create a client record and then download the data as a CSV file. That export is where untrusted input reaches a spreadsheet program.

A few terms first, because they come up throughout:

  • Authenticated user: someone who has created an account and logged in. The application knows who they are.
  • Untrusted input: any text a user can type. The application cannot assume it is safe, because an attacker can type anything.
  • Export: a button or action that takes data stored in the application and writes it into a file for download.

CSV Injection, also called Formula Injection, occurs when a website embeds untrusted input inside CSV files. When a spreadsheet program such as Microsoft Excel or LibreOffice Calc opens a CSV, any cell starting with = is interpreted by the software as a formula. The researcher lists three key attacks that maliciously crafted formulas enable:

  • Hijacking the user's computer by exploiting vulnerabilities in the spreadsheet software, such as CVE-2014-3524.
  • Hijacking the user's computer by exploiting the user's tendency to ignore security warnings in spreadsheets that they downloaded from their own website.
  • Exfiltrating contents from the spreadsheet, or other open spreadsheets.

A quick word on each. "Hijacking the user's computer" means taking control of it, or of a program running on it, without permission. CVE-2014-3524 is a public identifier for a known flaw in spreadsheet software; CVE is a catalogue number that security researchers use to refer to a specific bug. "Exfiltrating" means secretly copying data out, for example sending the contents of a spreadsheet to an attacker. The second point is about trust: people are more likely to click through a warning about a file they downloaded from a site they use, which makes the attack more likely to succeed.

Setup

No special tooling is described. The preconditions are an account on the demo instance and access to the client management feature. The researcher used a screen recording tool, as the supporting video filename suggests, to capture the reproduction. A screen recording is simply a video of the researcher's screen while they perform the steps, so others can watch exactly what happened.

Finding it

The researcher supplied a formula payload in the client name and then downloaded the exported data. "Neutralising" means changing or escaping the text so the spreadsheet does not treat it as a formula. Because the export is downloaded from the application's own domain, a victim opening it in a spreadsheet application has a plausible reason to trust the file, which is exactly the second attack class listed above. In everyday terms: if a file arrives from a website you already use, you are less suspicious of it than of an attachment from a stranger.

Exploitation

Step 1: Create an account

Register an account at https://assets-paris-demo.codefi.network/.

Why: the client management feature is behind a login, so you need an account to reach it. This is the same as signing up for any website.

Step 2: Open client management

Navigate to Client management in the application.

Why: this is the part of the application where client records are created and where the export lives. You need to be in the right screen before you can use it.

Step 3: Create a new client

Start creating a new client record.

Why: the client name is the field that later ends up in the CSV. Creating a record is how you get your text into the export.

Step 4: Inject the payload in the client name

In the Client name* field, enter the following payload:

Text
=cmd|' /C notepad'!'A1'

Line by line, in plain words:

  • The leading = tells the spreadsheet "this cell is a formula, calculate it". Without it, the rest would just be text.
  • cmd is the name of the Windows command interpreter, the program that runs other commands on a Windows machine.
  • | is a pipe character. In this context it is part of the formula syntax that lets the formula pass a command to another program.
  • ' /C notepad' is the argument given to cmd. /C means "run the command that follows and then stop", and notepad is the simple text editor that comes with Windows. So this part asks Windows to open Notepad.
  • !'A1' supplies the argument the formula syntax expects, pointing at cell A1. It is there to make the formula well formed.

The cell begins with =, so a spreadsheet application treats it as a formula rather than text. The result is that opening the exported file can launch a program on the victim's machine.

Step 5: Download the data

After creating the client, download the data.

The spreadsheet then does the rest when a person opens the file.

bandicam_2022-10-25_10-50-26-062.mp4 From the original on HackerOne

The video, bandicam_2022-10-25_10-50-26-062.mp4, is listed as supporting material.

Root cause

The report's fix section addresses characters that spreadsheet applications treat as the start of a formula. "Root cause" means the underlying reason the bug exists, as opposed to the visible symptom. The report's fix section names the characters involved: =, +, - and @. Any cell beginning with one of these is interpreted as a formula by the spreadsheet, so the application's own output becomes the delivery mechanism. "Server-side validation" means checks the website's own computers perform on what you submit, before storing it.

Impact

The researcher frames the impact around a normal user: if a malicious user injects a malicious script into a token note, and a customer user then downloads the CSV file, the inserted command runs directly when the CSV file is opened. The payload targets Notepad, which is benign, but the same mechanism could run other commands. "Arbitrary commands" means whatever the attacker chooses, not just Notepad. The attack depends on the victim opening the exported file in a spreadsheet application that evaluates formulas, and on the usual warnings around such files being ignored or accepted.

Fix

The report recommends prefixing =, +, - and @ symbols with a ' in issues when exporting them to a .csv file. The apostrophe forces the spreadsheet to treat the cell as text instead of a formula. Think of it as putting a label on a box that says "this is just writing, do not act on it".

Variants to test

These are follow-up checks in the same spirit, to see how wide the problem is:

  • Try the other formula-leading characters named in the fix, +, - and @, in the same client name field. A positive result is an exported cell that the spreadsheet evaluates rather than displays as text.
  • Try the payload in other free-text fields that end up in the export, such as notes. A positive result is the same formula evaluation on opening the downloaded file.
  • Try other export formats and other download actions in the application. A positive result is any generated file where user input lands in a cell without neutralisation.

Hunting notes

This class of bug hides in export and reporting features: anywhere a user-supplied string is written into a CSV, spreadsheet or similar tabular file that a person will open. During recon, look for download and export buttons in authenticated areas, then check whether values you control, such as names, descriptions and notes, appear verbatim in the downloaded file. "Recon" means the exploratory phase where you map out what a site does before testing it. "Verbatim" means exactly as you typed it, character for character. The signal is a field you filled in showing up unchanged as the first characters of a cell. To show impact, a payload that visibly executes on opening, as in the recorded reproduction here, is enough to demonstrate the mechanism without causing harm.

Similar reports

The researcher cites three similar valid reports on HackerOne as references:

Glossary

  • Asset management application: software for keeping track of things a business owns or manages.
  • Authenticated user: someone who has logged in and whose identity the application knows.
  • CSV: a plain text file where each line is a table row and commas separate the columns.
  • CSV Injection / Formula Injection: a bug where user text ends up in a CSV cell and is treated as a formula by a spreadsheet program.
  • Formula: an instruction a spreadsheet calculates, usually starting with =.
  • Spreadsheet program: software such as Microsoft Excel or LibreOffice Calc that displays and calculates tables of data.
  • Export: an action that writes stored data into a file for download.
  • Untrusted input: any text a user can type, which the application cannot assume is safe.
  • Payload: the specific text an attacker enters to trigger a bug.
  • Neutralise / escape: change text so a program does not interpret it as an instruction.
  • Root cause: the underlying reason a bug exists.
  • Server-side validation: checks the website's own computers perform on submitted data.
  • CVE: a public catalogue number for a known security flaw.
  • Exfiltrate: secretly copy data out to an attacker.
  • Hijack: take control of a computer or program without permission.
  • Arbitrary commands: whatever commands an attacker chooses.
  • Command interpreter: a program that runs other commands, such as cmd on Windows.
  • Pipe (|): a character used to pass output from one program or formula part to another.
  • Recon: the exploratory phase of mapping out what a site does before testing it.
  • Verbatim: exactly as typed, character for character.
  • HackerOne: a platform where security researchers report bugs to companies.
  • MetaMask: the program name under which this report was submitted.

More by 0xjackal

View all

4 more disclosed reports, best first.

More from MetaMask

View all

The newest disclosed reports for this program.

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.