# CVE-2020-36326: PHPMailer object injection in attachment processing

Source: https://junglewise.ai/threats/cve-2020-36326-phpmailer-object-injection-in-attachment-processing  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2021-05-04. Updated: 2026-07-01  
License: CC BY 4.0 with a link back

CVE-2020-36326 · Severity: critical · CVSS 9.8 · Published 2021-05-04

PHPMailer, a widely used library for sending emails in PHP applications, contains a vulnerability that could allow an attacker to execute malicious code on a server. By providing a specially crafted file path for an email attachment, an attacker can trigger the execution of hidden code within that file. This could lead to a full system takeover, data theft, or disruption of services.

Technologies: [phpmailer/phpmailer (Packagist)](https://junglewise.ai/threats/technologies/phpmailer-phpmailer). Vendors: [Packagist](https://junglewise.ai/threats/vendors/packagist).

## Quick answers

**Is CVE-2020-36326 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2020-36326 being exploited in the wild.

**How severe is CVE-2020-36326?** Critical severity, with a CVSS score of 9.8, published 4 May 2021.

**Which products and versions are affected?** phpmailer/phpmailer (Packagist) >= 6.1.8, < 6.4.1, ECOSYSTEM:introduced=6.1.8,fixed=6.4.1.

**Is there a fix for CVE-2020-36326?** Yes. phpmailer/phpmailer (Packagist): upgrade to 6.4.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2020-36326 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2020-36326?** Check whether you run phpmailer/phpmailer (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- phpmailer/phpmailer (Packagist): upgrade to 6.4.1 or later

  ```sh
  composer require phpmailer/phpmailer:^6.4.1
  ```


## Technical details

PHPMailer versions 6.1.8 through 6.4.0 are vulnerable to PHP object injection due to improper validation of attachment file paths. The vulnerability is a reintroduction of CVE-2018-19296 and occurs when an attacker can provide an unfiltered path using the 'phar://' wrapper to a file function like 'file_exists'. When PHP's Phar wrapper processes a file, it automatically deserializes metadata, which can be leveraged for remote code execution if a suitable POP chain exists in the application. The issue was addressed in version 6.4.1 by implementing stricter filtering that rejects paths resembling URLs or stream wrappers.

## Affected products

- PHPMailer PHPMailer >= 6.1.8, < 6.4.1

## Identifiers

- CVE-2020-36326
- GHSA-m298-fh5c-jc66

## Timeline

- 2021-04-28: advisory: NVD published date
- 2021-04-29: patched: PHPMailer 6.4.1 released
- 2021-05-04: disclosed: GitHub Advisory published

## References

- [https://api.github.com/users/farisv](https://api.github.com/users/farisv)
- [https://github.com/farisv](https://github.com/farisv)
- [https://api.github.com/users/farisv/gists%7B/gist_id%7D](https://api.github.com/users/farisv/gists%7B/gist_id%7D)
- [https://api.github.com/users/farisv/repos](https://api.github.com/users/farisv/repos)
- [https://avatars.githubusercontent.com/u/44131180?v=4](https://avatars.githubusercontent.com/u/44131180?v=4)
- [https://api.github.com/users/farisv/events%7B/privacy%7D](https://api.github.com/users/farisv/events%7B/privacy%7D)

## Related threats

- [PHPMailer Local file inclusion](https://junglewise.ai/threats/cve-2006-5734-phpmailer-local-file-inclusion)
- [PHPMailer Shell command injection](https://junglewise.ai/threats/cve-2007-3215-phpmailer-shell-command-injection)
- [PHPMailer vulnerable to email header injection](https://junglewise.ai/threats/cve-2012-0796-phpmailer-vulnerable-to-email-header-injection)
- [PHPMailer susceptible to arbitrary code execution](https://junglewise.ai/threats/cve-2008-5619-phpmailer-susceptible-to-arbitrary-code-execution)
- [PHPMailer untrusted code may be run from an overridden address validator](https://junglewise.ai/threats/cve-2021-3603-phpmailer-untrusted-code-may-be-run-from-an-overridden-address)
