CVE-2016-10033
PHP PHPMailer — PHPMailer Command Injection Vulnerability
Description
Response & Mitigation
Why act now?
Prioritisation rationale
CVE-2016-10033 carries an EPSS score of 99.71 % (100th percentile), indicating that virtually all observed exploit activity across the ecosystem targets this vulnerability. The attack is low-complexity: an adversary submits a crafted Sender value containing \" through any publicly reachable web form, injecting additional parameters into the underlying sendmail call and achieving remote code execution in the context of the web-server process — no authentication required. Typical targets are CMS deployments (WordPress plugins, Joomla extensions), Laravel applications, and any PHP web application with a contact or registration form running PHPMailer below 5.2.18. For NIS2-scoped organisations with internet-facing web applications, a critical rating is fully justified; CISA's addition to the KEV catalogue in July 2025 confirms continued active exploitation, and the network-accessible, unauthenticated CVSS vector with high impact on confidentiality and integrity makes immediate patching the only acceptable response.
Runbook · Step 1
Immediate response (0-24 h)
- Update PHPMailer immediately to version 5.2.18 or later (recommended: current 6.x branch) — run
composer require phpmailer/phpmailer:^6.9in every affected project; all versions below 5.2.18 are vulnerable. - Inventory every application that includes
class.phpmailer.phpor pulls PHPMailer as a Composer dependency (composer show phpmailer/phpmailerin each project root). - Isolate applications that cannot be patched immediately, or temporarily disable the affected endpoints (contact forms, registration emails, password-reset flows) until the patch is deployed.
- Hard-code the
Senderproperty in all application configurations to a validated, static value — never populate it from user-supplied input until the patch is in place. - Inspect running PHP processes on affected hosts:
ps aux | grep phpandlsof -p <PID>— unexpected child processes spawned fromsendmail//usr/sbin/sendmailare a strong exploitation indicator. - Activate WAF rules immediately (see Mitigation layers) to block in-progress attacks while the patch rollout proceeds.
Runbook · Step 2
Mitigation layers
- WAF/IPS rule: Filter HTTP request bodies and parameters for the pattern
\"(backslash followed by double quote) in any email-related field. ModSecurity rule concept:SecRule ARGS "@rx \\\\\"" "id:9001,phase:2,deny,msg:'CVE-2016-10033 PHPMailer Injection'". - Network segmentation: Web-server VMs should only be permitted outbound SMTP connections to defined mail-relay hosts (ports 25/587/465). Replace direct OS-level
sendmailinvocation with an SMTP relay to eliminate the attack surface entirely. - PHP hardening: Set
disable_functions = exec,passthru,shell_exec,system,proc_open,popeninphp.iniwhere the application does not require these functions — significantly limits post-exploitation capability. - Least privilege: Run PHP-FPM/Apache workers under a dedicated, non-privileged system account with no interactive shell (
/sbin/nologin); restrict access to thesendmailbinary to that account only. - Input validation as interim control: Wrap all assignments to
PHPMailer::Senderwith strict RFC-5321 validation (filter_var($addr, FILTER_VALIDATE_EMAIL)) before the patch can be deployed. - Switch to SMTP transport: Configure PHPMailer to use SMTP (
$mail->isSMTP()) instead of themail()function — the vulnerability is exclusive to theisMailtransport; the SMTP transport is not affected.
Runbook · Step 3
Detection rules
- Auditd / Linux: Monitor the process ancestry chain
apache2/php-fpm→sh→sendmailwith unexpected arguments. Create anauditdrule onexecvefor/usr/sbin/sendmailwhere the-fargument contains special characters (\\,",;,|). - Sysmon (Linux port or Windows): EID 1 —
ParentImagecontainsphporhttpd,Imageissh,bash,cmd.exe, orsendmail;CommandLinecontains\"or a-fargument with special characters. - Web-server access logs: POST requests to contact-form endpoints with body parameters containing
\"— SPL snippet:index=web sourcetype=access_combined method=POST | where match(_raw, "\\\\\""). - EDR process tree: Alert when
sendmailor/usr/lib/sendmailspawns as a child of a PHP interpreter with arguments outside the expected-f sender@domain.tldpattern. - Sigma rule shape:
title: CVE-2016-10033 PHPMailer Command Injection logsource: {category: process_creation, product: linux} detection: selection: ParentImage|contains: 'php' Image|endswith: '/sendmail' CommandLine|contains: '\"' condition: selection
Metrics
Affected products
Products and version ranges extracted from the vendor/CERT advisory. A range like „<4.14.6“ implies the update recommendation „upgrade to 4.14.6 or later“.
packagist
phpmailer/phpmailer5.0.0
packagist
phpmailer/phpmailerv5.2.10
packagist
phpmailer/phpmailerv5.2.11
packagist
phpmailer/phpmailerv5.2.12
packagist
phpmailer/phpmailerv5.2.13
packagist
phpmailer/phpmailerv5.2.14
packagist
phpmailer/phpmailerv5.2.15
packagist
phpmailer/phpmailerv5.2.16
packagist
phpmailer/phpmailerv5.2.17
packagist
phpmailer/phpmailerv5.2.2
packagist
phpmailer/phpmailerv5.2.4
packagist
phpmailer/phpmailerv5.2.5
packagist
phpmailer/phpmailerv5.2.6
packagist
phpmailer/phpmailerv5.2.7
packagist
phpmailer/phpmailerv5.2.8
packagist
phpmailer/phpmailerv5.2.9
Public exploit references
Public proof-of-concepts and detection templates for this vulnerability. Maturity ranges from reported PoCs through working detection scripts up to fully weaponized exploit modules. NEOSEC mirrors the code internally for forensic analysis; externally we only link to the original sources.
References & sources
- https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-5f37-gxvh-23v6web
- https://nvd.nist.gov/vuln/detail/CVE-2016-10033advisory
- https://www.exploit-db.com/exploits/42221web
- https://www.exploit-db.com/exploits/42024web
- https://www.exploit-db.com/exploits/41996web
- https://www.exploit-db.com/exploits/41962web
- https://www.exploit-db.com/exploits/40986web
- https://www.exploit-db.com/exploits/40974web
- https://www.exploit-db.com/exploits/40970web
- https://www.exploit-db.com/exploits/40969web
- https://www.exploit-db.com/exploits/40968web
- https://www.drupal.org/psa-2016-004web
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2016-10033web
- https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.htmlweb
- https://github.com/PHPMailer/PHPMailer/wiki/About-the-CVE-2016-10033-and-CVE-2016-10045-vulnerabilitiesweb
- https://github.com/PHPMailer/PHPMailer/releases/tag/v5.2.18web
- https://github.com/PHPMailer/PHPMailerpackage
- https://github.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2016-10033.yamlweb
- https://developer.joomla.org/security-centre/668-20161205-phpmailer-security-advisory.htmlweb
- http://packetstormsecurity.com/files/140291/PHPMailer-Remote-Code-Execution.htmlweb