The Qualys Research Team has discovered multiple critical vulnerabilities in the Exim mail server, some of which can be chained together to obtain full remote unauthenticated code execution and gain root privileges. Qualys recommends security teams to apply patches for these vulnerabilities as soon as possible.
About Exim
Exim is a popular mail transfer agent (MTA) available for major Unix-like operating systems and comes pre-installed on Linux distributions such as Debian. According to a recent survey, an estimated 60% of internet servers run on Exim. A Shodan search reveals nearly 4 million Exim servers are exposed to the internet.
Mail Transfer Agents are interesting targets for attackers because they are usually accessible over the internet. Once exploited, they could modify sensitive email settings on the mail servers, allow adversaries to create new accounts on the target mail servers. Last year, the vulnerability in the Exim Mail Transfer Agent (MTA) was a target of Russian cyber actors formally known as the sandworm team.
Exim vulnerabilities
Last fall, the Qualys Research Team engaged in a thorough code audit of Exim and discovered 21 unique vulnerabilities. Ten of these vulnerabilities can be exploited remotely. Some of them leading to provide root privileges on the remote system. And eleven can be exploited locally with most of them can be exploited in either default configuration or in a very common configuration.
Some of the vulnerabilities can be chained together to obtain a full remote unauthenticated code execution and gain root privileges on the Exim Server. Most of the vulnerabilities discovered by the Qualys Research Team for e.g. CVE-2020-28017 affects all versions of Exim going back all the way to 2004 (going back to the beginning of its Git history 17 years ago).
Proof of concept
Vulnerability Summary
Successful exploitation of these vulnerabilities would allow a remote attacker to gain full root privileges on the target server and execute commands to install programs, modify data, and create new accounts. Qualys security researchers independently verified these vulnerabilities and developed exploits to obtain full root privileges.
CVE | Description | Type |
---|---|---|
CVE-2020-28007 | Link attack in Exim’s log directory | Local |
CVE-2020-28008 | Assorted attacks in Exim’s spool directory | Local |
CVE-2020-28014 | Arbitrary file creation and clobbering | Local |
CVE-2021-27216 | Arbitrary file deletion | Local |
CVE-2020-28011 | Heap buffer overflow in queue_run() | Local |
CVE-2020-28010 | Heap out-of-bounds write in main() | Local |
CVE-2020-28013 | Heap buffer overflow in parse_fix_phrase() | Local |
CVE-2020-28016 | Heap out-of-bounds write in parse_fix_phrase() | Local |
CVE-2020-28015 | New-line injection into spool header file (local) | Local |
CVE-2020-28012 | Missing close-on-exec flag for privileged pipe | Local |
CVE-2020-28009 | Integer overflow in get_stdinput() | Local |
CVE-2020-28017 | Integer overflow in receive_add_recipient() | Remote |
CVE-2020-28020 | Integer overflow in receive_msg() | Remote |
CVE-2020-28023 | Out-of-bounds read in smtp_setup_msg() | Remote |
CVE-2020-28021 | New-line injection into spool header file (remote) | Remote |
CVE-2020-28022 | Heap out-of-bounds read and write in extract_option() | Remote |
CVE-2020-28026 | Line truncation and injection in spool_read_header() | Remote |
CVE-2020-28019 | Failure to reset function pointer after BDAT error | Remote |
CVE-2020-28024 | Heap buffer underflow in smtp_ungetc() | Remote |
CVE-2020-28018 | Use-after-free in tls-openssl.c | Remote |
CVE-2020-28025 | Heap out-of-bounds read in pdkim_finish_bodyhash() | Remote |