Skip to content
Server Security Center
KEVcritical9.8 Used in ransomware campaigns

CVE-2018-6789: Exim Buffer Overflow

Exim · listed in the CISA catalog of actively exploited vulnerabilities since 2021-11-03.

CVSS v3.1 (CVE record)
9.8
critical
EPSS (exploit probability, 30 days)
82%
higher than 99.6% of all CVEs
Added to CISA KEV
2021-11-03
US federal due date 2022-05-03
Ubuntu priority
medium

CVE-2018-6789 explained

CVE-2018-6789 is a buffer overflow in the base64d function of the SMTP listener in Exim before 4.90.1. A remote sender can trigger it with a handcrafted message and may execute code on the mail server. The flaw is listed in CISA's Known Exploited Vulnerabilities catalog with known ransomware use.

Impact

An unauthenticated attacker who can reach the Exim SMTP listener over the network can send a handcrafted message that overflows a buffer. This may lead to remote code execution. No user interaction or privileges are needed and attack complexity is low. A successful attack can fully compromise the confidentiality, integrity and availability of the mail server. CISA reports active exploitation, including use in ransomware campaigns.

Who is affected

The facts list the exim4 source package on two Ubuntu releases, both end of life. Ubuntu 14.04 LTS is fixed in 4.82-3ubuntu2.4. Ubuntu 16.04 LTS is fixed in 4.86.2-2ubuntu2.3. Both fixes are in the standard archive. Upstream, Exim versions before 4.90.1 are affected. No Debian releases are listed in the facts.

Written with AI from the data on this page and checked against it automatically.

Official description

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.

CISA required action: Apply updates per vendor instructions.

CISA notes

Ubuntu and Debian releases

A server is vulnerable if it has a package built from the listed source package installed in a version lower than the fixed version for its release.

What to do

  1. Identify all hosts running Exim and check the installed exim4 package version.
  2. On Ubuntu 14.04 LTS, update exim4 to 4.82-3ubuntu2.4 or later.
  3. On Ubuntu 16.04 LTS, update exim4 to 4.86.2-2ubuntu2.3 or later.
  4. Restart the Exim service so the patched code is running.
  5. Plan an upgrade to a supported Ubuntu release, since both listed releases are end of life.
  6. Limit network exposure of the SMTP listener and review exposed hosts for signs of compromise.

Written with AI from the data on this page and checked against it automatically.

Check and fix on a server

Run on each Ubuntu or Debian server. Replace exim4 with the source package from the table above.

1. Show installed packages built from the source package, with their versions

dpkg-query -W -f='${binary:Package} ${Version} ${source:Package}\n' | awk '$3=="exim4"'

2. Compare each installed version with the fixed version for your release from the table

I=INSTALLED_VERSION; F=FIXED_VERSION   # replace both
dpkg --compare-versions "$I" lt "$F"; case $? in 0) echo vulnerable ;; 1) echo "fixed or newer" ;; *) echo "check the versions" ;; esac

3. Install the fix

sudo apt update && sudo apt install --only-upgrade $(dpkg-query -W -f='${binary:Package} ${source:Package}\n' | awk '$2=="exim4"{print $1}')

Services keep running the old code until they are restarted – restart the affected service or check with needrestart.

CISA's assessment (SSVC)

Exploitation
Exploited in the wild
Automatable
Yes – attackers can automate it at scale
Technical impact
Total – full control of the component or total information disclosure

Weakness: CWE-120 Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

Questions about CVE-2018-6789

Is this vulnerability exploited in practice?
Yes. CISA added CVE-2018-6789 to its Known Exploited Vulnerabilities catalog on 2021-11-03 and reports known ransomware use. The required action is to apply updates per vendor instructions.
Do I need to restart anything after updating?
Yes. The running Exim service keeps using the old code until it is restarted. Restart Exim after installing the fixed exim4 package.
Is patching enough on Ubuntu 14.04 LTS and 16.04 LTS?
Installing the fixed exim4 version closes this flaw. Both releases are end of life, though, so they should be upgraded to a supported release to keep receiving security updates.

Written with AI from the data on this page and checked against it automatically.

References

Data: CISA Known Exploited Vulnerabilities (public domain) · CVE Program records incl. CISA ADP enrichment · OSV.dev (CC BY 4.0) incl. Ubuntu and Debian security data · FIRST EPSS · endoflife.date. Updated automatically – facts last changed 2026-11-22. Always confirm with the vendor's or distribution's advisory before patching.