# CVE-2020-36326: Object injection in PHPMailer/PHPMailer

> Attacker can achieve code execution via Phar deserialization in PHPMailer when using addAttachment with a UNC pathname.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 28 Apr 2021
- **Updated:** 4 Aug 2024
- **Also known as:** BIT-phpmailer-2020-36326, BIT-wordpress-2020-36326, BIT-wordpress-multisite-2020-36326, DEBIAN-CVE-2020-36326, GHSA-m298-fh5c-jc66

## What is CVE-2020-36326?

CVE-2020-36326 is a critical unsafe deserialization vulnerability in Wordpress Wordpress, published on 28 Apr 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

PHPMailer 6.1.8 through 6.4.0 allows object injection through Phar Deserialization via addAttachment with a UNC pathname. NOTE: this is similar to CVE-2018-19296, but arose because 6.1.8 fixed a functionality problem in which UNC pathnames were always considered unreadable by PHPMailer, even in safe contexts. As an unintended side effect, this fix eliminated the code that blocked addAttachment exploitation.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2020-36326?

5 open source packages ship an affected version, including wordpress, phpmailer and wordpress-multisite. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `wordpress` | Bitnami | From 3.7.0 | 3.7.36, 3.8.36, 3.9.34, 4.0.33, 4.1.33, 4.2.30, 4.3.26, 4.4.25, 4.5.24, 4.6.21, 4.7.21, 4.8.17, 4.9.18, 5.0.13, 5.1.10, 5.2.11, 5.3.8, 5.4.6, 5.5.5, 5.6.4, 5.7.2 |
| `phpmailer` | Bitnami | From 6.1.8 | 6.4.1 |
| `wordpress-multisite` | Bitnami | From 3.7.0 | 3.7.36, 3.8.36, 3.9.34, 4.0.33, 4.1.33, 4.2.30, 4.3.26, 4.4.25, 4.5.24, 4.6.21, 4.7.21, 4.8.17, 4.9.18, 5.0.13, 5.1.10, 5.2.11, 5.3.8, 5.4.6, 5.5.5, 5.6.4, 5.7.2 |
| `phpmailer/phpmailer` | Packagist | From 6.1.8 | 6.4.1 |
| `phpmailer/phpmailer` | Packagist | From 6.1.8 | 6.4.1 |

Products: Phpmailer Project Phpmailer, Wordpress Wordpress.

## How do I fix CVE-2020-36326?

Upgrade wordpress to a fixed version for your release line: 3.7.36, 3.8.36, 3.9.34 or 4.0.33.

## Is CVE-2020-36326 being exploited?

There is no known exploitation of CVE-2020-36326 in the wild and no public exploit code.

## Other vulnerabilities in Wordpress Wordpress

- [CVE-2017-11503](https://insights.sbomify.com/CVE-2017-11503/): Cross-site scripting in PHPMailer (medium 6.1)
- [CVE-2017-5223](https://insights.sbomify.com/CVE-2017-5223/): Local file disclosure in PHPMailer (medium 5.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-36326 and fix it if it is affected.

What it is: CVE-2020-36326 is a critical unsafe deserialization vulnerability in Wordpress Wordpress, published on 28 Apr 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2020-36326 in the wild and no public exploit code.

Affected packages and fixed versions:
- wordpress (Bitnami): affected from 3.7.0; fixed in 3.7.36, 3.8.36, 3.9.34, 4.0.33, 4.1.33, 4.2.30, 4.3.26, 4.4.25, 4.5.24, 4.6.21, 4.7.21, 4.8.17, 4.9.18, 5.0.13, 5.1.10, 5.2.11, 5.3.8, 5.4.6, 5.5.5, 5.6.4, 5.7.2
- phpmailer (Bitnami): affected from 6.1.8; fixed in 6.4.1
- wordpress-multisite (Bitnami): affected from 3.7.0; fixed in 3.7.36, 3.8.36, 3.9.34, 4.0.33, 4.1.33, 4.2.30, 4.3.26, 4.4.25, 4.5.24, 4.6.21, 4.7.21, 4.8.17, 4.9.18, 5.0.13, 5.1.10, 5.2.11, 5.3.8, 5.4.6, 5.5.5, 5.6.4, 5.7.2
- phpmailer/phpmailer (Packagist): affected from 6.1.8; fixed in 6.4.1
- phpmailer/phpmailer (Packagist): affected from 6.1.8; fixed in 6.4.1

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-2020-36326/ (Markdown: https://insights.sbomify.com/CVE-2020-36326/index.md)
```

## Sources

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

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