CSV injection in the credentials export
A hacker could inject a formula into the account details field, which would be executed when a program user exports credentials to CSV and opens it in Microsoft Excel. This could allow arbitrary command execution on the program user's Windows machine.
- Triaged in 13 hours
- Fixed in 57 days
- Disclosed after 6 months
Summary:
Hello team!
We have found out that a hacker can inject malicious excel formulas into the credentials details which will be executed when program user exports the credentials details via https://hackerone.com/hackerone_h1p_bbp3/credentials -> export credentials and opens this CSV using MS excel. This how an attacker could execute abritary commands in the program user's windows machines throught the malicious CSV files. However, since this attack vector requires an older windows machine the impact is pretty low so we decided to report this as best practice instead of vulnerabilitys (severity none).
Steps To Reproduce:
- Login to the system as a program user
- Add credentials to the program at
https://hackerone.com/hackerone_h1p_bbp3/credentials - Now login as a hacker user of this program and request your credentials using show credentials button
- Set value of the account details to the
;=1+1; - As a program user navigate to the
https://hackerone.com/hackerone_h1p_bbp3/credentialsand export the credentials
Note: The program user does not see the account details in this phase so s/he won't expect anything harmless.
- Once you open the CSV in the MS excel the formula has been executed and there is a new cell with value
2instead of;=1+1
Recommendation:
Make sure that the payload can't start with the following characters: ;, =, -, @ or +.
References:
https://owasp.org/www-community/attacks/CSV_Injection
Impact
Possible command execution in the victim's windows machines
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 application did not sanitise user-supplied values before including them in a CSV export, allowing formula injection.
Impact
Possible command execution in the victim's Windows machine, though the attack requires an older Windows machine and the impact is considered low.
What the attacker needed
Hacker user in the program; program user exports credentials; victim opens CSV in MS Excel; older Windows machine
How it was found
- Log in as a program user and add credentials.
- Log in as a hacker user and request credentials using the show credentials button.
- Set the account details value to a formula-like string.
- As the program user, export the credentials to CSV.
- Open the CSV in Microsoft Excel and observe the formula 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 report has not been written yet. The Original tab links to the source.
When data from a website is exported to a spreadsheet like Excel, any text starting with certain characters (like = or +) can be treated as a formula. An attacker can put such a formula into a field they control, and when someone else opens the exported file, the formula runs. This can sometimes be abused to run commands on the victim's computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.