SSD Advisory – SwiftMailer Remote Code Execution

Vulnerability Summary
The following report describes a remote code execution vulnerability found in SwiftMailer. The vulnerability allows an attacker injecting sendmail program due to insufficient address sanitization. Swift Mailer integrates into any web app written in PHP 5, offering a flexible object-oriented approach to sending emails with a multitude of features

Credit
An independent security researcher Dawid Golunski (https://legalhackers.com/) has reported this vulnerability to Beyond Security’s SecuriTeam Secure Disclosure program

Vulnerability Details

When using SwitMailer to send emails with Sendmail transport, a malicious user might be able to inject arbitrary parameters to sendmail program due to insufficient address sanitization. If an attacker can control email headers , he could bypass sanitization by adding additional quote characters within a malicious email address.

Prof of Concept

In this example , -X -oQ parameters would be injected to the sendmail program and write out a /tmp/exp.php file
as a result if the MTA in use was Sendmail.

Vendor response
The vendor has released SwiftMailer version 5.4.5 to address the vulnerability

https://blogs.securiteam.com/index.php/feed