Exim SMTP Mail Server base64d Buffer Overflow Remote Code Execution (RCE) Vulnerability (CVE-2018-6789)
Executive & SecOps Summary
SECOPS ASSESSMENTAll Exim versions before 4.90.1 with active SMTP listener
Unauthenticated remote attackers can execute arbitrary code with root privileges by sending specially crafted Base64 messages
Immediately upgrade Exim mail servers to the latest stable version (4.90.1 or higher) and restrict SMTP access
Affected Products & Version Scope
Remediation & Live Workaround Commands
PATCH & WORKAROUND1. Official Patch & Version Upgrade Commands
The primary remediation is upgrading the Exim package to version 4.90.1 or later. Use the system package manager to apply the update.
# For Debian/Ubuntu-based systems
sudo apt-get update
sudo apt-get install --only-upgrade exim4 -y
# For RHEL/CentOS-based systems
sudo yum update exim -y
# Or using dnf
sudo dnf upgrade exim -y
# Restart Exim service and verify the version
sudo systemctl restart exim4 || sudo systemctl restart exim
exim -bV | grep 'Exim version'2. Temporary Workaround & Hardening Configuration
If immediate patching is not feasible, restrict access to SMTP ports (25, 465, 587) using firewalls, or temporarily disable vulnerable authentication mechanisms in the Exim configuration.
# Restrict SMTP access to trusted IP ranges using iptables
sudo iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 25 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 25 -j DROP
# Review and temporarily disable unused AUTH mechanisms in Exim configuration
# (e.g., /etc/exim4/exim4.conf or /etc/exim/exim.conf)3. Log Audit & IoC Verification Commands
Inspect Exim log files for abnormal AUTH requests, extremely long Base64 strings, or unexpected process crashes.
# Search for abnormal AUTH attempts or segmentation faults in Exim logs
sudo grep -i -E 'auth|segmentation fault|core dumped' /var/log/exim4/mainlog /var/log/exim4/paniclog 2>/dev/null
# Script to check if the running Exim version is vulnerable
CURRENT_VER=$(exim -bV | head -n 1 | awk '{print $3}')
REQUIRED_VER='4.90.1'
if [ '$(printf '%s\
%s' "$REQUIRED_VER" "$CURRENT_VER" | sort -V | head -n1)' != "$REQUIRED_VER" ]; then
echo '[WARNING] Current Exim version '$CURRENT_VER' is vulnerable. Upgrade is required.'
else
echo '[OK] Exim version '$CURRENT_VER' is secure.'
fiStop Exposing VPN Ports to the Internet — Switch to Zero-Trust Access
Eliminate public-facing VPN concentrators and firewall management ports with identity-first Zero-Trust Network Access.
Technical Root Cause & Exploitation Mechanics
1. Vulnerability Overview & Root Cause
This vulnerability is a heap-based buffer overflow in the base64d function within the SMTP listener of the Exim Mail Transfer Agent (MTA). During the Base64 decoding process, an 'Off-by-one' calculation error occurs when determining the buffer size required to store the decoded data. This miscalculation leads to writing beyond the allocated buffer, corrupting the metadata of adjacent heap chunks.
2. Exploitation Mechanics & Attack Scenario
An attacker initiates an SMTP session and triggers a mechanism that requires Base64 decoding, such as AUTH CRAM-MD5 or AUTH PLAIN. By transmitting a meticulously sized Base64 string, the attacker triggers the off-by-one overflow in base64d, overwriting the size header of an adjacent free heap chunk. Through precise heap grooming, the attacker can manipulate Exim's internal memory allocator to overwrite function pointers, ultimately achieving arbitrary remote code execution (RCE).
3. Infrastructure & Business Impact
Exim is one of the most widely deployed MTAs globally. This vulnerability has a critical CVSS score of 9.8 and is listed in the CISA KEV (Known Exploited Vulnerabilities) catalog, indicating active exploitation in the wild. Since exploitation does not require authentication and can be executed remotely over standard SMTP ports (25, 465, 587), successful attacks can lead to complete server compromise, data exfiltration, and lateral movement within the enterprise network.
Official Vendor Advisories & References
An issue was discovered in the base64d function in the SMTP listener in Exim before 4.90.1. By sending a handcrafted message, a buffer overflow may happen. This can be used to execute code remotely.
Frequently Asked SecOps Questions (CVE-2018-6789)
FAQQ1. How critical is CVE-2018-6789 and is it actively exploited in the wild?
CVE-2018-6789 is rated CVSS 9.8 (CRITICAL) with a 30-day EPSS exploitation probability of 82.1%. It is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, requiring immediate emergency remediation.
Q2. Which vendors and products are affected by CVE-2018-6789?
Primary impacted vendors include exim across exim. Scope summary: All Exim versions prior to 4.90.1
Q3. What temporary mitigations or workarounds exist for CVE-2018-6789 before patching?
[Mitigation] Immediately upgrade Exim mail servers to the latest stable version (4.90.1 or higher) and restrict SMTP access Follow the CLI remediation commands and interactive SecOps checklist on this page to restrict exposure prior to your maintenance window.
Generate an Internal Engineering Notice or CISO Report for CVE-2018-6789
Instantly format this advisory into an executive CISO summary or engineering patch ticket.
🔗 Related Advisories in Similar Stack (exim)
View Category →Arista VeloCloud Orchestrator (VCO) Remote Code Execution and Privilege Escalation (CVE-2026-93952)
[Affected Scope] Arista VeloCloud Orchestrator (VCO) On-premise deployments.
Cisco Identity Services Engine (ISE) Critical Authentication Bypass Vulnerability (CVE-2026-76460)
[Affected Scope] Cisco Identity Services Engine (ISE) web-based management interface and API endpoints.
SonicWall SMA1000 Work Place Pre-Authentication Server-Side Request Forgery (SSRF) Vulnerability (CVE-2026-83548)
[Affected Scope] SonicWall SMA1000 Series Appliance Work Place interface
Arista VeloCloud Orchestrator (VCO) On-Premises Remote Code Execution and Privilege Bypass (CVE-2026-16812)
[Affected Scope] On-premises deployments of VeloCloud Orchestrator (VCO)
Subscribe to Daily Vulnerability Briefings & KEV Alerts
Concise morning briefings for SecOps, DevSecOps, and SRE teams covering newly exploited CVEs and mitigation priorities.