Critical Exim Mailer Flaw Allows RCE

Imagine you are a system administrator responsible for a cluster of email servers that handle thousands of messages every hour. This is not a hypothetical drill. The vulnerability, tracked as CVE-2026-45185, is a serious exim rce vulnerability that demands immediate attention. In this article, we will break down exactly what the flaw is, who is at risk, how it was discovered, and — most importantly — how to protect your systems.

exim rce vulnerability

Understanding the Exim RCE Vulnerability (CVE-2026-45185)

Exim is one of the most widely used open-source mail transfer agents on Linux and Unix systems. It handles the sending, receiving, and routing of email for countless organizations, from small web hosting companies to large universities and enterprises. On Debian and Ubuntu distributions, Exim has historically been the default mail server, making its security posture especially critical.

The flaw identified as CVE-2026-45185 is a use-after-free (UAF) vulnerability that occurs during the TLS shutdown process when the server is handling BDAT chunked SMTP traffic. In simple terms, Exim frees a memory buffer used for TLS transfer but later continues to use stale references to that buffer. An attacker who sends carefully crafted network traffic can exploit this condition to write data into freed memory, ultimately achieving remote code execution (RCE). The worst part? No authentication is required — the attacker only needs a network connection to your mail server.

How the Use-After-Free Mechanism Works

Use-after-free is a classic memory safety issue, but the specific trigger here is unusual. The vulnerability only appears when Exim is compiled with the GnuTLS library (the default) and has both STARTTLS and the CHUNKING extension advertised. During the TLS shutdown sequence, Exim releases a transfer buffer but does not properly clear all callback references. If the server receives a BDAT chunked message at precisely the right moment, the stale callback can write attacker-controlled data into the freed memory region. This can corrupt the program state and allow an attacker to hijack execution flow.

What makes this particularly dangerous is that the attack surface is exposed to any remote client that can initiate an SMTP connection. No prior access or user credentials are needed. The vulnerability exists in Exim versions 4.97 through 4.99.2 when built with GnuTLS. OpenSSL-based builds are completely unaffected.

Why GnuTLS Matters and OpenSSL Is Safe

Exim can be compiled against either GnuTLS or OpenSSL for TLS support. The default on most Linux distributions is GnuTLS, which is why so many servers are vulnerable. The specific code path that triggers the use-after-free exists only in the GnuTLS integration. If your Exim installation uses OpenSSL, you are not exposed to this particular flaw. However, it is still wise to upgrade to the latest version for general security hygiene.

Who Is Affected and What Is at Risk

Any organization running Exim versions 4.97 through 4.99.2 with GnuTLS is vulnerable. This includes a large portion of shared hosting providers, educational institutions, and businesses that rely on Debian or Ubuntu servers. The risk is not limited to the mail server itself. An attacker who gains code execution can access stored emails, read configuration files, and potentially pivot to other systems on the same network. Depending on server permissions, they might also install backdoors, launch further attacks, or exfiltrate sensitive data.

Real-World Impact: From Email Access to Full Server Compromise

Consider a small web hosting company that runs dozens of shared servers, each with Exim as the default MTA. An attacker exploiting this exim rce vulnerability could compromise one server, then use it as a foothold to attack others. They could read customer emails containing login credentials or financial information. In a university setting, an attacker could access academic communications, research data, and personal information of students and staff. The potential for data exfiltration and lateral movement is significant.

The Danger of Unauthenticated Remote Exploitation

The fact that no authentication is required makes this vulnerability especially alarming. An attacker does not need to guess passwords, exploit a separate service, or have any prior access. They simply send a malicious SMTP conversation to the server’s port 25 (or 587 for submission). This lowers the barrier to entry for malicious actors, including automated scanning tools and less sophisticated attackers. The window between disclosure and widespread exploitation can be very short.

The AI vs. Human Exploit Race

The discovery of CVE-2026-45185 was accompanied by an unusual competition. XBOW, the security company that found the flaw, set up a seven-day challenge between their autonomous AI-driven development system, XBOW Native, and a human researcher assisted by a large language model (LLM). The goal was to create a working proof-of-concept exploit.

XBOW Native’s Success on Simplified Targets

XBOW Native managed to produce a working exploit against a simplified target server that had no Address Space Layout Randomization (ASLR) and a non-PIE (Position Independent Executable) binary. This is a less realistic scenario, as modern systems typically have ASLR enabled. The AI also achieved an exploit on a machine with ASLR but still with a non-PIE binary. Notably, XBOW Native bypassed Exim’s custom memory allocator rather than targeting glibc’s allocator, showing creative exploitation techniques.

Human Researcher Wins with LLM Assistance

Despite the AI’s impressive speed, the human researcher ultimately won the race. With help from an LLM for tasks like assembling files and testing exploitation paths, the human was able to craft an exploit that worked on a more realistic target with ASLR and non-PIE. The researcher noted that LLMs alone are not yet ready to write exploits against real-world software, but they are extremely useful for understanding unfamiliar code and quickly identifying suspicious areas. This collaboration between human expertise and AI assistance represents a new frontier in security research — and a new threat if such tools fall into the wrong hands.

How to Protect Your Exim Server

The most effective mitigation is to upgrade to Exim version 4.99.3, which contains the fix. Below are the steps you should take immediately.

Upgrading to Exim 4.99.3

On Debian or Ubuntu systems, you can update Exim through the package manager. Run the following commands as root:

sudo apt update
sudo apt upgrade exim4

After upgrading, restart the Exim service:

sudo systemctl restart exim4

Verify the installed version with:

You may also enjoy reading: 73s to Breach, 24h to Patch: The Case for Auto Validation.

exim --version | head -n 1

You should see version 4.99.3 or later. If your distribution does not yet have the updated package, consider using the official Exim source or backporting from a newer release.

Verifying Your Exim Build

If you are unsure whether your Exim uses GnuTLS or OpenSSL, check the build options. Run:

exim -bV | grep -i tls

Look for lines mentioning “GnuTLS” or “OpenSSL”. If you see GnuTLS and your version is between 4.97 and 4.99.2, you are vulnerable. If you see OpenSSL, you are safe from this specific flaw, but you should still upgrade to the latest version.

Configuration Workarounds if Patching Is Delayed

If you cannot immediately upgrade, you can reduce the attack surface by disabling the CHUNKING extension (BDAT support) or disabling STARTTLS. However, these changes may break email delivery for some clients. A more targeted workaround is to switch Exim to use OpenSSL instead of GnuTLS, but that requires recompilation. In most cases, patching is the safest and simplest approach.

Checking for Signs of Compromise

After applying the fix, you should also check whether your server has already been exploited. Look for unusual processes, unexpected outbound connections, or modified system binaries. Examine Exim logs (typically in /var/log/exim4/) for suspicious patterns such as repeated connection attempts from unknown IPs, or error messages related to memory corruption. If you suspect a breach, isolate the server and conduct a full forensic investigation.

Frequently Asked Questions

How can I determine if my Exim installation is vulnerable if I’m not sure whether it was compiled with GnuTLS?

Run exim -bV | grep -i tls as described above. If you see “GnuTLS” and your version is between 4.97 and 4.99.2, you are vulnerable. If you see “OpenSSL”, you are safe.

What steps should I take to verify that my email server is not already compromised due to this flaw?

Review Exim logs for anomalies, check for unauthorized processes, and run a vulnerability scanner that can detect signs of exploitation. Also, monitor network traffic for unexpected outbound connections.

If I cannot immediately upgrade to Exim 4.99.3, are there configuration changes that can reduce the attack surface?

Yes, you can disable CHUNKING by setting chunking_advertise_hosts = (empty) in your Exim configuration, or disable STARTTLS by removing or commenting out TLS-related options. These are partial mitigations that may impact functionality.

Why does the use-after-free specifically occur during TLS shutdown with BDAT chunked SMTP?

The timing of the buffer release and the callback reference is critical. When Exim processes a BDAT chunk during the TLS shutdown sequence, it frees a transfer buffer but leaves a callback pointer dangling. A subsequent write operation through that pointer writes into freed memory, allowing code execution.

Does this vulnerability affect Exim when it is used as an outgoing mail relay only, or also when receiving mail from external sources?

It affects any Exim server that accepts connections from external sources on SMTP ports. If your Exim is configured to only relay outgoing mail from authenticated users and does not accept incoming connections from the internet, the attack surface is reduced. However, many servers accept external mail by default.

Add Comment