{"id":"CVE-2021-3603","aliases":["BIT-phpmailer-2021-3603","CLSA-2026-1771375983","DEBIAN-CVE-2021-3603","EUVD-2021-1277","GHSA-77mr-wc79-m8j3","MGASA-2021-0345","UBUNTU-CVE-2021-3603","USN-5956-1"],"status":"published","title":"Inclusion of Functionality from Untrusted Control Sphere in PHPMailer/PHPMailer","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.","severity":{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.0226,"percentile":0.83125,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-74","CWE-829"],"published":"2021-06-17T12:09:42Z","modified":"2026-10-23T18:03:29Z","fixes":[{"ecosystem":"Packagist","package":"phpmailer/phpmailer","fixed_in":["6.5.0"],"sources":["ghsa","osv"]},{"ecosystem":"Bitnami","package":"phpmailer","fixed_in":["6.4.2"],"sources":["osv"]},{"ecosystem":"Debian:12","package":"libphp-phpmailer","fixed_in":["6.6.3-1"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"libphp-phpmailer","fixed_in":["6.6.3-1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"libphp-phpmailer","fixed_in":["6.6.3-1"],"sources":["osv"]},{"ecosystem":"Mageia:7","package":"php-phpmailer","fixed_in":["6.5.0-1.mga7"],"sources":["osv"]},{"ecosystem":"Mageia:8","package":"php-phpmailer","fixed_in":["6.5.0-1.mga8"],"sources":["osv"]},{"ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libphp-phpmailer","fixed_in":["6.0.6-0.1ubuntu0.1~esm1"],"sources":["osv"]},{"ecosystem":"Ubuntu:Pro:22.04:LTS","package":"libphp-phpmailer","fixed_in":["6.2.0-2ubuntu0.1~esm1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Packagist","package":"phpmailer/phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.5.0"}]}]},{"source":"osv","ecosystem":"Bitnami","package":"phpmailer","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"6.4.2"}]}]},{"source":"osv","ecosystem":"TuxCare:Packagist","package":"phpmailer/phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.2.28"},{"fixed":"5.2.28-p1+tuxcare"}]}],"versions":["5.2.28"],"bundled":3},{"source":"osv","ecosystem":"Debian:12","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.6.3-1"}]}]},{"source":"osv","ecosystem":"Debian:13","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.6.3-1"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.6.3-1"}]}]},{"source":"osv","ecosystem":"Packagist","package":"phpmailer/phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.5.0"}]}],"versions":["v5.2.10","v5.2.11","v5.2.12","v5.2.13","v5.2.14","v5.2.15","v5.2.16","v5.2.17","v5.2.18","v5.2.19","v5.2.2","v5.2.20","v5.2.21","v5.2.22","v5.2.23","v5.2.24","v5.2.25","v5.2.26","v5.2.27","v5.2.28","v5.2.4","v5.2.5","v5.2.6","v5.2.7","v5.2.8","v5.2.9","v6.0.0","v6.0.0rc1","v6.0.0rc2","v6.0.0rc3","v6.0.0rc4","v6.0.0rc5","v6.0.1","v6.0.2","v6.0.3","v6.0.4","v6.0.5","v6.0.6","v6.0.7","v6.1.0","v6.1.1","v6.1.2","v6.1.3","v6.1.4","v6.1.5","v6.1.6","v6.1.7","v6.1.8","v6.2.0","v6.3.0","v6.4.0","v6.4.1"]},{"source":"osv","ecosystem":"Mageia:7","package":"php-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.5.0-1.mga7"}]}]},{"source":"osv","ecosystem":"Mageia:8","package":"php-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.5.0-1.mga8"}]}]},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.6-0.1ubuntu0.1~esm1"}]}],"versions":["6.0.6-0.1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:22.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.2.0-2ubuntu0.1~esm1"}]}],"versions":["6.2.0-2"]},{"source":"osv","ecosystem":"Ubuntu:Pro:16.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-1ubuntu0.1~esm1"}]}],"versions":["5.2.10+dfsg-1","5.2.14+dfsg-1","5.2.14+dfsg-1build1"],"bundled":7},{"source":"osv","ecosystem":"Ubuntu:Pro:18.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-2.3+deb9u2ubuntu0.1~esm1"}]}],"versions":["5.2.14+dfsg-2.3","5.2.14+dfsg-2.3+deb9u1build0.18.04.1","5.2.14+dfsg-2.3+deb9u2build0.18.04.1"],"bundled":7},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.6-0.1ubuntu0.1~esm1"}]}],"versions":["6.0.6-0.1"],"bundled":7},{"source":"osv","ecosystem":"Ubuntu:Pro:22.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.2.0-2ubuntu0.1~esm1"}]}],"versions":["6.2.0-2"],"bundled":7}],"products":[{"vendor":"fedoraproject","product":"fedora"},{"vendor":"phpmailer","product":"phpmailer"},{"vendor":"phpmailer_project","product":"phpmailer"}],"references":[{"url":"https://www.huntr.dev/bounties/1-PHPMailer/PHPMailer/","tags":["x_refsource_CONFIRM","x_transferred","Product","web","report"]},{"url":"https://github.com/PHPMailer/PHPMailer/commit/45f3c18dc6a2de1cb1bf49b9b249a9ee36a5f7f3","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","advisory","fix","web","report"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FJYSOFCUBS67J3TKR74SD3C454N7VTYM/","tags":["vendor-advisory","x_refsource_FEDORA","x_transferred","web"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3YRMWGA4VTMXFB22KICMB7YMFZNFV3EJ/","tags":["vendor-advisory","x_refsource_FEDORA","x_transferred","web"]},{"url":"https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-77mr-wc79-m8j3","tags":["web","advisory"]},{"url":"https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3603","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-3603","tags":["web","advisory"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2021-3603.yaml","tags":["web"]},{"url":"https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.0","tags":["web"]},{"url":"https://github.com/advisories/GHSA-77mr-wc79-m8j3"},{"url":"https://security-tracker.debian.org/tracker/CVE-2021-3603","tags":["advisory"]},{"url":"https://github.com/PHPMailer/PHPMailer","tags":["package"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3YRMWGA4VTMXFB22KICMB7YMFZNFV3EJ","tags":["web"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FJYSOFCUBS67J3TKR74SD3C454N7VTYM","tags":["web"]},{"url":"https://www.huntr.dev/bounties/1-PHPMailer/PHPMailer","tags":["web"]},{"url":"https://advisories.mageia.org/MGASA-2021-0345.html","tags":["advisory"]},{"url":"https://bugs.mageia.org/show_bug.cgi?id=29183","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2021-3603","tags":["report"]},{"url":"https://ubuntu.com/security/notices/USN-5956-1","tags":["advisory"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-3603","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2016-10033","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2016-10045","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2017-5223","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2017-11503","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2018-19296","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2020-13625","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2021-3603","title":"Inclusion of Functionality from Untrusted Control Sphere in PHPMailer/PHPMailer","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.","status":"published","published":"2021-06-17T12:09:42Z","modified":"2024-08-03T17:01:07.074Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"cna"}],"cwes":["CWE-829"],"updated_at":"2026-11-02T14:33:03.671751Z"}],"euvd":[{"id":"EUVD-2021-1277","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.","status":"published","published":"2021-06-17T12:09:42Z","modified":"2024-08-03T17:01:07Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-03T03:25:12.535968Z"}],"ghsa":[{"id":"GHSA-77mr-wc79-m8j3","title":"PHPMailer untrusted code may be run from an overridden address validator","description":"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()`.\n\n### Impact\nLow impact – exploitation requires that an attacker can already inject code into an application, but it provides a trigger pathway.\n\n### Patches\nThis 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.\n\n### Workarounds\nInject your own email validator function.\n\n### References\nReported by [Vikrant Singh Chauhan](mailto:vi@hackberry.xyz) via [huntr.dev](https://www.huntr.dev/).\n[CVE-2021-3603](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3603)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)\n* [Email us](mailto:phpmailer@synchromedia.co.uk).\n","status":"published","published":"2021-06-22T15:18:02Z","modified":"2024-02-07T18:16:27Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"cwes":["CWE-74","CWE-829"],"updated_at":"2026-11-02T14:37:36.076201Z"}],"nvd":[{"id":"CVE-2021-3603","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.","status":"published","published":"2021-06-17T12:15:08.15Z","modified":"2026-06-17T04:05:25.257Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"secondary"},{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"primary"},{"version":"2.0","score":6.8,"vector":"AV:N/AC:M/Au:N/C:P/I:P/A:P","level":"medium","assessor":"primary"}],"cwes":["CWE-829"],"updated_at":"2026-11-02T14:06:54.892562Z"}],"osv":[{"id":"CVE-2021-3603","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.","status":"published","published":"2021-06-17T12:15:08.15Z","modified":"2026-10-20T10:54:47.063810576Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:44:20.13324Z"},{"id":"DEBIAN-CVE-2021-3603","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.","status":"published","published":"2021-06-17T12:15:08.15Z","modified":"2026-10-23T18:03:29.51724818Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:45:35.233346Z"},{"id":"GHSA-77mr-wc79-m8j3","title":"PHPMailer untrusted code may be run from an overridden address validator","description":"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()`.\n\n### Impact\nLow impact – exploitation requires that an attacker can already inject code into an application, but it provides a trigger pathway.\n\n### Patches\nThis 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.\n\n### Workarounds\nInject your own email validator function.\n\n### References\nReported by [Vikrant Singh Chauhan](mailto:vi@hackberry.xyz) via [huntr.dev](https://www.huntr.dev/).\n[CVE-2021-3603](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3603)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)\n* [Email us](mailto:phpmailer@synchromedia.co.uk).\n","status":"published","published":"2021-06-22T15:18:02Z","modified":"2024-02-17T05:42:33.365606Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"cwes":["CWE-74","CWE-829"],"updated_at":"2026-11-02T15:46:40.657155Z"},{"id":"UBUNTU-CVE-2021-3603","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.","status":"published","published":"2021-06-17T12:15:00Z","modified":"2026-02-05T13:54:10.582594Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"},{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:54:27.870979Z"},{"id":"BIT-phpmailer-2021-3603","title":"Inclusion of Functionality from Untrusted Control Sphere in PHPMailer/PHPMailer","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.","status":"published","published":"2024-03-06T11:01:27.687Z","modified":"2026-09-08T08:48:24.788406219Z","updated_at":"2026-11-02T15:28:34.724063Z"},{"id":"CLSA-2026-1771375983","title":"TuxCare security update for phpmailer/phpmailer (3 CVEs)","description":"TuxCare rebuilt phpmailer/phpmailer to address 3 CVEs. Fixed in 5.2.28-p1+tuxcare.","status":"published","published":"2026-08-04T14:52:36Z","modified":"2026-10-15T09:48:04.648075561Z","updated_at":"2026-11-02T15:43:43.249928Z"},{"id":"MGASA-2021-0345","title":"Updated php-phpmailer package fixes security vulnerability","description":"PHPMailer contained a vulnerability that can result in untrusted code being\ncalled (CVE-2021-3603).\n\nSee upstream release notes.\n","status":"published","published":"2021-07-12T20:26:21Z","modified":"2026-04-16T04:43:19.897883119Z","updated_at":"2026-11-02T15:49:41.509337Z"},{"id":"USN-5956-1","title":"libphp-phpmailer vulnerabilities","description":"Dawid Golunski discovered that PHPMailer was not properly escaping user\ninput data used as arguments to functions executed by the system shell. An\nattacker could possibly use this issue to execute arbitrary code. This\nissue only affected Ubuntu 16.04 ESM. (CVE-2016-10033, CVE-2016-10045)\n\nIt was discovered that PHPMailer was not properly escaping characters\nin certain fields of the code_generator.php example code. An attacker\ncould possibly use this issue to conduct cross-site scripting (XSS)\nattacks. This issue was only fixed in Ubuntu 16.04 ESM and Ubuntu 18.04\nESM. (CVE-2017-11503)\n\nYongxiang Li discovered that PHPMailer was not properly converting\nrelative paths provided as user input when adding attachments to messages,\nwhich could lead to relative image URLs being treated as absolute local\nfile paths and added as attachments. An attacker could possibly use this\nissue to access unauthorized resources and expose sensitive information.\nThis issue only affected Ubuntu 16.04 ESM. (CVE-2017-5223)\n\nSehun Oh discovered that PHPMailer was not properly processing untrusted\nnon-local file attachments, which could lead to an object injection. An\nattacker could possibly use this issue to execute arbitrary code. This\nissue only affected Ubuntu 16.04 ESM. (CVE-2018-19296)\n\nElar Lang discovered that PHPMailer was not properly escaping file\nattachment names, which could lead to a misinterpretation of file types\nby entities processing the message. An attacker could possibly use this\nissue to bypass attachment filters. This issue was only fixed in Ubuntu\n16.04 ESM and Ubuntu 20.04 ESM. (CVE-2020-13625)\n\nIt was discovered that PHPMailer was not properly handling callables in\nits validateAddress function, which could result in untrusted code being\ncalled should the global namespace contain a function called 'php'. An\nattacker could possibly use this issue to execute arbitrary code. This\nissue was only fixed in Ubuntu 20.04 ESM and Ubuntu 22.04 ESM.\n(CVE-2021-3603)\n","status":"published","published":"2023-03-15T14:33:12Z","modified":"2026-06-25T13:31:53.33751944Z","updated_at":"2026-11-02T16:58:16.738762Z"}]}}
