Critical Code Execution Vulnerability in Swift Mailer Package

libphp-swiftmailer Updated 02 Oct 2025

Summary

30/12/2016
N/A
Yes i
Critical
9.8

CVE-2016-10074: 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 do... Affects libphp-swiftmailer across 2 version ranges.

< 5.4.2-1.1 < 545ce9136690cea74f98f86fbb9c92dd9ab1a756

Fixed in 5.4.2-1.1. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Swift Mailer is a popular open-source library used for sending emails from PHP applications. It provides a flexible and powerful API for composing and sending emails, supporting various transport methods. However, prior to version 5.4.5, Swift Mailer was vulnerable to a code execution flaw that could be exploited through specially crafted email headers.

Vulnerability Detail

The vulnerability, identified as CVE-2016-10074, arises from the mail transport mechanism in Swift Mailer, specifically the Swift_Transport_MailTransport class. Attackers can exploit this vulnerability by injecting a backslash double quote (") into crafted email addresses within the From, ReturnPath, or Sender headers. This can lead to the execution of arbitrary code on the server, posing a significant security risk. The CVSS score for this vulnerability is 9.8, indicating its critical nature and potential for severe impact.

How To Fix

Minimum fixed version

5.4.2-1.1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libphp-swiftmailer

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

Workaround

If immediate updating is not possible, consider implementing input validation on email headers to sanitize user input and prevent the injection of malicious characters. This can be done by using PHP's filter_var function: filter_var($email, FILTER_SANITIZE_EMAIL).

Conclusion

The CVE-2016-10074 vulnerability in Swift Mailer poses a serious risk of arbitrary code execution through manipulated email headers. It is crucial for developers using this library to update to the latest version to safeguard their applications. Implementing input validation can serve as a temporary measure until the update is applied.

See every vulnerability recorded for libphp-swiftmailer →

Share this vulnerability

FAQ

CVE-2016-10074 is a vulnerability in the Swift Mailer library that allows remote attackers to execute arbitrary code by injecting malicious characters into email headers.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Exploitation of this vulnerability can lead to unauthorized code execution on the server, potentially compromising the entire application and its data.

Yes, you can implement input validation to sanitize email headers and prevent the injection of malicious characters as a temporary workaround.

It is recommended to upgrade to Swift Mailer version 5.4.5 or later to fully mitigate the vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for libphp-swiftmailer.

How To Fix

Minimum fixed version

5.4.2-1.1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libphp-swiftmailer

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