Descrizione
CsvEncoder::decode() splits each header cell on the key separator, . by default, and nests the decoded rows one level per separator, with no limit. PHP frees nested arrays recursively, so freeing data that is nested deeply enough overflows the C stack and crashes the process. With a stack of 8 MB, a CSV body of 448 KB is enough. Each row also builds all the levels of its headers again. With a deep header, a CSV body of 2 KB made of short rows allocates more than 128 MB. A body of 1 MB keeps the CPU busy for 10 seconds or more. Any code that decodes untrusted CSV with the Serializer is affected. From Symfony 7.4.0, this included every #[MapRequestPayload] argument that doesn't restrict acceptFormat, until 7.4.23 and 8.1.11 stopped decoding CSV payloads by default. CSV headers can now be nested up to 512 levels, the default depth of json_decode(). Decoding also stops when the rows go through more than 16 header levels, or create more than 4 arrays, per byte of data. A header row of up to 5 levels always fits, whatever the rows contain. Beyond these limits, decode() throws a NotEncodableValueException, which #[MapRequestPayload] turns into a 400 response.
Come correggere
Priorità: Media — correggere nel prossimo ciclo di patch. Motivazione: CVSS 8.7, EPSS 0.6% (percentile 45).
Versioni da aggiornare
- Symfony symfony/serializer: vulnerabili le versioni precedenti alla
5.4.57→ aggiornare alla5.4.57o successiva. - Symfony symfony/serializer: vulnerabili le versioni dalla
6.0.0precedenti alla6.4.51→ aggiornare alla6.4.51o successiva. - Symfony symfony/serializer: vulnerabili le versioni dalla
7.0.0precedenti alla7.4.24→ aggiornare alla7.4.24o successiva. - Symfony symfony/serializer: vulnerabili le versioni dalla
8.0.0precedenti alla8.1.12→ aggiornare alla8.1.12o successiva. - Symfony symfony/symfony: vulnerabili le versioni precedenti alla
5.4.57→ aggiornare alla5.4.57o successiva. - Symfony symfony/symfony: vulnerabili le versioni dalla
6.0.0precedenti alla6.4.51→ aggiornare alla6.4.51o successiva. - Symfony symfony/symfony: vulnerabili le versioni dalla
7.0.0precedenti alla7.4.24→ aggiornare alla7.4.24o successiva. - Symfony symfony/symfony: vulnerabili le versioni dalla
8.0.0precedenti alla8.1.12→ aggiornare alla8.1.12o successiva.
Mitigazioni temporanee
Da applicare solo se non è possibile aggiornare subito:
- Applicare rate limiting e limiti sulle risorse a monte del servizio e monitorarne la disponibilità.
Verifica
- Individuare tutti gli asset con il prodotto interessato (inventario, scanner di vulnerabilità, CMDB).
- Confrontare la versione installata con quelle indicate sopra.
- Applicare l'aggiornamento in un ambiente di test, poi in produzione; riavviare i servizi se richiesto.
- Ripetere la scansione per confermare la correzione.
Configurazioni interessate
| Vendor | Prodotto | Versioni vulnerabili | Corretta in |
|---|---|---|---|
| Symfony | symfony/serializer | < 5.4.57 | 5.4.57 |
| Symfony | symfony/serializer | ≥ 6.0.0 < 6.4.51 | 6.4.51 |
| Symfony | symfony/serializer | ≥ 7.0.0 < 7.4.24 | 7.4.24 |
| Symfony | symfony/serializer | ≥ 8.0.0 < 8.1.12 | 8.1.12 |
| Symfony | symfony/symfony | < 5.4.57 | 5.4.57 |
| Symfony | symfony/symfony | ≥ 6.0.0 < 6.4.51 | 6.4.51 |
| Symfony | symfony/symfony | ≥ 7.0.0 < 7.4.24 | 7.4.24 |
| Symfony | symfony/symfony | ≥ 8.0.0 < 8.1.12 | 8.1.12 |