# CVE-2024-28859: Gadget chain in Symfony 1 due to vulnerable Swift Mailer dependency

> An attacker can achieve remote code execution if a developer unserializes untrusted user input, exploiting a gadget chain in the bundled Swift Mailer dependency.

- **Severity:** Medium 5.0 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 Mar 2024
- **Updated:** 15 Aug 2024
- **Also known as:** CLSA-2026-1768352248, GHSA-wjv8-pxr6-5f4r

## What is CVE-2024-28859?

CVE-2024-28859 is a medium-severity unsafe deserialization vulnerability in FriendsOfSymfony1 symfony1, published on 15 Mar 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Symfony1 is a community fork of symfony 1.4 with DIC, form enhancements, latest Swiftmailer, better performance, composer compatible and PHP 8 support. Symfony 1 has a gadget chain due to vulnerable Swift Mailer dependency that would enable an attacker to get remote code execution if a developer unserialize user input in his project. This vulnerability present no direct threat but is a vector that will enable remote code execution if a developper deserialize user untrusted data. Symfony 1 depends on Swift Mailer which is bundled by default in vendor directory in the default installation since 1.3.0. Swift Mailer classes implement some `__destruct()` methods. These methods are called when php destroys the object in memory. However, it is possible to include any object type in `$this->_keys` to make PHP access to another array/object properties than intended by the developer. In particular, it is possible to abuse the array access which is triggered on foreach($this->_keys ...) for any class implementing ArrayAccess interface. This may allow an attacker to execute any PHP command which leads to remote code execution. This issue has been addressed in version 1.5.18. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2024-28859?

8 open source packages ship an affected version, including friendsofsymfony1/swiftmailer, friendsofsymfony1/symfony1 and swiftmailer/swiftmailer. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `friendsofsymfony1/swiftmailer` | Packagist | From 4.0.0 | 5.4.13 |
| `friendsofsymfony1/swiftmailer` | Packagist | From 4.0.0 | 5.4.13 |
| `friendsofsymfony1/swiftmailer` | Packagist | From 6.0.0 | 6.2.5 |
| `friendsofsymfony1/swiftmailer` | Packagist | From 6.0.0 | 6.2.5 |
| `friendsofsymfony1/symfony1` | Packagist | From 1.3.0 | 1.5.18 |
| `friendsofsymfony1/symfony1` | Packagist | From 1.3.0 | 1.5.18 |
| `swiftmailer/swiftmailer` | Packagist | From 4.0.0 | 6.2.5 |
| `swiftmailer/swiftmailer` | Packagist | From 4.0.0 | 6.2.5 |

Products: Friendsofsymfony1 Symfony1.

## How do I fix CVE-2024-28859?

Upgrade friendsofsymfony1/swiftmailer to a fixed version for your release line: 5.4.13 or 6.2.5.

## Is CVE-2024-28859 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-28859 exists.

## Other vulnerabilities in FriendsOfSymfony1 symfony1

- [CVE-2024-28861](https://insights.sbomify.com/CVE-2024-28861/): Gadget chain in Symfony 1 due to uncontrolled unserialized input in sfNamespacedParameterHolder (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-28859 and fix it if it is affected.

What it is: CVE-2024-28859 is a medium-severity unsafe deserialization vulnerability in FriendsOfSymfony1 symfony1, published on 15 Mar 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-28859 exists.

Affected packages and fixed versions:
- friendsofsymfony1/swiftmailer (Packagist): affected from 4.0.0; fixed in 5.4.13
- friendsofsymfony1/swiftmailer (Packagist): affected from 4.0.0; fixed in 5.4.13
- friendsofsymfony1/swiftmailer (Packagist): affected from 6.0.0; fixed in 6.2.5
- friendsofsymfony1/swiftmailer (Packagist): affected from 6.0.0; fixed in 6.2.5
- friendsofsymfony1/symfony1 (Packagist): affected from 1.3.0; fixed in 1.5.18
- friendsofsymfony1/symfony1 (Packagist): affected from 1.3.0; fixed in 1.5.18
- swiftmailer/swiftmailer (Packagist): affected from 4.0.0; fixed in 6.2.5
- swiftmailer/swiftmailer (Packagist): affected from 4.0.0; fixed in 6.2.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-28859/ (Markdown: https://insights.sbomify.com/CVE-2024-28859/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-28859
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-28859
- OSV: https://osv.dev/vulnerability/CVE-2024-28859

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-28859/
Summaries are generated and may contain mistakes; the official description above is the record.
