Command Injection Vulnerability in Swift Mailer

swiftmailer/swiftmailer Updated 02 Oct 2025

Summary

17/05/2022
Yes i
Critical
9.8

CVE-2016-10074: Swift Mailer mail transport Command Injection. Affects swiftmailer/swiftmailer versions < 5.4.5. Fixed in 5.4.5. How to fix ↓

Also tracked for

The same CVE-2016-10074 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Swift Mailer is an open-source library for sending emails in PHP applications. It provides a flexible and powerful way to send emails using various transport methods. The library is widely used and trusted by developers for its simplicity and reliability. However, a critical vulnerability has been discovered in the mail transport component of Swift Mailer.

Vulnerability Detail

The mail transport component (Swift_Transport_MailTransport) in Swift Mailer before version 5.4.5 is vulnerable to command injection. This vulnerability allows remote attackers to inject extra parameters into the mail command, potentially leading to the execution of arbitrary code. The vulnerability can be exploited by including a backslash double quote (") in a crafted email address within the From, ReturnPath, or Sender header. This can result in unauthorized code execution and compromise of the affected system.

How To Fix

Minimum fixed version

5.4.5

This is the first release that contains the fix.

composer require swiftmailer/swiftmailer:5.4.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version is not immediately feasible, a temporary workaround can be implemented by validating and sanitizing user input before using it in email headers. This can be done by using appropriate input filtering and escaping techniques to remove any potentially malicious characters or sequences. However, it is strongly recommended to upgrade to the patched version as soon as possible.

Conclusion

The command injection vulnerability in Swift Mailer poses a critical security risk to PHP applications using affected versions. It is crucial to upgrade to version 5.4.5 or later to mitigate the risk of unauthorized code execution. Additionally, developers should sanitize and validate user input to prevent potential exploitation. For further assistance and support, please reach out to DevNack.com.

See every vulnerability recorded for swiftmailer/swiftmailer →

Share this vulnerability

FAQ

Swift Mailer is an open-source library for sending emails in PHP applications. It provides a simple and reliable way to send emails using various transport methods.

This vulnerability allows remote attackers to execute arbitrary code on the affected system. It can lead to unauthorized access, data breaches, and compromise of the entire system.

To fix this vulnerability, upgrade to Swift Mailer version 5.4.5 or later. Update your composer.json file and run the composer update command.

If immediate upgrade is not possible, you can sanitize and validate user input before using it in email headers. However, upgrading to the patched version is strongly recommended.

For more information and support on vulnerability remediation, you can contact info@devnack.com.

Related vulnerabilities

Recent vulnerabilities recorded for swiftmailer/swiftmailer.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

5.4.5

This is the first release that contains the fix.

composer require swiftmailer/swiftmailer:5.4.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback