Description
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.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | libphp-phpmailer | 5.2.14+dfsg-2.3 | — |
| Debian 13 | libphp-phpmailer | 5.2.14+dfsg-2.3 | — |
| Debian 12 | libphp-phpmailer | 5.2.14+dfsg-2.3 | — |
| Debian 8 | libphp-phpmailer | 5.2.9+dfsg-2+deb8u4 | DLA-1591-1 |
| Debian 7 | libphp-phpmailer | 5.1-1.3+deb7u1 | DLA-817-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 22.04 LTS | libphp-phpmailer | 6.2.0-2ubuntu0.1~esm1 | USN-5956-1 |
| Ubuntu Pro 20.04 LTS | libphp-phpmailer | 6.0.6-0.1ubuntu0.1~esm1 | USN-5956-1 |
| Ubuntu Pro 18.04 LTS | libphp-phpmailer | 5.2.14+dfsg-2.3+deb9u2ubuntu0.1~esm1 | USN-5956-1 |
Show 1 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 16.04 LTS | libphp-phpmailer | 5.2.14+dfsg-1ubuntu0.1~esm1 | USN-5956-1 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Exploit-DB 1
- PHPMailer < 5.2.21 - Local File Disclosure EDB-43056 · webapps · Oct 25, 2017
GitHub 1 repository
-
cscli/CVE-2017-5223 ★ 1 · Sep 26, 2018
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| Packagist | phpmailer/phpmailer | >= 5.0.0, < 5.2.22 | 5.2.22 | GHSA-4x5h-cr29-fhp6 |
Advisories 3
- USN-5956-1 libphp-phpmailer vulnerabilities Ubuntu Security Notices (USN) · Jun 25, 2026
- DLA-817-1 libphp-phpmailer - security update Debian Security (DSA / DLA) · Mar 9, 2026
- DLA-1591-1 libphp-phpmailer - security update Debian Security (DSA / DLA) · Mar 9, 2026