CVE-2020-36326 - Object injection in PHPMailer/PHPMailer
CVE-2020-36326 + Object injection in PHPMailer/PHPMailer + Critical + 2021-05-04
One-sentence business risk
The vulnerable component sits in a commonly deployed application path and can create a material breach, outage, or compliance risk.
Research notes
- Root cause: ### Impact This is a reintroduction of an earlier issue (CVE-2018-19296) by an unrelated bug fix in PHPMailer 6.1.8.
- Affected versions: composer:phpmailer/phpmailer >= 6.1.8, < 6.4.1.
- Fixed / safe versions: 6.4.1.
- Public exploit / PoC signal: the consulted NVD/GHSA/vendor sources describe the trigger class; treat it as reproducible until patched.
- CVSS: use upstream advisory score .
Exact vulnerable code pattern
object = unsafe_deserialize(untrusted_bytes)
Fixed / mitigated code pattern
parse JSON or another data-only format, then validate against a strict schema
Dependency or runtime update:
composer show phpmailer/phpmailer || true
composer require phpmailer/phpmailer --with-all-dependencies
composer audit
Step-by-step integration guide
- Inventory
phpmailer/phpmaileracross source, lockfiles, SBOMs, container images, CI images, and deployment manifests. - Upgrade to
6.4.1or apply the exact vendor patch referenced below. - Replace the vulnerable
deserializationpattern with the fixed pattern and fail closed on malformed input. - Add a regression test that exercises the advisory trigger and proves the request is rejected, bounded, or authorized.
- Deploy through canary, monitor security logs and resource metrics, then remove temporary edge blocks only after all runtimes are fixed.
Alternative mitigations
- Disable the vulnerable feature path while the package/runtime update rolls out.
- Add WAF or reverse-proxy rules for traversal tokens, prototype-polluting keys, oversized frames, shell metacharacters, or unauthenticated tool calls matching the trigger class.
- Restrict internal egress, rotate exposed secrets, and revoke affected tokens/keys if the vulnerability can disclose config, logs, JWT secrets, proxy credentials, or PKI material.
- For admin/API authorization issues, temporarily require elevated roles and explicit ownership checks at the gateway.
Detection signature
id: cve-2020-36326-object-injection-in-phpmailer-phpmailer
source: GitHub Advisory Database
dependency_or_product: "phpmailer/phpmailer"
affected: "composer:phpmailer/phpmailer >= 6.1.8, < 6.4.1"
fixed: "6.4.1"
signals:
- "deserialization"
- "../"
- "__proto__"
- "tools/call"
- "wp_ajax_nopriv"
- "pickle.loads"
- "shell command construction"
action: "upgrade, add regression test, and verify deploy artifact"
Copy-paste skill
You are remediating CVE-2020-36326 (Object injection in PHPMailer/PHPMailer) in this repository.
Find every affected dependency, runtime, image, service configuration, and reachable code path. Upgrade or patch to 6.4.1. Replace the vulnerable deserialization pattern with a fail-closed implementation, add a regression test for the trigger shape, and update deployment/SBOM artifacts. If this repository does not control the affected runtime, create TRIAGE.md naming the owner, affected version, fixed version, and blocking decision.
Keywords, affected tech stack, and revenue tags
- Keywords:
CVE-2020-36326,deserialization,phpmailer/phpmailer,GitHub Advisory Database. - Affected tech stack:
php/composer. - Revenue tags:
sellable_to_fintech,enterprise_blocker,zero_day_gold.
References
- https://github.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2020-36326.yaml
- https://github.com/PHPMailer/PHPMailer/commit/e2e07a355ee8ff36aba21d0242c5950c56e4c6f9
- https://github.com/PHPMailer/PHPMailer/releases/tag/v6.4.1
- https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-m298-fh5c-jc66
- https://github.com/advisories/GHSA-m298-fh5c-jc66
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3B5WDPGUFNPG4NAZ6G4BZX43BKLAVA5B/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KPU66INRFY5BQ3ESVPRUXJR4DXQAFJVT/
- https://nvd.nist.gov/vuln/detail/CVE-2020-36326