CVE-2016-10033

Source: cve@mitre.org

CRITICAL
9.8
Published: December 30, 2016 at 07:59 PM
Modified: October 22, 2025 at 12:15 AM

Vulnerability Description

The mailSend function in the isMail transport in PHPMailer before 5.2.18 might allow remote attackers to pass extra parameters to the mail command and consequently execute arbitrary code via a \" (backslash double quote) in a crafted Sender property.

CVSS Metrics

Base Score
9.8
Severity
CRITICAL
Vector String
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Weaknesses (CWE)

Source: nvd@nist.gov
Source: 134c704f-9b21-4f2e-91b3-4a467353bcc0

AI Security Analysis

01 // Technical Summary

PHPMailer versions prior to 5.2.18 are vulnerable to a critical remote code execution (RCE) flaw. Attackers can leverage a crafted Sender property containing a backslash-escaped double quote to inject arbitrary commands into the mail server's execution, leading to complete system compromise.

02 // Vulnerability Mechanism

Step 1: Payload Creation: The attacker crafts a malicious Sender property. This property includes a backslash-escaped double quote (") followed by the attacker's desired command and then a closing quote to terminate the injected argument. For example: evil@example.com" -oQ/tmp/ -X/var/www/shell.php

Step 2: Payload Delivery: The attacker sends an email through a vulnerable PHPMailer instance, setting the crafted Sender property in the email's headers.

Step 3: Vulnerability Trigger: The mailSend function in PHPMailer processes the email and attempts to send it using the mail() function. It passes the crafted Sender property as an argument to the mail() command.

Step 4: Command Injection: The operating system's mail server interprets the injected command as a valid argument to the mail() command. The attacker's command is executed.

Step 5: Code Execution: The attacker's command, such as writing a web shell to a publicly accessible directory, is executed on the server, granting the attacker remote control.

03 // Deep Technical Analysis

The vulnerability lies within the mailSend function of the isMail transport in PHPMailer. The code fails to properly sanitize the Sender property before passing it to the mail() function. Specifically, the use of a backslash-escaped double quote (") allows attackers to inject arbitrary command-line arguments. The mail() function, when invoked with these crafted arguments, executes the attacker-supplied commands on the server. This bypasses intended security measures and grants the attacker the ability to execute code with the privileges of the web server user. The root cause is a lack of proper input validation and escaping of the Sender property before it's used in a system call.

04 // Exploitation Status

**Actively exploited**. Publicly available Proof-of-Concept (PoC) exploits exist and are readily available. The vulnerability is easily exploitable, making it a high-priority target for attackers.

05 // Threat Intelligence

While no specific APT groups are definitively linked to this CVE, the ease of exploitation makes it a prime target for various threat actors. The vulnerability is likely exploited by both opportunistic attackers and more sophisticated groups. Not listed on CISA KEV.

06 // Detection & Hunting

  • Monitor web server logs for suspicious activity related to email sending, particularly unusual Sender addresses or command-line arguments passed to the mail command.

  • Analyze email headers for unusual characters or patterns in the Sender field, such as backslash-escaped double quotes or other special characters.

  • Implement file integrity monitoring to detect unauthorized changes to web server files, especially those in publicly accessible directories.

  • Network Intrusion Detection Systems (IDS) can be configured to detect malicious payloads in email traffic, specifically those targeting the PHPMailer vulnerability.

  • Review system logs for the execution of suspicious commands or processes related to email sending.

07 // Remediation & Hardening

  • Upgrade to PHPMailer version 5.2.18 or later. This version includes a fix that properly sanitizes the Sender property.

  • Implement input validation and output encoding to prevent command injection vulnerabilities in other parts of the application.

  • Use a web application firewall (WAF) to filter malicious requests and block attempts to exploit the vulnerability.

  • Restrict the privileges of the web server user to the minimum necessary to perform its tasks. This limits the impact of a successful exploit.

  • Regularly update all software and libraries to the latest versions to patch known vulnerabilities.

  • Consider using a different email transport method if possible, such as SMTP, which may be less susceptible to this type of vulnerability.

08 // Affected Products

PHPMailer versions prior to 5.2.18

09 // Discovered Proof of Concept Links

Advertisement

References & Intelligence

http://packetstormsecurity.com/files/140291/PHPMailer-Remote-Code-Execution.html
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/140350/PHPMailer-Sendmail-Argument-Injection.html
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
http://seclists.org/fulldisclosure/2016/Dec/78
Source: cve@mitre.org
Mailing ListPatchThird Party Advisory
http://www.rapid7.com/db/modules/exploit/multi/http/phpmailer_arg_injection
Source: cve@mitre.org
ExploitThird Party Advisory
http://www.securityfocus.com/archive/1/539963/100/0/threaded
Source: cve@mitre.org
Broken LinkThird Party AdvisoryVDB Entry
http://www.securityfocus.com/bid/95108
Source: cve@mitre.org
Broken LinkExploitThird Party AdvisoryVDB Entry
http://www.securitytracker.com/id/1037533
Source: cve@mitre.org
Broken LinkThird Party AdvisoryVDB Entry
https://developer.joomla.org/security-centre/668-20161205-phpmailer-security-advisory.html
Source: cve@mitre.org
Third Party Advisory
https://github.com/PHPMailer/PHPMailer/releases/tag/v5.2.18
Source: cve@mitre.org
PatchVendor Advisory
https://github.com/PHPMailer/PHPMailer/wiki/About-the-CVE-2016-10033-and-CVE-2016-10045-vulnerabilities
Source: cve@mitre.org
PatchVendor Advisory
https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html
Source: cve@mitre.org
ExploitPatchThird Party Advisory
https://www.drupal.org/psa-2016-004
Source: cve@mitre.org
Third Party Advisory
https://www.exploit-db.com/exploits/40968/
Source: cve@mitre.org
ExploitPatchThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40969/
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40970/
Source: cve@mitre.org
ExploitPatchThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40974/
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40986/
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/41962/
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/41996/
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/42024/
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/42221/
Source: cve@mitre.org
ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/140291/PHPMailer-Remote-Code-Execution.html
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
http://packetstormsecurity.com/files/140350/PHPMailer-Sendmail-Argument-Injection.html
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
http://seclists.org/fulldisclosure/2016/Dec/78
Source: af854a3a-2127-422b-91ae-364da2661108
Mailing ListPatchThird Party Advisory
http://www.rapid7.com/db/modules/exploit/multi/http/phpmailer_arg_injection
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party Advisory
http://www.securityfocus.com/archive/1/539963/100/0/threaded
Source: af854a3a-2127-422b-91ae-364da2661108
Broken LinkThird Party AdvisoryVDB Entry
http://www.securityfocus.com/bid/95108
Source: af854a3a-2127-422b-91ae-364da2661108
Broken LinkExploitThird Party AdvisoryVDB Entry
http://www.securitytracker.com/id/1037533
Source: af854a3a-2127-422b-91ae-364da2661108
Broken LinkThird Party AdvisoryVDB Entry
https://developer.joomla.org/security-centre/668-20161205-phpmailer-security-advisory.html
Source: af854a3a-2127-422b-91ae-364da2661108
Third Party Advisory
https://github.com/PHPMailer/PHPMailer/releases/tag/v5.2.18
Source: af854a3a-2127-422b-91ae-364da2661108
PatchVendor Advisory
https://github.com/PHPMailer/PHPMailer/wiki/About-the-CVE-2016-10033-and-CVE-2016-10045-vulnerabilities
Source: af854a3a-2127-422b-91ae-364da2661108
PatchVendor Advisory
https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitPatchThird Party Advisory
https://www.drupal.org/psa-2016-004
Source: af854a3a-2127-422b-91ae-364da2661108
Third Party Advisory
https://www.exploit-db.com/exploits/40968/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitPatchThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40969/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40970/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitPatchThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40974/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/40986/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/41962/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/41996/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/42024/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
https://www.exploit-db.com/exploits/42221/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party AdvisoryVDB Entry
https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2016-10033
Source: 134c704f-9b21-4f2e-91b3-4a467353bcc0