CVE Professor
/
All CVEs
CVE-2026-137702

CVE-2026-137702 — Exim (4.100.2) — CWE-787

HIGH CVSS 8.1 CVE.org

Exim before 4.100.2 allows attackers to send SMTP traffic that triggers a heap out-of-bounds write in expansion code running as root.

Exim before 4.100.2 allows attackers to send SMTP traffic that triggers a heap out-of-bounds write in expansion code running as root.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Attack Vector Network AV:N
Attack Complexity High AC:H
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality High C:H
Integrity High I:H
Availability High A:H
AI Security Analysis & Remediation

🎯 What is this vulnerability?

CVE-2026-137702 is a Heap Out-of-Bounds Write (OOB Write) vulnerability in the Exim mail transfer agent (MTA), specifically affecting versions prior to 4.100.2.

Technical Flaw Analysis

  • CWE-787: Out-of-bounds Write: The core issue lies in Exim's expansion code. Exim uses a powerful string expansion mechanism (similar to printf but with custom variables like $sender_address, $domain, etc.) to process SMTP commands and configure routing.
  • Root Cause: The expansion engine fails to correctly calculate or enforce the bounds of the destination buffer when processing specific, maliciously crafted SMTP input. This results in writing data beyond the allocated heap memory block.
  • Privilege Context: The description explicitly states the code runs as root. This is critical because Exim typically drops privileges for the main MTA process, but certain initialization, configuration parsing, or specific expansion contexts (such as those triggered during SMTP session setup or specific ACL checks) may still execute with elevated privileges or in a context where a heap corruption can lead to code execution with high impact.
  • Trigger: The vulnerability is triggered by SMTP traffic. An attacker does not need to be an authenticated user; they only need to be able to open an SMTP connection to the target server.
  • CVSS Vector Breakdown

  • AV:N (Network): Exploitable remotely over the network.
  • AC:H (High Complexity): The heap OOB write requires precise control over heap layout and memory corruption to achieve reliable code execution. This is not a simple buffer overflow; it requires bypassing ASLR, stack canaries, and heap protections.
  • PR:N (No Privileges): No authentication is required.
  • UI:N (No User Interaction): No user action is needed.
  • S:U (Unchanged Scope): The vulnerable component and the impacted component are the same (the Exim process).
  • C:H/I:H/A:H (High Impact): Successful exploitation leads to full compromise of the mail server, including data exfiltration, integrity modification (e.g., altering mail flow), and availability loss (DoS).
  • ⚡ Attack Chain

    1. Discovery & Reconnaissance

  • Port Scanning: Identify open port 25 (SMTP) on the target network.
  • Banner Grabbing: Use tools like nmap with the smtp-enum-users or smtp-brute scripts, or simply nc/telnet to retrieve the Exim version banner.
  • nmap -sV -p 25 --script smtp-enum-users <target_ip>
        # Or manually:
        nc <target_ip> 25
        # Look for: "220 <hostname> ESMTP Exim 4.100.1"
  • Version Verification: Confirm the version is < 4.100.2. If the banner is hidden, use SMTP EHLO and STARTTLS to probe for version leaks or use passive OSINT.
  • 2. Exploitation

  • Mechanism: The attacker crafts a specific SMTP command (likely EHLO, MAIL FROM, or RCPT TO) that triggers the vulnerable expansion code. The payload must be carefully constructed to:
  • 1. Corrupt heap metadata. 2. Overwrite a function pointer or vtable entry. 3. Redirect execution flow to shellcode or a ROP chain. PoC (Illustrative): Note: The exact byte sequence is not publicly disclosed in the CVE description. The following is an illustrative example of how such an exploit might be structured in a real-world scenario.*
    import socket
        import struct
    
        def exploit_exim_heap_oob(target_ip, target_port=25):
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.connect((target_ip, target_port))
            
            # Receive banner
            banner = s.recv(1024)
            print(f"[+] Banner: {banner.decode()}")
    
            # Craft malicious SMTP command
            # This is a placeholder for the actual exploit payload.
            # In reality, this would involve:
            # 1. Heap grooming (allocating specific objects)
            # 2. Triggering the OOB write with controlled data
            # 3. Overwriting a critical pointer
            # 4. Executing shellcode
            
            # Example: Malicious EHLO command with crafted domain
            # The domain string is processed by the expansion code
            malicious_domain = "A" * 1000 + struct.pack("<I", 0x41414141) # Illustrative
            payload = f"EHLO {malicious_domain}\r\n"
            
            s.send(payload.encode())
            response = s.recv(1024)
            print(f"[+] Response: {response.decode()}")
            
            # If successful, the server may crash or execute code.
            # For RCE, the payload would include shellcode or a ROP chain.
            # Example shellcode (x86_64) to reverse shell:
            # shellcode = b"\x31\xf6\x56\x6a\x29\x59\x6a\x2f\x5a\x..."
            
            s.close()
    
        # exploit_exim_heap_oob("192.168.1.100")
  • Key Challenge: Due to AC:H, the exploit is highly complex. It requires:
  • * Bypassing ASLR (Address Space Layout Randomization). * Bypassing Stack Canaries. * Bypassing Heap Protections (e.g., glibc heap hardening). * Precise control over the heap layout to ensure the OOB write hits the correct memory location.

    3. Post-Exploitation

  • Code Execution: If the exploit succeeds, the attacker gains code execution in the context of the Exim process.
  • Privilege Context: Since the description states the code runs as root, the attacker likely gains root-level access to the mail server.
  • Actions:
  • * Reverse Shell: Establish a persistent reverse shell for remote access. * Data Exfiltration: Access mail spools (/var/spool/mail), user credentials, and sensitive data stored on the server. * Lateral Movement: Use the compromised mail server as a pivot point to attack other internal systems. * Persistence: Install rootkits, modify cron jobs, or create backdoor accounts. * Mail Manipulation: Alter mail flow, inject malicious emails, or use the server for phishing campaigns.

    🌍 Real World Impact

  • Confidentiality (High): Attackers can read all emails passing through the server, including sensitive business communications, personal data, and credentials.
  • Integrity (High): Attackers can modify emails, inject malicious content, or alter mail routing to intercept or delete messages.
  • Availability (High): The heap corruption can cause the Exim process to crash, leading to a Denial of Service (DoS) for all mail services.
  • Practical Consequences

  • Data Breach: Exposure of confidential emails, leading to potential regulatory fines (GDPR, HIPAA) and reputational damage.
  • Phishing & Spam: Compromised mail servers are often used to send phishing emails or spam, damaging the organization's reputation and triggering blacklisting.
  • Network Compromise: Root access to a mail server provides a foothold in the network, enabling lateral movement to other critical systems.
  • 🛡️ Remediation & Mitigation

    1. Upgrade (Primary Fix)

  • Action: Upgrade Exim to version 4.100.2 or later.
  • Command:
  • # Debian/Ubuntu
        sudo apt update && sudo apt upgrade exim4
    
        # RHEL/CentOS
        sudo yum update exim
  • Verification:
  • exim -v
        # Should show: Exim version 4.100.2

    2. Workarounds (If Immediate Upgrade is Not Possible)

  • Restrict SMTP Access:
  • * Use firewall rules to restrict SMTP access to trusted IP ranges only. * Disable public SMTP access if not required.
    # Example iptables rule to allow SMTP only from internal network
        iptables -A INPUT -p tcp --dport 25 -s 192.168.1.0/24 -j ACCEPT
        iptables -A INPUT -p tcp --dport 25 -j DROP
  • Disable Unnecessary Expansion Features:
  • * Review Exim configuration (/etc/exim4/exim4.conf) and disable any unnecessary string expansion features or ACLs that might trigger the vulnerable code path. Note: This is difficult to implement precisely without knowing the exact trigger, so it is not a reliable mitigation.*
  • WAF/ModSecurity:
  • * While WAFs are not typically used for SMTP, if the mail server is behind a reverse proxy or if SMTP is exposed via a web interface, implement strict input validation. Note: For direct SMTP, WAFs are not effective. Firewall restrictions are the primary mitigation.*

    3. Detection

  • Log Monitoring:
  • * Monitor Exim logs (/var/log/exim4/mainlog) for unusual SMTP commands, especially those with very long or malformed domains. * Look for patterns of repeated connection attempts from the same IP.
  • IoCs (Indicators of Compromise):
  • * Unexpected processes running as root on the mail server. * New cron jobs or systemd services. * Unusual outbound network connections from the mail server. * High CPU usage or memory spikes on the mail server.
  • File Integrity Monitoring (FIM):
  • * Monitor for changes to Exim binaries or configuration files.

    ⚠️ Urgency

  • CVSS Score: 8.1 (HIGH)
  • CISA KEV: No (Not currently listed in the Known Exploited Vulnerabilities catalog)
  • Exploit Complexity: High (AC:H)
  • Patching Priority: HIGH

  • Rationale: Although the exploit complexity is high, the impact is severe (root-level RCE, data breach, DoS). The vulnerability is network-exploitable without authentication. While not currently in CISA KEV, the potential for exploitation is significant, especially if a public exploit is released.
  • Recommendation:
1. Immediate: Apply the patch to all internet-facing Exim servers. 2. Short-term: Restrict SMTP access to trusted IPs if patching is delayed. 3. Ongoing: Monitor for signs of exploitation and keep Exim updated.

Note: Since this is a heap OOB write, it is less likely to be exploited in the wild immediately compared to simpler buffer overflows, but it remains a critical vulnerability that should be patched as soon as possible.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="Exim Exim"
CVSS Score
8.1 / 10 · CVSS HIGH
Weakness Types (CWE)
Affected Products (1)
Exim:Exim (4.100.2)
References & Advisories (2)
Related CVEs
9.2
CVE-2026-144499
ASN1SCC before 4.7.0.1 contains an out-of-bounds write vulnerability in the SequenceOf_decode template in StgC
8.1
CVE-2026-92728
A heap out-of-bounds write flaw was found in GRUB2's DNS response parser. In recv_hook() (grub-core/net/dns.c)
7.3
CVE-2026-129782
Out-of-bounds write in the zwlr_virtual_pointer_v1 protocol implementation of Hyprland for Linux, versions 0.5
7.2
CVE-2026-145314
A heap out-of-bounds write exists in the MPEG-1/2 video decoder (libavcodec/mpeg12dec.c) in FFmpeg before 6.1.
9.3
CVE-2026-88766
Out of Bounds Write when processing a crafted APDU command via the VSIM service due to a stack-based buffer ov
8.8
CVE-2026-125688
An out-of-bounds write in the screen-image decoder of TeamViewer Full Client for Linux prior to version 15.84
8.8
CVE-2026-125689
An out-of-bounds write vulnerability in TeamViewer Full Client prior to version 15.84 has been identified in t