Every CVE Search/ Get API key

CVE-2021-3603

Inclusion of Functionality from Untrusted Control Sphere in PHPMailer/PHPMailer

8.1 HighFix available

CVE-2021-3603 is a high vulnerability (CVSS 8.1) in Phpmailer, published June 17, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 2.26%, the 82nd percentile. Fixed in phpmailer/phpmailer 6.5.0.

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

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

2.26%Up 1.6 points since Jun 19, 2021
90%50%10%1%

What each source reports

CVE List Score used 8.1

Inclusion of Functionality from Untrusted Control Sphere in PHPMailer/PHPMailer

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

Record
CVE-2021-3603
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-829
Updated
2026-11-02
EUVDEUVD-2021-1277 8.1

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

Record
EUVD-2021-1277
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-03
GitHub AdvisoriesGHSA-77mr-wc79-m8j3 8.1

PHPMailer untrusted code may be run from an overridden address validator

If a function is defined that has the same name as the default built-in email address validation scheme (php), it will be called in default configuration as when no validation scheme is provided, the default scheme's callable php was being called. If an attacker is able to inject such a function into the application (a much bigger issue), it will be called whenever an email address is validated, such as when calling validateAddress().

Impact

Low impact – exploitation requires that an attacker can already inject code into an application, but it provides a trigger pathway.

Patches

This is patched in PHPMailer 6.5.0 by denying the use of simple strings as validator function names, which is a very minor BC break.

Workarounds

Inject your own email validator function.

References

Reported by Vikrant Singh Chauhan via huntr.dev. CVE-2021-3603

For more information

If you have any questions or comments about this advisory:

Record
GHSA-77mr-wc79-m8j3
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-74, CWE-829
Updated
2026-11-02
NVD 8.1

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

Record
CVE-2021-3603
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
6.8 MediumAV:N/AC:M/Au:N/C:P/I:P/A:P
Weakness
CWE-829
Updated
2026-11-02
OSV 8.1

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

Record
CVE-2021-3603
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVDEBIAN-CVE-2021-3603 8.1

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

Record
DEBIAN-CVE-2021-3603
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
Show 6 moreShow less
OSVGHSA-77mr-wc79-m8j3 8.1

PHPMailer untrusted code may be run from an overridden address validator

If a function is defined that has the same name as the default built-in email address validation scheme (php), it will be called in default configuration as when no validation scheme is provided, the default scheme's callable php was being called. If an attacker is able to inject such a function into the application (a much bigger issue), it will be called whenever an email address is validated, such as when calling validateAddress().

Impact

Low impact – exploitation requires that an attacker can already inject code into an application, but it provides a trigger pathway.

Patches

This is patched in PHPMailer 6.5.0 by denying the use of simple strings as validator function names, which is a very minor BC break.

Workarounds

Inject your own email validator function.

References

Reported by Vikrant Singh Chauhan via huntr.dev. CVE-2021-3603

For more information

If you have any questions or comments about this advisory:

Record
GHSA-77mr-wc79-m8j3
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-74, CWE-829
Updated
2026-11-02
OSVUBUNTU-CVE-2021-3603 8.1

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

Record
UBUNTU-CVE-2021-3603
CVSS 3.1
8.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVBIT-phpmailer-2021-3603 No score

Inclusion of Functionality from Untrusted Control Sphere in PHPMailer/PHPMailer

PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the $patternselect parameter to validateAddress() is set to 'php' (the default, defined by PHPMailer::$validator), and the global namespace contains a function called php, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names.

Record
BIT-phpmailer-2021-3603
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
OSVMGASA-2021-0345 No score

Updated php-phpmailer package fixes security vulnerability

PHPMailer contained a vulnerability that can result in untrusted code being called (CVE-2021-3603).

See upstream release notes.

Record
MGASA-2021-0345
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
before 6.5.0
6.5.0
phpmailer
Bitnami
before 6.4.2
6.4.2
phpmailer/phpmailer
TuxCare:Packagist
5.2.28 up to 5.2.28-p1+tuxcare
5.2.28-p1+tuxcare
libphp-phpmailer
Debian:12
before 6.6.3-1
6.6.3-1
libphp-phpmailer
Debian:13
before 6.6.3-1
6.6.3-1
libphp-phpmailer
Debian:14
before 6.6.3-1
6.6.3-1
phpmailer/phpmailer
Packagist
before 6.5.0, plus listed versions
v5.2.10v5.2.11v5.2.12v5.2.13v5.2.14
Show 45 moreShow less
v5.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
php-phpmailer
Mageia:7
before 6.5.0-1.mga7
6.5.0-1.mga7
php-phpmailer
Mageia:8
before 6.5.0-1.mga8
6.5.0-1.mga8
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
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

History

History
WhenChangedSources
2026-11-03aliasesEUVD
2026-11-02createdCVE List, GitHub Advisories, NVD, OSV

References

Show 17 moreShow less
This page doesn't list everything

Left out here: 2 versions. The JSON record has them.

MoveEnter Open