9.8critical
Object injection in PHPMailer/PHPMailer
- Severity
- 9.8critical CVSS:3.1 by NVD
- Exploit likelihood
- 3.18% (higher than 88% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-m298-fh5c-jc66BIT-PHPMAILER-2020-36326BIT-WORDPRESS-2020-36326BIT-WORDPRESS-MULTISITE-2020-36326
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| phpmailer/phpmailer (Packagist) | from 6.1.8 before 6.4.1 | GitHub Advisory Database |
| phpmailer_project phpmailer | from 6.1.8 up to 6.4.0 | NVD |
| wordpress wordpress | from 3.7 before 3.7.36, from 3.8 before 3.8.36, from 3.9 before 3.9.34, from 4.0 before 4.0.33, from 4.1 before 4.1.33, from 4.2 before 4.2.30, from 4.3 before 4.3.26, from 4.4 before 4.4.25 and 13 more | NVD |
| phpmailer (Bitnami) | from 6.1.8 before 6.4.1 | Bitnami Vulnerability Database |
| wordpress (Bitnami) | from 3.7.0 before 3.7.36, from 3.8.0 before 3.8.36, from 3.9.0 before 3.9.34, from 4.0.0 before 4.0.33, from 4.1.0 before 4.1.33, from 4.2.0 before 4.2.30, from 4.3.0 before 4.3.26, from 4.4.0 before 4.4.25 and 13 more | Bitnami Vulnerability Database |
| wordpress-multisite (Bitnami) | from 3.7.0 before 3.7.36, from 3.8.0 before 3.8.36, from 3.9.0 before 3.9.34, from 4.0.0 before 4.0.33, from 4.1.0 before 4.1.33, from 4.2.0 before 4.2.30, from 4.3.0 before 4.3.26, from 4.4.0 before 4.4.25 and 13 more | Bitnami Vulnerability Database |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.5high CVSS:2.0 | AV:N/AC:L/Au:N/C:P/I:P/A:P |
| Bitnami Vulnerability Database | critical rating |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
Impact
This is a reintroduction of an earlier issue (CVE-2018-19296) by an unrelated bug fix in PHPMailer 6.1.8. An external file may be unexpectedly executable if it is used as a path to an attachment file via PHP's support for .phar files. Exploitation requires that an attacker is able to provide an unfiltered path to a file to attach, or to trick calling code into generating one. See this article for more info.
Patches
This issue was patched in the PHPMailer 6.4.1 release. This release also implements stricter filtering for attachment paths; paths that look like any kind of URL are rejected.
Workarounds
Validate paths to loaded files using the same pattern as used in isPermittedPath() before using them in any PHP file function, such as file_exists. This method can't be used directly because it is protected, but you can implement the same thing in calling code. Note that this should be applied to all user-supplied paths passed into such functions; it's not a problem specific to PHPMailer.
Credit
This issue was found by Fariskhi Vidyan, reported and managed via Tidelift.
NVD (es)
PHPMailer versión 6.1.8 hasta la versión 6.4.0 permite la inyección de objetos a través de Phar Deserialization vía addAttachment con un nombre de ruta UNC. NOTA: esto es similar a CVE-2018-19296, pero surgió porque la versión 6.1.8 corrigió un problema de funcionalidad en el que los nombres de ruta UNC siempre se consideraban ilegibles por PHPMailer, incluso en contextos seguros. Como efecto secundario no intencionado, esta corrección eliminó el código que bloqueaba la explotación de addAttachment
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2020-36326 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-m298-fh5c-jc66 changed 2026-07-21 | CC-BY-4.0 |
| NVD | CVE-2020-36326 changed 2026-06-17 | Public domain |
| Bitnami Vulnerability Database | BIT-PHPMAILER-2020-36326 changed 2026-09-08 | Apache-2.0 |
| Bitnami Vulnerability Database | BIT-WORDPRESS-2020-36326 changed 2026-09-08 | Apache-2.0 |
| Bitnami Vulnerability Database | BIT-WORDPRESS-MULTISITE-2020-36326 changed 2026-09-08 | Apache-2.0 |