Malicious emails

A critical zero-day vulnerability in all versions of Exim mail transfer agent (MTA) software can let unauthenticated attackers gain remote code execution (RCE) on Internet-exposed servers.

Found by an anonymous security researcher and disclosed through Trend Micro's Zero Day Initiative (ZDI), the security bug (CVE-2023-42115) is due to an Out-of-bounds Write weakness found in the SMTP service.

While this type of issue can lead to software crashes or corruption of data following successful exploitation, it can also be abused by attackers for code or command execution on vulnerable servers.

"The specific flaw exists within the smtp service, which listens on TCP port 25 by default," a ZDI security advisory published on Wednesday explains.

"The issue results from the lack of proper validation of user-supplied data, which can result in a write past the end of a buffer. An attacker can leverage this vulnerability to execute code in the context of the service account."

While ZDI reported the vulnerability to the Exim team in June 2022 and resent info on the flaw at the vendor's request in May 2023, the developers failed to provide an update on their patch progress.

As a result, ZDI published an advisory on September 27, with details on the CVE-2023-42115 zero-day and a full timeline of all exchanges with the Exim team.

Millions of servers exposed to attacks

MTA servers like Exim are highly vulnerable targets, primarily because they are often accessible via the Internet, serving as easy entry points for attackers into a target's network.

The National Security Agency (NSA) said three years ago, in May 2020, that the notorious Russian military hacking group Sandworm has been exploiting the critical CVE-2019-10149 (The Return of the WIZard) Exim flaw since at least August 2019.

Exim is also the default MTA on Debian Linux distros and the world's most popular MTA software, according to a mail server survey from early September 2023.

According to the survey, Exim is installed on more than 56% out of a total of 602,000 mail servers reachable on the Internet, representing just over 342,000 Exim servers.

Just over 3.5 million Exim servers are currently exposed online per a Shodan search, most of them in the United States, followed by Russia and Germany.

Vulnerable Exim servers (CVE-2023-42115)
Vulnerable Exim servers (Shodan)

While a patch is not yet available to secure vulnerable Exim servers against potential attacks, ZDI advised admins to restrict remote access from the Internet to thwart incoming exploitation attempts.

"Given the nature of the vulnerability, the only salient mitigation strategy is to restrict interaction with the application," ZDI warned.

Private patches and other bugs waiting for a fix

ZDI also disclosed five other Exim zero-days with lower severity ratings this week, tagged as high and medium severity:

Exim developer Heiko Schlittermann revealed on the Open Source Security (oss-sec) mailing list after this article was published that "fixes are available in a protected repository" for CVE-2023-42114, CVE-2023-42115, and CVE-2023-42116, and are "ready to be applied by the distribution maintainers."

"The remaining issues are debatable or miss information we need to fix them. We're more than happy to provide fixes for all issues as soon as we receive detailed information," Schlittermann added.

A ZDI representative replied to the oss-sec thread saying that the advisories published this week would be updated and the zero-day tag removed as soon as Exim publishes patches. 

"The ZDI reached out multiple times to the developers regarding multiple bug reports with little progress to show for it. After our disclosure timeline was exceeded by many months, we notified the maintainer of our intent to publicly disclose these bugs, at which time we were told, "you do what you do," the ZDI representative said.

"If these bugs have been appropriately addressed, we will update our advisories with a link to the security advisory, code check-in, or other public documentation closing the issue." 

Update: Added info on the other Exim five flaws disclosed by ZDI and Exim's private patches.

Related Articles:

Palo Alto Networks fixes zero-day exploited to backdoor firewalls

Critical RCE bug in 92,000 D-Link NAS devices now exploited in attacks

New Ivanti RCE flaw may impact 16,000 exposed VPN gateways

Over 1,400 CrushFTP servers vulnerable to actively exploited bug

Maximum severity Flowmon bug has a public exploit, patch now