CVE-2021-41270: Prevent CSV Injection via formulas

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.

                Sponsor the Symfony project.

https://symfony.com/blog/cve-2021-41270-prevent-csv-injection-via-formulas?utm_source=Symfony%20Blog%20Feed&utm_medium=feed

Établi 3y | 24 nov. 2021 à 09:20:09


Connectez-vous pour ajouter un commentaire

Autres messages de ce groupe

SymfonyLive Paris 2025 : Développer plus vite grâce à FrankenPHP

SymfonyLive Paris 2025, conference in French language only, will take place from March 27 to 28! The schedule is currently being revealed as we go along. More details are available here.

Al

28 janv. 2025 à 08:10:10 | Symfony
SymfonyLive Berlin 2025: Announcement of workshops topics!

SymfonyLive Berlin 2025, conference held in English, will take place from April 1 to 4! The full schedule is available here. Today, is the last day to enjoy tickets at "regular" price, enjoy i

27 janv. 2025 à 18:20:10 | Symfony
A Week of Symfony #943 (20-26 January 2025)

This week, the upcoming Symfony 7.3 version improved the invokable command feature, deprecated the use of option arrays for configuring validation constraints, and updated the JsonEncoder component to

26 janv. 2025 à 12:10:08 | Symfony
SymfonyLive Berlin 2025: Need a MACH-ready Search Engine?

SymfonyLive Berlin 2025, conference held in English, will take place from April 1 to 4! The schedule is being revealed gradually. More details are available here.

As we are now unveiling th

24 janv. 2025 à 11:20:16 | Symfony
SymfonyLive Paris 2025 : Rôles & permissions : développez une marque blanche avec du Feature Flipping

SymfonyLive Paris 2025, conference in French language only, will take place from March 27 to 28! The schedule is currently being revealed as we go along. More details are available here.

Al

23 janv. 2025 à 16:50:03 | Symfony
SymfonyLive Berlin 2025: So you think you know PHPUnit

SymfonyLive Berlin 2025, conference held in English, will take place from April 1 to 4! The schedule is being revealed gradually. More details are available here.

First, a big thank you to

22 janv. 2025 à 08:20:10 | Symfony
SymfonyLive Paris 2025 : Passkeys pour une authentification fluide et sécurisée

SymfonyLive Paris 2025, conference in French language only, will take place from March 27 to 28! The schedule is currently being revealed as we go along. More details are available here.

To

21 janv. 2025 à 11:30:10 | Symfony