Cloudanix VulnDB

CVE-2023-42116

High · 8.1

CVSS

8.1

EPSS

3.8%

Published

May 3, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in widely used email server software lets attackers take over the system remotely without logging in, putting email systems and the data they handle at risk.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Moderate
Impact
Remote Code Execution
Component
Network Service
Class
Buffer Overflow
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Stack-based buffer overflow in Exim's handling of NTLM challenge requests due to missing length validation on user-supplied data copied into a fixed-size stack buffer, enabling remote code execution in the context of the Exim service account without authentication.

Why it matters to the business

Compromise of mail servers can lead to unauthorized access to email traffic, data exfiltration, or use as a foothold for further network attacks; the vulnerability has been public for over two years with slowly rising exploit probability.

How an attack unfolds

An unauthenticated attacker connects to an exposed Exim SMTP service and sends a specially crafted NTLM challenge request containing oversized data; the lack of bounds checking overflows the stack buffer, allowing the attacker to overwrite the return address and execute arbitrary code.

How to fix it

Upgrade Exim to the commit b9e0b12d9b665bbff996382264d4ba97d1a61efd or later; rebuild from the fixed GIT source and redeploy; disable NTLM authentication if not required until patched.

How to confirm the fix worked

Verify the running Exim binary or source matches commit b9e0b12d9b665bbff996382264d4ba97d1a61efd; test SMTP AUTH NTLM handling with crafted oversized challenges in a lab environment to confirm absence of crash or code execution.

Typical attack path

  1. Establish TCP connection to Exim SMTP listener (typically port 25/587)
  2. Issue AUTH NTLM or equivalent challenge initiation command
  3. Supply oversized NTLM challenge data exceeding buffer capacity
  4. Trigger return-address overwrite to redirect execution to attacker-controlled payload
  5. Achieve code execution within the Exim process context

How to detect it

Inspect Exim SMTP logs and network captures for NTLM AUTH sequences containing unusually large challenge payloads; correlate with process crashes or unexpected child process spawns under the Exim service account.

  • NTLM challenge lengths exceeding typical 1-2 KB in SMTP AUTH transactions
  • Exim process segfault or abort signals immediately following AUTH NTLM commands
  • Unexpected execution of /bin/sh or similar shells spawned from the Exim daemon

What your security team should do

  • Immediately upgrade all Exim installations to the fixed commit b9e0b12d9b665bbff996382264d4ba97d1a61efd
  • Restrict inbound SMTP access to trusted sources until patches are applied
  • Monitor EPSS trend and threat intelligence feeds for any increase in exploitation activity
  • Review mail server logs for anomalous NTLM authentication attempts

The record

Exim SMTP Challenge Stack-based Buffer Overflow Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Exim. Authentication is not required to exploit this vulnerability. The specific flaw exists within the handling of NTLM challenge requests. The issue results from the lack of proper validation of the length of user-supplied data prior to copying it to a fixed-length stack-based buffer. An attacker can leverage this vulnerability to execute code in the context of the service account. Was ZDI-CAN-17515.

Affected packages

Ecosystem Package Introduced Fixed
Chainguard exim 0 4.96.1-r0
Chainguard exim-cdb 0 4.96.1-r0
Chainguard exim-dbmdb 0 4.96.1-r0
Chainguard exim-dnsdb 0 4.96.1-r0
Chainguard exim-doc 0 4.96.1-r0
Chainguard exim-mysql 0 4.96.1-r0
Chainguard exim-pgsql 0 4.96.1-r0
Chainguard exim-scripts 0 4.96.1-r0
Chainguard exim-sqlite 0 4.96.1-r0
Chainguard exim-utils 0 4.96.1-r0
Debian:10 exim4 0 4.92-8+deb10u8
Debian:11 exim4 0 4.94.2-7+deb11u1
Debian:12 exim4 0 4.96-15+deb12u2
Debian:13 exim4 0 4.97~RC1-2
SUSE:Package Hub 15 SP4 exim 0 4.94.2-bp155.5.3.1
SUSE:Package Hub 15 SP5 exim 0 4.94.2-bp155.5.3.1
SUSE:Package Hub 15 SP5 exim 0 4.97.1-bp155.5.9.1
Ubuntu:20.04:LTS exim4 0 4.93-13ubuntu1.8
Ubuntu:22.04:LTS exim4 0 4.95-4ubuntu2.3
Ubuntu:Pro:14.04:LTS exim4 0 4.82-3ubuntu2.4+esm6
Ubuntu:Pro:16.04:LTS exim4 0 4.86.2-2ubuntu2.6+esm4
Ubuntu:Pro:18.04:LTS exim4 0 4.90.1-1ubuntu1.10+esm1
Wolfi exim 0 4.96.1-r0
Wolfi exim-cdb 0 4.96.1-r0
Wolfi exim-dbmdb 0 4.96.1-r0
Wolfi exim-dnsdb 0 4.96.1-r0
Wolfi exim-doc 0 4.96.1-r0
Wolfi exim-mysql 0 4.96.1-r0
Wolfi exim-pgsql 0 4.96.1-r0
Wolfi exim-scripts 0 4.96.1-r0
Wolfi exim-sqlite 0 4.96.1-r0
Wolfi exim-utils 0 4.96.1-r0
openSUSE:Leap 15.4 exim 0 4.94.2-bp155.5.3.1
openSUSE:Leap 15.5 exim 0 4.94.2-bp155.5.3.1
openSUSE:Leap 15.5 exim 0 4.97.1-bp155.5.9.1
openSUSE:Tumbleweed exim 0 4.96.1-1.1

Related vulnerabilities