CWE-1236: Improper Neutralization of Formula Elements in a CSV File
Base
The product saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by a spreadsheet product.
Consequences
- Confidentiality: Read Application Data, Execute Unauthorized Code or Commands
How to prevent it
- Implementation: When generating CSV output, ensure that formula-sensitive metacharacters are effectively escaped or removed from all data before storage in the resultant CSV. Risky characters include '=' (equal), '+' (plus), '-' (minus), and '@' (at).
- Implementation: If a field starts with a formula character, prepend it with a ' (single apostrophe), which prevents Excel from executing the formula.
- Architecture and Design: Certain implementations of spreadsheet software might disallow formulas from executing if the file is untrusted, or if the file is not authored by the current user.
Recent advisories
- GHSA-2p5x-4jr6-x5jg — FacturaScripts: CSV formula injection in CSVExport allows authenticated low-priv users to plant payloads that execute when an admin opens the export
- GHSA-whrx-mmgr-gpcf — Snipe-IT has CSV formula injection in Activity Report export
- GHSA-h77m-qrj7-jxcw — Statamic Vulnerable to CSV formula injection in form submission exports
- GHSA-xf4v-w5x5-pv79 — Spree: CSV Formula Injection in Customer Export
- GHSA-3xc2-h5r3-wv3r — Kimai vulnerable to formula Injection via tag names in XLSX export
- GHSA-qfh6-h7j6-fvjv — Moodle formula injection vulnerability
- GHSA-x2v3-9p22-w3x6 — phpMyFAQ contains a CSV injection vulnerability
- GHSA-2xvx-368h-qcmv — phpMyFAQ Improper Neutralization of Formula Elements in a CSV File vulnerability
- GHSA-hm75-8w6h-4f8f — Admidio Improper Neutralization of Formula Elements in a CSV File vulnerability
- GHSA-8q4v-35v6-g8wr — Mattermost Server is vulnerable CSV Injection
- GHSA-q693-v7qf-p4xj — Alkacon OpenCMS CSV Injection via New User module
- GHSA-rg8f-5p7x-m6wv — MantisBT CSV Injection unprivileged user access in csv_export.php
- GHSA-f8xq-q7px-wg8c — Improper Neutralization of Formula Elements in a CSV File in Gradio Flagging
- GHSA-2xhg-w2g5-w95x — CSV Injection in symfony/serializer
- GHSA-h7vq-5qgw-jwwq — CSV Injection Vulnerability
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor