CVE-2021-3603 Inclusion of Functionality from Untrusted Control Sphere in PHPMailer/PHPMailer

High 8.1 Published Updated

Attackers can execute arbitrary code if a malicious function named 'php' exists in the global namespace, affecting PHPMailer users.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-3603?

CVE-2021-3603 is a high-severity code injection vulnerability in Fedoraproject Fedora, published on 17 Jun 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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.

Weakness: CWE-829

Which versions are affected by CVE-2021-3603?

3 open source packages ship an affected version, including phpmailer/phpmailer and phpmailer. It affects 2 products.

PackageAffectedFixed in
phpmailer/phpmailer PackagistAll versions6.5.0
phpmailer/phpmailer PackagistAll versions6.5.0
phpmailer BitnamiAll versions6.4.2

Products include Fedoraproject Fedora, Phpmailer Project Phpmailer.

How do I fix CVE-2021-3603?

Upgrade phpmailer/phpmailer to 6.5.0 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2021-3603 being exploited?

There is no known exploitation of CVE-2021-3603 in the wild and no public exploit code.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as BIT-phpmailer-2021-3603, DEBIAN-CVE-2021-3603, GHSA-77mr-wc79-m8j3, MGASA-2021-0345, UBUNTU-CVE-2021-3603.

Is CVE-2021-3603 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free