From Input Filtering to Data Exfiltration: Exploiting CSV Injecti
The application relied on client-side filtering of special characters, but the backend accepted unfiltered input. An attacker could inject a spreadsheet formula that executes when an admin opens an exported CSV file, potentially leading to data exfiltration or phishing.
Published on cybertamarin.medium.com
During a recent private pentest, I hit one of those moments every tester knows well.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application trusted client-side validation and failed to sanitise user input on the server before storing and exporting it.
Impact
An attacker could execute arbitrary spreadsheet formulas when an admin opens the exported CSV, potentially leading to data leakage, redirects, or phishing.
What the attacker needed
Ability to submit input to the application; admin exports and opens the CSV
The fix
The application should validate all input on the server side, escape dangerous characters before export, and treat exported data as untrusted.
How it was found
- Intercept the update request and modify it to include a formula payload.
- The backend accepts and stores the payload without filtering.
- Export the data as a CSV file through the reporting feature.
- Open the CSV file in Excel, which triggers execution of the payload.
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 write-up has not been written yet. The Original tab links to the source.
The app tried to block dangerous characters only in the browser, but the server didn't check them. So an attacker could send a malicious formula that gets saved and later runs when someone opens the exported file in a spreadsheet program. This is called CSV injection.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.