Overview
Exim versions up to and including 4.92.1 do not properly handle trailing backslash characters in the string_interpret_escape() function. This function is used to handle peer distinguished names (DN) and Sever Name Indication (SNI) during a TLS negotiation. This vulnerability could allow a local or remote unauthenticated attacker to execute arbitrary code with root privileges.
Description
Exim is a message transfer agent (MTA) that can be used on Unix-like operating systems. All versions up to and including 4.92.1 of Exim do not properly handle trailing backslash characters in the string_interpret_escape() function, which is used to process peer DN and SNI during a TLS negotiation. In cases where the string being processed ends with a '\' character, the vulnerable string_interpret_escape() function will interpret the string-terminating null byte as a value to be escaped, thus incrementing the string pointer to the byte after the string to be processed. If the attacker-provided data is crafted in a certain way, this out-of-bounds pointer can be leveraged to cause a heap overflow. Exim installations configured to allow TLS connections, which can happen either via the SMTP STARTTLS command or via TLS-on-connect, can process attacker-provided data in the TLS SNI information. Exim installations that are configured to process client-provided certificates may also be exploitable via a crafted TLS peer DN. |
Impact
By causing a vulnerable Exim server to process an SMTP email message, a local or remote unauthenticated attacker may be able to execute arbitrary code with root privileges. |
Solution
Apply an update |
Use ACLs to block attack attempts
# by the acl_smtp_mail main config option) deny condition = ${if eq{\\}{${substr{-1}{1}{$tls_in_sni}}}} deny condition = ${if eq{\\}{${substr{-1}{1}{$tls_in_peerdn}}}} |
Vendor Information
CVSS Metrics
Group | Score | Vector |
---|---|---|
Base | 10 | AV:N/AC:L/Au:N/C:C/I:C/A:C |
Temporal | 7.8 | E:POC/RL:OF/RC:C |
Environmental | 5.9 | CDP:ND/TD:M/CR:ND/IR:ND/AR:ND |
References
- https://www.exim.org/static/doc/security/CVE-2019-15846.txt
- https://ftp.exim.org/pub/exim/exim4/
- https://github.com/Exim/exim.git
- https://usn.ubuntu.com/4124-1/
- https://github.com/Exim/exim/tree/exim-4.92.2%2Bfixes/doc/doc-txt/cve-2019-15846
- https://git.exim.org/exim.git/commit/2600301ba6dbac5c9d640c87007a07ee6dcea1f4
- https://www.bleepingcomputer.com/news/security/millions-of-exim-mail-servers-are-currently-being-attacked/
- https://www.bleepingcomputer.com/news/security/critical-exim-tls-flaw-lets-attackers-remotely-execute-commands-as-root/
Acknowledgements
Thanks to Zerons for the initial report to Exim and to Qualys for providing additional analysis.
This document was written by Will Dormann, Laurie Tyzenhaus and Madison Oliver.
Other Information
CVE IDs: | CVE-2019-15846 |
Date Public: | 2019-09-06 |
Date First Published: | 2019-09-06 |
Date Last Updated: | 2019-09-18 15:15 UTC |
Document Revision: | 88 |