CVE-2020-13625
JSON

7.5high

Insufficient output escaping of attachment names in PHPMailer

Severity
7.5high CVSS:3.1 by NVD
Exploit likelihood
3.78% (higher than 90% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-f7hx-fqxw-rvvjBIT-PHPMAILER-2020-13625

Description

PHPMailer before 6.1.6 contains an output escaping bug when the name of a file attachment contains a double quote character. This can result in the file type being misinterpreted by the receiver or any mail relay processing the message.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
phpmailer/phpmailer (Packagist)before 6.1.6GitHub Advisory Database
phpmailer_project phpmailerbefore 6.1.6NVD
fedoraproject fedora31, 32NVD
canonical ubuntu_linux18.04NVD
debian debian_linux8.0, 9.0NVD
phpmailer (Bitnami)before 6.1.6Bitnami Vulnerability Database

All scores

GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
NVD5.0medium CVSS:2.0AV:N/AC:L/Au:N/C:N/I:P/A:N
Bitnami Vulnerability Databasehigh rating

Classification

What each source says

CVE List

PHPMailer before 6.1.6 contains an output escaping bug when the name of a file attachment contains a double quote character. This can result in the file type being misinterpreted by the receiver or any mail relay processing the message.

GitHub Advisory Database
Impact

CWE-116: Incorrect output escaping.

An attachment added like this (note the double quote within the attachment name, which is entirely valid):

$mail->addAttachment('/tmp/attachment.tmp', 'filename.html";.jpg');

Will result in a message containing these headers:

Content-Type: application/octet-stream; name="filename.html";.jpg"
Content-Disposition: attachment; filename="filename.html";.jpg"

The attachment will be named filename.html, and the trailing ";.jpg" will be ignored. Mail filters that reject .html attachments but permit .jpg attachments may be fooled by this.

Note that the MIME type itself is obtained automatically from the source filename (in this case attachment.tmp, which maps to a generic application/octet-stream type), and not the name given to the attachment (though these are the same if a separate name is not provided), though it can be set explicitly in other parameters to attachment methods.

Patches

Patched in PHPMailer 6.1.6 by escaping double quotes within the name using a backslash, as per RFC822 section 3.4.1, resulting in correctly escaped headers like this:

Content-Type: application/octet-stream; name="filename.html\";.jpg"
Content-Disposition: attachment; filename="filename.html\";.jpg"
Workarounds

Reject or filter names and filenames containing double quote (") characters before passing them to attachment functions such as addAttachment().

References

CVE-2020-13625. PHPMailer 6.1.6 release

For more information

If you have any questions or comments about this advisory:

NVD (es)

PHPMailer versiones anteriores a 6.1.6, contiene un bug de escape de salida cuando el nombre de un archivo adjunto contiene un carácter de comillas dobles. Esto puede resultar en que el tipo de archivo esta siendo malinterpretado por el receptor o que cualquier retransmisión de correo procese el mensaje

References

https://github.com/PHPMailer/PHPMailer/releases/tag/v6.1.6advisory, release-notes, third-party-advisory, web
https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-f7hx-fqxw-rvvjadvisory, exploit, patch, third-party-advisory, web
https://lists.debian.org/debian-lts-announce/2020/06/msg00014.htmladvisory, mailing-list, third-party-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SMH4TC5XTS3KZVGMSKEPPBZ2XTZCKKCX/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/EFM3BZABL6RUHTVMXSC7OFMP4CKWMRPJ/vendor-advisory, web
http://lists.opensuse.org/opensuse-security-announce/2020-07/msg00067.htmlbroken-link, vendor-advisory, web
http://lists.opensuse.org/opensuse-security-announce/2020-07/msg00085.htmlbroken-link, vendor-advisory, web
https://lists.debian.org/debian-lts-announce/2020/08/msg00004.htmladvisory, mailing-list, third-party-advisory, web
https://usn.ubuntu.com/4505-1/advisory, third-party-advisory, vendor-advisory
https://nvd.nist.gov/vuln/detail/CVE-2020-13625advisory, web
https://github.com/PHPMailer/PHPMailer/commit/c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3web
https://github.com/PHPMailer/PHPMailerpackage

Sources

SourceRecordLicence
CVE ListCVE-2020-13625 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-f7hx-fqxw-rvvj changed 2026-07-08CC-BY-4.0
NVDCVE-2020-13625 changed 2026-06-17Public domain
Bitnami Vulnerability DatabaseBIT-PHPMAILER-2020-13625 changed 2026-09-08Apache-2.0