CSV Excel Macro Injection Vulnerability in export list of current users - app.shopify.com
The CSV export of installed users did not escape field values, so a shop name containing a spreadsheet formula would be written into the file as a live formula. An attacker could set a malicious shop name and, when a partner opened the exported file in a spreadsheet application, the formula could run a command on the partner's computer.
Originally disclosed on HackerOne
- Triaged in 5 hours
- Fixed in 11 days
- Disclosed after 11 days
Summary by the program
A CSV formula injection issue when a Partner export the list of current users for one of their application.
The report
Hi , I have found that when a user tries to Export list of current users who installed his apps through: https://app.shopify.com/services/partners/api_clients/<app_id>/export_installed_users the fields of the CSV file are not properly escaped. which makes them vulnerable to CSV Excel Macro Injection.
#Scenario:
An attacker could change his shop name to a malicious function that executes malware on the user'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 the user computer.
#Steps to reproduce:
- Login to your partner account then go to https://app.shopify.com/services/partners/api_clients and create a new app.
- Go to
<your_store>.myshopify.com/admin/oauth/authorize?client_id=<app_api_key>&redirect_uri=<app_redirect_uri>&response_type=code&scope=read_products%2Cwrite_products
where The <app_api_key> is the api key of the app you have created through the partner account and the <app_redirect_uri> is the redirect url of it.
3. Now click Install app
4. Go to <your_store>.myshopify.com/admin/settings and change the store name to -2+3+cmd|' /C calc'!D2
5. Go to https://app.shopify.com/services/partners/api_clients/<app_id>/ then scroll down and click the Export list of current users button . then A CSV file will be sent to your email , open that file and you'll see that the cell is active and the command will be executed.
####References:
- https://www.owasp.org/index.php/CSV_Excel_Macro_Injection
- https://hackerone.com/reports/72785
- https://hackerone.com/reports/90415
Thanks
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 field values into the CSV without neutralising leading formula characters, so spreadsheet software interpreted them as formulas.
Impact
An attacker could cause a partner who opens the exported file in a spreadsheet application to run an arbitrary command, potentially installing malware on the partner's computer.
What the attacker needed
A partner account; an app installed on a store; control of a store name; victim opens the CSV in a spreadsheet
How it was found
- Log in to the partner account and create a new app.
- Install the app on a store using the authorisation link with the app's API key and redirect URI.
- Change the store name to a value that looks like a spreadsheet formula.
- Open the partner app page and click the export button for current users.
- Open the CSV file that arrives by email and observe that the cell is active and the command runs.
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 exports data to a CSV file (a plain text table that spreadsheet programs open), it should make sure any text starting with a formula character is treated as text, not as a formula. Here it did not, so a shop name that looks like a formula stayed a formula. If a partner opened the export in a spreadsheet program, that formula could run a command on their machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.