CVE-2021-34551
Remote Code Execution vulnerability in PHPMailer 6.4.1 running on Windows
PHPMailer before 6.5.0 on Windows allows remote code execution if lang_path is untrusted data and has a UNC pathname.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
8.1
PHPMailer before 6.5.0 on Windows allows remote code execution if lang_path is untrusted data and has a UNC pathname.
- Record
CVE-2021-34551- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 5.1 Medium
AV:N/AC:H/Au:N/C:P/I:P/A:P - Weakness
- CWE-434
- Updated
- 2026-11-02
CVE List No score
PHPMailer before 6.5.0 on Windows allows remote code execution if lang_path is untrusted data and has a UNC pathname.
- Record
CVE-2021-34551- Updated
- 2026-11-02
EUVDEUVD-2021-1283 No score
PHPMailer before 6.5.0 on Windows allows remote code execution if lang_path is untrusted data and has a UNC pathname.
- Record
EUVD-2021-1283- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-7q44-r25x-wm4q
8.1
Remote Code Execution vulnerability in PHPMailer 6.4.1 running on Windows
PHPMailer 6.4.1 contains a possible remote code execution vulnerability through the $lang_path parameter of the setLanguage() method. If the $lang_path parameter is passed unfiltered from user input, it can be set to a UNC path, and if an attacker is also able to create a remote mount on the server that the UNC path points to, a script file under their control may be executed.
Impact
Arbitrary code may be run by a remote attacker under the web server or PHP process running on Window hosts.
Patches
Mitigated in PHPMailer 6.5.0 by no longer treating translation files as PHP code, but by parsing their text content directly. This approach avoids the possibility of executing unknown code while retaining backward compatibility. This isn't ideal, so the current translation format is deprecated and will be replaced in the next major release.
Workarounds
Any of:
- Ensure that calling code does not pass unfiltered user-supplied data to the
$lang_pathparameter of thesetLanguage()method. - Block or filter the use of unknown UNC paths in this parameter (or altogether).
- Ensure that unauthorised users do not have the ability to read from unknown remote servers via UNC paths.
- Run on an OS that does not support UNC paths
References
Reported by listensec.com via Tidelift.
For more information
If you have any questions or comments about this advisory:
- Open an issue in PHPMailer
- Email the maintainers
- Record
GHSA-7q44-r25x-wm4q- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-94, CWE-434
- Updated
- 2026-11-02
OSV
8.1
PHPMailer before 6.5.0 on Windows allows remote code execution if lang_path is untrusted data and has a UNC pathname.
- Record
CVE-2021-34551- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVGHSA-7q44-r25x-wm4q
8.1
Remote Code Execution vulnerability in PHPMailer 6.4.1 running on Windows
PHPMailer 6.4.1 contains a possible remote code execution vulnerability through the $lang_path parameter of the setLanguage() method. If the $lang_path parameter is passed unfiltered from user input, it can be set to a UNC path, and if an attacker is also able to create a remote mount on the server that the UNC path points to, a script file under their control may be executed.
Impact
Arbitrary code may be run by a remote attacker under the web server or PHP process running on Window hosts.
Patches
Mitigated in PHPMailer 6.5.0 by no longer treating translation files as PHP code, but by parsing their text content directly. This approach avoids the possibility of executing unknown code while retaining backward compatibility. This isn't ideal, so the current translation format is deprecated and will be replaced in the next major release.
Workarounds
Any of:
- Ensure that calling code does not pass unfiltered user-supplied data to the
$lang_pathparameter of thesetLanguage()method. - Block or filter the use of unknown UNC paths in this parameter (or altogether).
- Ensure that unauthorised users do not have the ability to read from unknown remote servers via UNC paths.
- Run on an OS that does not support UNC paths
References
Reported by listensec.com via Tidelift.
For more information
If you have any questions or comments about this advisory:
- Open an issue in PHPMailer
- Email the maintainers
- Record
GHSA-7q44-r25x-wm4q- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-434, CWE-94
- Updated
- 2026-11-02
OSVBIT-phpmailer-2021-34551 No score
PHPMailer before 6.5.0 on Windows allows remote code execution if lang_path is untrusted data and has a UNC pathname.
- Record
BIT-phpmailer-2021-34551- Updated
- 2026-11-02
OSVCLSA-2026-1771375983 No score
TuxCare security update for phpmailer/phpmailer (3 CVEs)
TuxCare rebuilt phpmailer/phpmailer to address 3 CVEs. Fixed in 5.2.28-p1+tuxcare.
- Record
CLSA-2026-1771375983- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
phpmailer/phpmailerPackagist |
before 6.5.0 | 6.5.0 |
phpmailerBitnami |
before 6.5.0 | 6.5.0 |
phpmailer/phpmailerTuxCare:Packagist From an advisory covering 3 CVEs |
5.2.28 up to 5.2.28-p1+tuxcare | 5.2.28-p1+tuxcare |
phpmailer/phpmailerPackagist |
before 6.5.0, plus listed versions v5.2.10v5.2.11v5.2.12v5.2.13v5.2.14 Show 45 moreShow lessv5.2.15v5.2.16v5.2.17v5.2.18v5.2.19v5.2.2v5.2.20v5.2.21v5.2.22v5.2.23v5.2.24v5.2.25v5.2.26v5.2.27v5.2.28v5.2.4v5.2.5v5.2.6v5.2.7v5.2.8v5.2.9v6.0.0v6.0.0rc1v6.0.0rc2v6.0.0rc3v6.0.0rc4v6.0.0rc5v6.0.1v6.0.2v6.0.3v6.0.4v6.0.5v6.0.6v6.0.7v6.1.0v6.1.1v6.1.2v6.1.3v6.1.4v6.1.5v6.1.6v6.1.7v6.1.8v6.2.0v6.3.0 |
6.5.0 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-34551 is a high vulnerability (CVSS 8.1) in Phpmailer Project Phpmailer, published June 16, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 2.80%, the 86th percentile. Fixed in phpmailer/phpmailer 6.5.0.
References
github.com/PHPMailer/PHPMailer/blob/master/SECURITY.md
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FJYSOFCUBS67J3TKR74SD3C454N7VTYM
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3YRMWGA4VTMXFB22KICMB7YMFZNFV3EJ
github.com/PHPMailer/PHPMailer/security/advisories/GHSA-7q44-r25x-wm4q
nvd.nist.gov/vuln/detail/CVE-2021-34551
github.com/PHPMailer/PHPMailer/commit/acd264bf17ff4ac5c915f0d4226dce8a9ea70bc3
Show 5 moreShow less
lists.fedoraproject.org/archives/list/[email protected]/message/3YRMWGA4VTMXFB22KICMB7YMFZNFV3EJ
lists.fedoraproject.org/archives/list/[email protected]/message/FJYSOFCUBS67J3TKR74SD3C454N7VTYM
github.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2021-34551.yaml
github.com/PHPMailer/PHPMailer/releases/tag/v6.5.0
github.com/advisories/GHSA-7q44-r25x-wm4q
Left out here: 2 versions. The JSON record has them.