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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| phpmailer/phpmailer (Packagist) | before 6.1.6 | GitHub Advisory Database |
| phpmailer_project phpmailer | before 6.1.6 | NVD |
| fedoraproject fedora | 31, 32 | NVD |
| canonical ubuntu_linux | 18.04 | NVD |
| debian debian_linux | 8.0, 9.0 | NVD |
| phpmailer (Bitnami) | before 6.1.6 | Bitnami Vulnerability Database |
All scores
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| NVD | 5.0medium CVSS:2.0 | AV:N/AC:L/Au:N/C:N/I:P/A:N |
| Bitnami Vulnerability Database | high 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:
- Open an issue in the PHPMailer repo
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
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2020-13625 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-f7hx-fqxw-rvvj changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2020-13625 changed 2026-06-17 | Public domain |
| Bitnami Vulnerability Database | BIT-PHPMAILER-2020-13625 changed 2026-09-08 | Apache-2.0 |