Every CVE Search/ Get API key

CVE-2017-5223

Local file disclosure in PHPMailer

5.5 MediumPublic exploitFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Local
Complexity
Low
Privileges needed
Low
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
None
Availability
None

Exploit likelihood

2.14%Down 2.4 points since Apr 14, 2021
90%50%10%1%

What each source reports

NVD Score used 5.5

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.

Record
CVE-2017-5223
CVSS 3.0
5.5 MediumCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
CVSS 2.0
2.1 LowAV:L/AC:L/Au:N/C:P/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
CVE List No score

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.

Record
CVE-2017-5223
Updated
2026-11-02
EUVDEUVD-2020-0329 No score

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.

Record
EUVD-2020-0329
Updated
2026-11-03
GitHub AdvisoriesGHSA-4x5h-cr29-fhp6 5.5

Local file disclosure in PHPMailer

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.

Impact

Arbitrary local files can be attached to email messages.

Patches

Fixed in 5.2.22

Workarounds

Validate input before using user-supplied file paths.

References

https://nvd.nist.gov/vuln/detail/CVE-2017-5223

For more information

If you have any questions or comments about this advisory:

Record
GHSA-4x5h-cr29-fhp6
CVSS 3.0
5.5 MediumCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
OSV 5.5

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.

Record
CVE-2017-5223
CVSS 3.0
5.5 MediumCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02
OSVDEBIAN-CVE-2017-5223 5.5

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.

Record
DEBIAN-CVE-2017-5223
CVSS 3.0
5.5 MediumCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02
Show 4 moreShow less
OSVGHSA-4x5h-cr29-fhp6 5.5

Local file disclosure in PHPMailer

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.

Impact

Arbitrary local files can be attached to email messages.

Patches

Fixed in 5.2.22

Workarounds

Validate input before using user-supplied file paths.

References

https://nvd.nist.gov/vuln/detail/CVE-2017-5223

For more information

If you have any questions or comments about this advisory:

Record
GHSA-4x5h-cr29-fhp6
CVSS 3.0
5.5 MediumCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
OSVUBUNTU-CVE-2017-5223 5.5

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.

Record
UBUNTU-CVE-2017-5223
CVSS 3.0
5.5 MediumCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02
OSVMGASA-2017-0022 No score

Updated php-phpmailer packages fix security vulnerabilities

It was discovered that PHPMailer, a popular library to send email from PHP applications, allowed a remote attacker to execute code if they were able to provide a crafted Sender address (CVE-2016-10033).

It was discovered that PHPMailer prior to 5.2.22 contained a local file disclosure vulnerability if content passed to msgHTML() was sourced from unfiltered user input (CVE-2017-5223).

Record
MGASA-2017-0022
Updated
2026-11-02
OSVUSN-5956-1 No score

libphp-phpmailer vulnerabilities

Dawid Golunski discovered that PHPMailer was not properly escaping user input data used as arguments to functions executed by the system shell. An attacker could possibly use this issue to execute arbitrary code. This issue only affected Ubuntu 16.04 ESM. (CVE-2016-10033, CVE-2016-10045)

It was discovered that PHPMailer was not properly escaping characters in certain fields of the code_generator.php example code. An attacker could possibly use this issue to conduct cross-site scripting (XSS) attacks. This issue was only fixed in Ubuntu 16.04 ESM and Ubuntu 18.04 ESM. (CVE-2017-11503)

Yongxiang Li discovered that PHPMailer was not properly converting relative paths provided as user input when adding attachments to messages, which could lead to relative image URLs being treated as absolute local file paths and added as attachments. An attacker could possibly use this issue to access unauthorized resources and expose sensitive information. This issue only affected Ubuntu 16.04 ESM. (CVE-2017-5223)

Sehun Oh discovered that PHPMailer was not properly processing untrusted non-local file attachments, which could lead to an object injection. An attacker could possibly use this issue to execute arbitrary code. This issue only affected Ubuntu 16.04 ESM. (CVE-2018-19296)

Elar Lang discovered that PHPMailer was not properly escaping file attachment names, which could lead to a misinterpretation of file types by entities processing the message. An attacker could possibly use this issue to bypass attachment filters. This issue was only fixed in Ubuntu 16.04 ESM and Ubuntu 20.04 ESM. (CVE-2020-13625)

It was discovered that PHPMailer was not properly handling callables in its validateAddress function, which could result in untrusted code being called should the global namespace contain a function called 'php'. An attacker could possibly use this issue to execute arbitrary code. This issue was only fixed in Ubuntu 20.04 ESM and Ubuntu 22.04 ESM. (CVE-2021-3603)

Record
USN-5956-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
phpmailer/phpmailer
Packagist
5.0.0 up to 5.2.22
5.2.22
libphp-phpmailer
Debian:12
before 5.2.14+dfsg-2.3
5.2.14+dfsg-2.3
libphp-phpmailer
Debian:13
before 5.2.14+dfsg-2.3
5.2.14+dfsg-2.3
libphp-phpmailer
Debian:14
before 5.2.14+dfsg-2.3
5.2.14+dfsg-2.3
libphp-phpmailer
Debian:8
before 5.2.9+dfsg-2+deb8u4, plus listed versions
5.2.9+dfsg-25.2.9+dfsg-2+deb8u15.2.9+dfsg-2+deb8u25.2.9+dfsg-2+deb8u3
5.2.9+dfsg-2+deb8u4
libphp-phpmailer
Debian:7
before 5.1-1.3+deb7u1, plus listed versions
5.1-15.1-1.15.1-1.25.1-1.3
5.1-1.3+deb7u1
phpmailer/phpmailer
Packagist
5.0.0 up to 5.2.22, plus listed versions
v5.2.10v5.2.11v5.2.12v5.2.13v5.2.14
Show 14 moreShow less
v5.2.15v5.2.16v5.2.17v5.2.18v5.2.19v5.2.2v5.2.20v5.2.21v5.2.4v5.2.5v5.2.6v5.2.7v5.2.8v5.2.9
5.2.22
php-phpmailer
Mageia:5
before 5.2.22-1.mga5
5.2.22-1.mga5
libphp-phpmailer
Ubuntu:Pro:16.04:LTS
before 5.2.14+dfsg-1ubuntu0.1~esm1, plus listed versions
5.2.10+dfsg-15.2.14+dfsg-15.2.14+dfsg-1build1
5.2.14+dfsg-1ubuntu0.1~esm1
libphp-phpmailer
Ubuntu:Pro:18.04:LTS
before 5.2.14+dfsg-2.3+deb9u2ubuntu0.1~esm1, plus listed versions
5.2.14+dfsg-2.35.2.14+dfsg-2.3+deb9u1build0.18.04.15.2.14+dfsg-2.3+deb9u2build0.18.04.1
5.2.14+dfsg-2.3+deb9u2ubuntu0.1~esm1
libphp-phpmailer
Ubuntu:Pro:20.04:LTS
before 6.0.6-0.1ubuntu0.1~esm1, plus listed versions
6.0.6-0.1
6.0.6-0.1ubuntu0.1~esm1
libphp-phpmailer
Ubuntu:Pro:22.04:LTS
before 6.2.0-2ubuntu0.1~esm1, plus listed versions
6.2.0-2
6.2.0-2ubuntu0.1~esm1

Public exploits

Links only. Every CVE stores no exploit code.

Public exploits
SourceLinkDate
Exploit-DBPHPMailer < 5.2.21 - Local File Disclosure2017-10-25
PoC in GitHubcscli/CVE-2017-52232018-09-26

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE List, Exploit-DB, GitHub Advisories, NVD, OSV, PoC in GitHub

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2017-5223 is a medium vulnerability (CVSS 5.5) in Phpmailer Project Phpmailer, published January 16, 2017. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 2.14%, the 82nd percentile. Fixed in phpmailer/phpmailer 5.2.22.

References

Show 17 moreShow less
MoveEnter Open