Phar object injection in PHPMailer
Impact
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.
Source excerpt · OSVMitigated by blocking the use of paths containing URL-protocol style prefixes such as phar://.
Affected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| From 5.0.0 before 5.2.27Ecosystem versions | 5.2.27 |
| From 6.0.0 before 6.0.6Ecosystem versions | 6.0.6 |
Version evidence: OSV · GHSA-7w4p-72j7-v7c2
View original version evidence (30 explicit versions)
Original source description
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
References
- Security advisory github.com/PHPMailer/PHPMailer/security/advisories/GHSA-7w4p-72j7-v7c2
- Security advisory nvd.nist.gov/vuln/detail/CVE-2018-19296
- Security advisory github.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2018-19296.yaml
- Release notes github.com/PHPMailer/PHPMailer/releases/tag/v5.2.27
- Release notes github.com/PHPMailer/PHPMailer/releases/tag/v6.0.6
- Source reference lists.debian.org/debian-lts-announce/2018/12/msg00020.html
- Source reference lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3B5WDPGUFNPG4NAZ6G4BZX43BKLAVA5B
- Source reference lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KPU66INRFY5BQ3ESVPRUXJR4DXQAFJVT
- Source reference lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3B5WDPGUFNPG4NAZ6G4BZX43BKLAVA5B
- Source reference lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KPU66INRFY5BQ3ESVPRUXJR4DXQAFJVT
- Security advisory www.debian.org/security/2018/dsa-4351