Skip to content
RCE Disclosed report Beginner

CSV Excel Macro Injection in Export Response

A CSV export feature did not escape cells beginning with formula characters, so an attacker could submit a response containing a spreadsheet formula that would execute when a team member opened the exported file. This could allow the attacker to run commands on the victim's computer.

alyssa_herrera Follow

Originally disclosed on HackerOne

  • Triaged in 4 days
  • Fixed in 6 days
  • Disclosed after 6 days

Scenario: An attacker creates a response like =AND(2>1) in a tour that allows open response or discussion. Then when a user who created this tour clicks analytic and clicks to export responses as csv, he will see TRUE instead of =AND(1>2) Meaning that cell is now active, and an attacker could make a response using a malicious function to execute malware on a team member's pc. Since functions aren't escaped, the possibilities of using this can be limitless and can cause a severe impact. One example is having it execute malware on staff's computer as seen below, leveraging cmd to execute commands.

Crude Poc for executing cmd use -2+3+cmd|' /C calc'!D2 and could execute malicious commands through CMD. D2 is the cell it's located in.

This can be adapted to other spread sheet views like Libre as well Although excel has a feature to block this by tell a user that it wants to execute an external script, the team member would believe it's a trusted file coming from a trusted website and you will have a very high chance of this being executed. Seeing that it's generated by your site, they may believe it's an enhance functionality of it to stream line data viewing.

Best way to mitigate this vulnerability is if you append ' to the list of triggers, = , + , - Excel will ignore the ' and just show ='AND(2>1) instead

Source: https://www.owasp.org/index.php/CSV_Excel_Macro_Injection

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

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

How it worked

Root cause

The export did not escape or prefix cells that begin with spreadsheet formula trigger characters, so user-supplied content was interpreted as a formula by the spreadsheet application.

Impact

An attacker could execute arbitrary commands or malware on a team member's computer when the exported file is opened, although Excel may show a warning before running external content.

What the attacker needed

Ability to submit a response; victim exports responses as CSV; victim opens the file in a spreadsheet app

The fix

The export should prefix cells that begin with formula trigger characters with a single quote so the spreadsheet treats them as text.

How it was found

  1. An attacker submits a response containing a spreadsheet formula.
  2. A user exports the responses as a CSV file.
  3. The user opens the CSV file in a spreadsheet application.
  4. The formula is evaluated and can execute commands on the user's computer.

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 report has not been written yet. The Original tab links to the source.

When a website lets you download data as a CSV file, spreadsheet programs like Excel treat any cell starting with =, +, or - as a formula and run it. If the website does not neutralise those characters, an attacker can put a harmful formula into a response, and it will run on the computer of whoever opens the exported file.

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 alyssa_herrera

View all

28 more disclosed reports, best first.

More from Zaption

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.