This vulnerability occurs when an application writes user-supplied data into a CSV file without properly sanitizing special characters. Spreadsheet programs like Excel or Google Sheets interpret entries starting with '=' as executable formulas, which can lead to malicious command execution when the file is opened.
Many applications export data to CSV files for easy viewing in spreadsheet software. However, these programs treat cells beginning with characters like =, +, -, or @ as formulas. If an attacker can inject data like `=HYPERLINK("http://malicious-site.com", "Click")` or a formula that calls external scripts, simply opening the CSV file can trigger data theft, remote code execution, or other harmful actions on the user's machine. Developers often overlook this risk because CSV files are seen as simple data dumps, not executable content. To prevent this, you must sanitize or escape formula-initiating characters in all user-controlled fields before writing them to a CSV. This ensures that data is displayed as static text, not as an active command, when the file is imported into a spreadsheet application.
Impact: Read Application DataExecute Unauthorized Code or Commands
Current versions of Excel warn users of untrusted content.
Effectiveness: Moderate
Effectiveness: Moderate
Effectiveness: Limited
=HYPERLINK(link_location, [friendly_name])
HYPERLINK(link_location, [friendly_name])