Skip to content
RCE Disclosed report Beginner

CSV injection in gratipay.com via payment history export feature.

A participant's name was written directly into an exported CSV file without neutralising formula characters, so a name beginning with a formula could run commands when the file was opened in a spreadsheet. An attacker could exfiltrate data or execute code on the victim's machine.

edoverflow Follow

Originally disclosed on HackerOne

Medium 6.5 View original
  • Triaged in under an hour
  • Fixed in 7 months
  • Disclosed after 7 months

I discovered this issues thanks to Matt who pointed out that the participant's name is directly placed into a CSV file: https://github.com/gratipay/gratipay.com/issues/4399#issuecomment-292250609

Summary


Gratipay allows users to export payment history as a .csv file. By injecting a payload into a participant's name an attacker could exfiltrate data or execute code on the target machine. For instance, with =cmd|' /C calc'!A0 I am able to open up calc.exe on Windows.

Steps to reproduce


  1. Create a user A called =cmd|' /C calc'!A0;
  2. User B donates a small sum to user A;
  3. Export payment history from B;
  4. Open the .csv file on a Windows machine.

Result: calc.exe pops up.

Fix


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

The original report as published on HackerOne, by edoverflow. 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

Likely the export wrote user-controlled names into CSV cells without escaping leading formula characters.

Impact

Opening the exported file could execute code on the victim's machine, and the report also states data could be exfiltrated.

What the attacker needed

An account; victim opens the exported CSV in a spreadsheet; Windows machine

The fix

The export should prefix formula-leading characters with an apostrophe so spreadsheet software treats them as text.

How it was found

  1. Create a user whose name is a spreadsheet formula.
  2. Have another user donate a small sum to that user.
  3. Export the payment history from the second user's account.
  4. Open the downloaded CSV file on a Windows machine.

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.

A CSV file is a simple spreadsheet format. Some spreadsheet programs treat any cell starting with an equals sign as a formula and run it. Because the site put a user's chosen name straight into the file, a malicious name could become a formula that runs a program when the file is opened.

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 edoverflow

View all

27 more disclosed reports, best first.

More from Gratipay

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.