CVE-2021-41270 is a medium-severity (CVSS 6.5) CWE-1236 vulnerability in symfony/serializer. A fix is available for symfony/serializer — see the affected versions and patch details below.
CSV Injection in symfony/serializer
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-41270 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 385,738 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
symfony/serializer🐘symfony/serializer🐘symfony/symfony🐘symfony/symfonyReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Description
CSV Injection, also known as Formula Injection, occurs when websites embed untrusted input inside CSV files. When a spreadsheet program opens a CSV, any cell starting with = is interpreted by the software as a formula and could be abused by an attacker.
In Symfony 4.1, we've added the opt-in csv_escape_formulas option in CsvEncoder, to prefix all cells starting by =, +, - or @ by a tab \t.
Since then, OWASP added 2 chars in that list:
- Tab (0x09)
- Carriage return (0x0D)
This makes our previous prefix char (Tab \t) part of the vulnerable characters, and OWASP suggests using the single quote ' for prefixing the value.
Resolution
Symfony now follows the OWASP recommendations and use the single quote ' to prefix formulas and adds the prefix to cells starting by \t, \r as well as =, +, - and @.
The patch for this issue is available here for branch 4.4.
Credits
We would like to thank Jake Barwell for reporting the issue and Jérémy Derussé for fixing the issue.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | symfony/serializer | ≥ 5.0.0&&< 5.3.12 | 5.3.12composer require symfony/serializer:^5.3.12 |
| 🐘Packagist | symfony/serializer | ≥ 4.1.0&&< 4.4.35 | 4.4.35composer require symfony/serializer:^4.4.35 |
| 🐘Packagist | symfony/symfony | ≥ 4.1.0&&< 4.4.35 | 4.4.35composer require symfony/symfony:^4.4.35 |
| 🐘Packagist | symfony/symfony | ≥ 5.0.0&&< 5.3.12 | 5.3.12composer require symfony/symfony:^5.3.12 |
Affected Products
fedorafedoraprojectsymfonysensiolabsDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for symfony/serializer, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update symfony/serializer to 5.3.12 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-41270 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Frequently Asked Questions
Is CVE-2021-41270 in your dependencies?
Find it across Packagist, including transitive dependencies.