CVE-2026-141382 — Exim — CWE-787
Exim before 4.100.3 allows attackers to send SMTP traffic that triggers a heap out-of-bounds write in expansion code running as root. NOTE: this issue occurs because of an incomplete fix for CVE-2026-137702.
Exim before 4.100.3 allows attackers to send SMTP traffic that triggers a heap out-of-bounds write in expansion code running as root. NOTE: this issue occurs because of an incomplete fix for CVE-2026-137702.
🎯 What is this vulnerability?
CVE-2026-141382 is a Heap Out-of-Bounds Write (OOB Write) vulnerability in the Exim mail transfer agent (MTA), specifically affecting versions prior to 4.100.3. The flaw resides in the string expansion code (used for processing variables like $sender_address, $local_part, etc., within Exim configuration files and SMTP commands).
Technical Breakdown:
1. CWE-787 (Out-of-bounds Write): The core issue is that the memory allocator or buffer management logic in the expansion routine fails to correctly calculate or enforce the bounds of a heap-allocated buffer. 2. Incomplete Fix for CVE-2026-137702: This is a regression or incomplete patch. The previous vulnerability (CVE-2026-137702) likely addressed a similar OOB write, but the fix did not cover all code paths or edge cases in the expansion engine. 3. Root Privilege Context: Exim typically runs as theexim user for network-facing processes, but certain components (like the exim daemon itself during specific phases, or if configured to run as root for certain operations like DNS lookups or local delivery) may execute with elevated privileges. The CVE explicitly states the expansion code runs as root. This is critical: if the expansion code is triggered in a context where the process has root privileges (e.g., during local delivery or specific ACL checks that drop privileges later), an OOB write can corrupt heap metadata or function pointers, leading to arbitrary code execution with root privileges.
4. Trigger Mechanism: The vulnerability is triggered by SMTP traffic. An attacker sends a specially crafted SMTP command (likely in the MAIL FROM:, RCPT TO:, or DATA section) that contains a string which, when expanded by Exim’s internal variable expansion engine, causes the heap write to overflow.Why is it dangerous?
- Unauthenticated (PR:N): No login required.
- Network Vector (AV:N): Exploitable remotely via SMTP.
- High Complexity (AC:H): Crafting a reliable heap OOB write to achieve RCE is complex due to ASLR, stack canaries, and heap layout randomness. However, the high impact (C:H/I:H/A:H) and root execution make it a critical threat if exploited.
- No User Interaction (UI:N): Fully automated.
- Banner Grabbing: Use
nmaporncto connect to port 25 and read the SMTP banner.
⚡ Attack Chain
1. Discovery & Reconnaissance
nmap -sV -p 25 --script smtp-enum-users target_ip
# Output: Exim 4.100.2 (or earlier)2. Exploitation
The attacker crafts a malicious SMTP session. The exact payload depends on the specific heap layout and the incomplete fix details, but it generally involves:MAIL FROM: or RCPT TO: command with a specially crafted string that triggers the vulnerable expansion path.Illustrative PoC (Conceptual):
Note: The exact payload is not publicly disclosed in the CVE description. The following is an illustrative example of how such a vulnerability might be triggered. It is not a working exploit.
# Illustrative SMTP session
nc target_ip 25
EHLO attacker.com
MAIL FROM:<[email protected]>
# The following RCPT TO: line contains a crafted string that triggers the OOB write
# The string is designed to overflow the heap buffer in the expansion code
RCPT TO:<"$(python3 -c 'print("A"*1000 + "\x41\x41\x41\x41")')"@target.com>
DATA
Subject: Test
From: [email protected]
To: [email protected]
Hello
.
QUITKey Technical Details:
RCPT TO: is processed by Exim’s expansion engine.3. Post-Exploitation
/etc/shadow, SSH keys, and other sensitive files.🌍 Real World Impact
🛡️ Remediation & Mitigation
1. Patching
# Debian/Ubuntu
sudo apt update && sudo apt upgrade exim4
# RHEL/CentOS
sudo yum update exim
# Compile from source
wget https://exim.org/exim.html
# Follow compilation instructions for version 4.100.3+2. Workarounds (Temporary)
iptables -A INPUT -p tcp --dport 25 -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 25 -j DROP3. Detection
/var/log/exim4/mainlog or /var/log/maillog) for unusual SMTP commands, especially those with very long or malformed RCPT TO: or MAIL FROM: fields.
- Example Log Pattern:2026-12-01 12:00:00 1abc1234567890 Q=1 R=1 S=100 T=1
2026-12-01 12:00:00 1abc1234567890 => [email protected] [192.168.1.100]
2026-12-01 12:00:00 1abc1234567890 ** Failed: heap corruption detectedSecRule REQUEST_URI "@rx (RCPT TO:.*[A-Z]{100,})" \
"id:100001,phase:1,deny,status:403,msg:'Potential Exim OOB Write Attack'"⚠️ Urgency
[🤖 CVE Professor AI Security Engine]
FOFA Query