CVE-2016-10074

HIGH7.5/ 10.0
Share:
Published: December 30, 2016 at 07:59 PM
Modified: April 12, 2025 at 10:46 AM
Source: cve@mitre.org

Vulnerability Description

The mail transport (aka Swift_Transport_MailTransport) in Swift Mailer before 5.4.5 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 e-mail address in the (1) From, (2) ReturnPath, or (3) Sender header.

CVSS Metrics

Base Score
7.5
Severity
HIGH
Vector String
AV:N/AC:L/Au:N/C:P/I:P/A:P

Weaknesses (CWE)

Source: nvd@nist.gov

AI Security Analysis

01 // Technical Summary

Swift Mailer versions prior to 5.4.5 are vulnerable to a critical remote code execution (RCE) flaw. Attackers can inject malicious commands into email headers, leading to arbitrary code execution on the server via the mail command. Successful exploitation allows for complete system compromise and data exfiltration.

02 // Vulnerability Mechanism

Step 1: Payload Delivery: The attacker crafts an email with a malicious email address in the From, ReturnPath, or Sender header. This address includes a backslash-escaped double quote (\") followed by shell commands (e.g., \" ; whoami;).

Step 2: Header Injection: The crafted email is sent to a server using the vulnerable Swift Mailer library.

Step 3: Mail Command Invocation: The Swift Mailer library processes the email and, when sending it using the mail transport, constructs the command to invoke the mail command-line utility.

Step 4: Command Execution: Due to the lack of proper sanitization, the injected shell commands within the email address are passed as arguments to the mail command. The mail command executes these commands.

Step 5: Code Execution: The attacker's injected commands are executed on the server, allowing for arbitrary code execution and potential system compromise.

03 // Deep Technical Analysis

The vulnerability stems from insufficient input validation within the Swift_Transport_MailTransport class. Specifically, the code fails to properly sanitize email addresses provided in the From, ReturnPath, and Sender headers before passing them to the mail command. The use of a backslash-escaped double quote (\") in a crafted email address allows attackers to inject arbitrary shell commands. The mail command, when invoked with the crafted address, interprets the injected commands as arguments, leading to their execution. The root cause is a lack of proper escaping or filtering of user-supplied data before it is used in a system call. This is a classic example of a command injection vulnerability.

References & Intelligence

http://packetstormsecurity.com/files/140290/SwiftMailer-Remote-Code-Execution.html
Source: cve@mitre.org
ExploitThird Party Advisory
http://seclists.org/fulldisclosure/2016/Dec/86
Source: cve@mitre.org
ExploitMailing List
http://www.debian.org/security/2017/dsa-3769
Source: cve@mitre.org
http://www.securityfocus.com/bid/95140
Source: cve@mitre.org
Third Party AdvisoryVDB Entry
https://github.com/swiftmailer/swiftmailer/blob/5.x/CHANGES
Source: cve@mitre.org
PatchVendor Advisory
https://legalhackers.com/advisories/SwiftMailer-Exploit-Remote-Code-Exec-CVE-2016-10074-Vuln.html
Source: cve@mitre.org
ExploitTechnical DescriptionThird Party Advisory
https://www.exploit-db.com/exploits/40972/
Source: cve@mitre.org
ExploitThird Party Advisory
https://www.exploit-db.com/exploits/40986/
Source: cve@mitre.org
https://www.exploit-db.com/exploits/42221/
Source: cve@mitre.org
http://packetstormsecurity.com/files/140290/SwiftMailer-Remote-Code-Execution.html
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party Advisory
http://seclists.org/fulldisclosure/2016/Dec/86
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitMailing List
http://www.debian.org/security/2017/dsa-3769
Source: af854a3a-2127-422b-91ae-364da2661108
http://www.securityfocus.com/bid/95140
Source: af854a3a-2127-422b-91ae-364da2661108
Third Party AdvisoryVDB Entry
https://github.com/swiftmailer/swiftmailer/blob/5.x/CHANGES
Source: af854a3a-2127-422b-91ae-364da2661108
PatchVendor Advisory
https://legalhackers.com/advisories/SwiftMailer-Exploit-Remote-Code-Exec-CVE-2016-10074-Vuln.html
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitTechnical DescriptionThird Party Advisory
https://www.exploit-db.com/exploits/40972/
Source: af854a3a-2127-422b-91ae-364da2661108
ExploitThird Party Advisory
https://www.exploit-db.com/exploits/40986/
Source: af854a3a-2127-422b-91ae-364da2661108
https://www.exploit-db.com/exploits/42221/
Source: af854a3a-2127-422b-91ae-364da2661108
CVE-2016-10074 - HIGH Severity (7.5) | Free CVE Database | 4nuxd