The Qualys Research Team (QRT) has discovered multiple vulnerabilities in the Exim mail server, some of the which can be chained together and have devastating impact via full remote unauthenticated code execution to gain root privileges. The name “21Nails” is a pun intended on vulnerabilities in a “Mail” transfer agent, corresponding to each CVE listed in below summary.
Last fall, QRT engaged in a thorough code audit of Exim and discovered 21 unique vulnerabilities. 10 of these vulnerabilities can be exploited remotely to gain root privileges and 11 can be exploited locally; while 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. One of the vulnerabilities (CVE-2020-28017) discovered by QRT affects all the versions of Exim going back all the way to 2004.
In the past, prior to the pandemic year, the same product was exploited rigorously by Russian cyber actors, well known as the sandworm team.
Here is a quick summary of the vulnerabilities discovered by QRT:
|Link attack in Exim’s log directory
|Assorted attacks in Exim’s spool directory
|Arbitrary file creation and clobbering
|Arbitrary file deletion
|Heap buffer overflow in queue_run()
|Heap out-of-bounds write in main()
|Heap buffer overflow in parse_fix_phrase()
|Heap out-of-bounds write in parse_fix_phrase()
|New-line injection into spool header file (local)
|Missing close-on-exec flag for privileged pipe
|Integer overflow in get_stdinput()
|Integer overflow in receive_add_recipient()
|Integer overflow in receive_msg()
|Out-of-bounds read in smtp_setup_msg()
|New-line injection into spool header file (remote)
|Heap out-of-bounds read and write in extract_option()
|Line truncation and injection in spool_read_header()
|Failure to reset function pointer after BDAT error
|Heap buffer underflow in smtp_ungetc()
|Use-after-free in tls-openssl.c
|Heap out-of-bounds read in pdkim_finish_bodyhash()
QRT has come up with a PoC video presentation.
Exim Mail Server prior to 4.94.2 are vulnerable.
Qualys recommends security teams to apply patches for these vulnerabilities as soon as possible.
Qualys customers can scan their network with QID 50110 to detect vulnerable assets.
Please continue to follow Qualys Threat Protection for more coverage on latest vulnerabilities.
References and Sources