Phar object injection in PHPMailer
Published 5 Mar 2020 · Updated 21 Feb 2024
Affected packages
- Affected
- >=5.0.0 <5.2.27
- Fixed in
- 5.2.27
composer require phpmailer/phpmailer:^5.2.27- Affected
- >=6.0.0 <6.0.6
- Fixed in
- 6.0.6
composer require phpmailer/phpmailer:^6.0.6Details
PHPMailer versions prior to 6.0.6 and 5.2.27 are vulnerable to an object injection attack by passing phar:// paths into addAttachment() and other functions that may receive unfiltered local paths, possibly leading to RCE. See this article for more info on this type of vulnerability. Mitigated by blocking the use of paths containing URL-protocol style prefixes such as phar://. Reported by Sehun Oh of cyberone.kr.
Impact
Object injection, possible remote code execution
Patches
Fixed in 6.0.6 and 5.2.27
Workarounds
Validate and sanitise user input before using.
References
https://nvd.nist.gov/vuln/detail/CVE-2018-19296
For more information
If you have any questions or comments about this advisory:
- Open a private issue in the PHPMailer project
Is GHSA-7w4p-72j7-v7c2 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected phpmailer/phpmailer, and gives you the command that fixes it.
References
- Linkgithub.com/PHPMailer/PHPMailer/security/advisories/GHSA-7w4p-72j7-v7c2
- Advisorynvd.nist.gov/vuln/detail/CVE-2018-19296
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2018-19296.yaml
- Linkgithub.com/PHPMailer/PHPMailer/releases/tag/v5.2.27
- Linkgithub.com/PHPMailer/PHPMailer/releases/tag/v6.0.6
- Linklists.debian.org/debian-lts-announce/2018/12/msg00020.html
- Linklists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3B5WDPGUFNPG4NAZ6G4BZX43BKLAVA5B
- Linklists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KPU66INRFY5BQ3ESVPRUXJR4DXQAFJVT
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3B5WDPGUFNPG4NAZ6G4BZX43BKLAVA5B
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KPU66INRFY5BQ3ESVPRUXJR4DXQAFJVT
- Linkwww.debian.org/security/2018/dsa-4351
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.