CVE-2017-5223: Phpmailer/phpmailer Local File Disclosure Vulnerability
MODERATECVE-2017-5223 is a MODERATE (CVSS 5.5) local file disclosure vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Phpmailer/phpmailer libraries in the Packagist ecosystem. The issue involves local file disclosure in phpmailer. Remediation is available by upgrading affected packages to version 5.2.22.
CVE-2017-5223 at a Glance
Security Impact
CVSS: 5.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2017-5223
To remediate this vulnerability, upgrade all affected Phpmailer/phpmailer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade phpmailer/phpmailer to 5.2.22
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for phpmailer/phpmailer
How to Check if You Are Affected
To determine whether your application is affected by CVE-2017-5223, inspect your project dependencies for Phpmailer/phpmailer:
inspect dependencies for phpmailer/phpmailer
Analyze the terminal output to locate any version of Phpmailer/phpmailer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.2.22), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Phpmailer/phpmailer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2017-5223 Affected Phpmailer/phpmailer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
phpmailer/phpmailer
|
Packagist |
≥ 5.0.0
< 5.2.22
|
5.2.22
|
References
Frequently Asked Questions
What is CVE-2017-5223?
Which Phpmailer/phpmailer versions are affected?
What version fixes CVE-2017-5223?
Is phpmailer/phpmailer affected?
What is the CVSS score of CVE-2017-5223?
What CWE is associated with CVE-2017-5223?
How can I check Packagist dependencies for CVE-2017-5223?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4x5h-cr29-fhp6",
"modified" : "2021-08-19T19:50:50Z",
"published" : "2020-03-05T22:09:10Z",
"aliases" : [ "CVE-2017-5223" ],
"summary" : "Local file disclosure in PHPMailer",
"details" : "An issue was discovered in PHPMailer before 5.2.22. PHPMailer's `msgHTML` method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to `/`, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.\n\n### Impact\nArbitrary local files can be attached to email messages.\n\n### Patches\nFixed in 5.2.22\n\n### Workarounds\nValidate input before using user-supplied file paths.\n\n### References\nhttps://nvd.nist.gov/vuln/detail/CVE-2017-5223\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open a private issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "phpmailer/phpmailer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0"
}, {
"fixed" : "5.2.22"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-4x5h-cr29-fhp6"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-5223"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2017-5223.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPMailer/PHPMailer/blob/master/SECURITY.md"
}, {
"type" : "WEB",
"url" : "https://github.com/PHPMailer/PHPMailer/releases/tag/v5.2.22"
}, {
"type" : "WEB",
"url" : "https://www.exploit-db.com/exploits/43056"
}, {
"type" : "WEB",
"url" : "http://kalilinux.co/2017/01/12/phpmailer-cve-2017-5223-local-information-disclosure-vulnerability-analysis"
}, {
"type" : "WEB",
"url" : "http://www.securityfocus.com/bid/95328"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2020-03-05T22:07:31Z",
"nvd_published_at" : null
}
}