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

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). 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
    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

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.