Unveiling the Sneaky CSV Injection: VDP vs. Objective-Based Offensive Tactics
A CSV export feature failed to sanitise user input, allowing formula injection. An attacker could craft a link that, when opened in Excel, executes formulas to run local programs or exfiltrate data.
Published on abawazeeer.medium.com
Welcome to the world of cybersecurity hide-and-seek, where we’re on a mission to find and fix sneaky computer bugs. But not all bugs are treated the same — some are easy to find, while others are like hidden treasures waiting to be discovered.
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
Likely the application did not sanitise or escape user-supplied values before writing them to a CSV file, allowing formula characters to be interpreted by spreadsheet software.
Impact
Arbitrary formulas can be injected into CSV files, which could lead to remote code execution on the internal user's side or data leakage via malicious hyperlinks.
What the attacker needed
Victim opens the CSV in Excel; attacker can inject input into CSV export; victim clicks a crafted link
The fix
The application should sanitise user input by prefixing cells that begin with =, +, -, or @ with an apostrophe, or by validating input to allow only trusted characters.
How it was found
- Send a request with two values and capture it in a proxy tool.
- Monitor the downloaded CSV file.
- Inject a formula payload into the request.
- Observe that the request is filtered due to special characters.
- Encode the payload using URL encoding and CHAR encoding to bypass the filter.
- The final payload is delivered and the CSV file contains the injected formula.
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.
CSV files are simple spreadsheets. If a program puts user input into a CSV without cleaning it, and someone opens that file in Excel, Excel may treat the input as a formula and run it. This can let an attacker run programs or steal data 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.