Phar object injection in PHPMailer

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

Basic information

Type
reviewed
Severity
high
Advisory on GitHub
Open advisory ↗
Repository advisory
Open repository advisory ↗
Source code
Not specified
Published (advisory)
2020-03-05 22:08:55 UTC
Updated
2024-01-24 13:43:00 UTC
GitHub reviewed
2020-03-05 22:08:10 UTC
NVD published
2018-11-16

EPSS Score

Score Percentile
1.55% 81.44%

CVSS Scores

Base score Version Severity Vector
8.8 3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:H)
Could take the service down hard or make it unusable for people who depend on it.

Identifiers

CWEs

CWE id Name
CWE-502 Deserialization of Untrusted Data
CWE-915 Improperly Controlled Modification of Dynamically-Determined Object Attributes
CWE-1321 Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')

Affected packages (2)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
composer phpmailer/phpmailer >= 5.0.0, < 5.2.27 5.2.27
composer phpmailer/phpmailer >= 6.0.0, < 6.0.6 6.0.6

References

cvelogic Threat Intelligence