CVE-2020-7247: OpenSMTPD Remote Code Execution
OpenBSD OpenSMTPD · listed in the CISA catalog of actively exploited vulnerabilities since 2022-03-25.
- CVSS v3.1 (CVE record)
- 9.8
- critical
- EPSS (exploit probability, 30 days)
- 99%
- among the highest 0.1% of all CVEs
- Added to CISA KEV
- 2022-03-25
- US federal due date 2022-04-15
- Ubuntu priority
- high
CVE-2020-7247 explained
CVE-2020-7247 is a flaw in the smtp_mailaddr function of OpenSMTPD that lets a remote, unauthenticated attacker run arbitrary commands as root through a crafted SMTP session. It stems from an incorrect return value when input validation fails, and it affects the default configuration. CISA lists it as a known exploited vulnerability.
Impact
An attacker who can reach the SMTP service over the network can execute arbitrary commands as root. No credentials and no user interaction are needed, and attack complexity is low. A successful attack gives full control of confidentiality, integrity and availability on the mail server. The default configuration is affected, so an exposed OpenSMTPD instance is at risk without any special setup.
Who is affected
The opensmtpd source package is affected on Ubuntu 14.04 LTS, Ubuntu 16.04 LTS and Ubuntu 18.04 LTS. All three have fixed versions. Ubuntu 14.04 LTS is fixed in 5.4.1p1-1ubuntu0.1~esm1 and Ubuntu 16.04 LTS in 5.7.3p2-1ubuntu0.1~esm1. Both fixes are available only through Ubuntu Pro (ESM). Ubuntu 18.04 LTS is fixed in 6.0.3p1-1ubuntu0.1 in the standard archive. Standard support for that release has ended, and further fixes require Ubuntu Pro.
Written with AI from the data on this page and checked against it automatically.
Official description
smtp_mailaddr in smtp_session.c in OpenSMTPD 6.6, as used in OpenBSD 6.6 and other products, allows remote attackers to execute arbitrary commands as root via a crafted SMTP session, as demonstrated by shell metacharacters in a MAIL FROM field.
This affects the "uncommented" default configuration. The issue exists because of an incorrect return value upon failure of input validation.
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.
Ubuntu 18.04 LTS·opensmtpd
Fixed: 6.0.3p1-1ubuntu0.1
Ubuntu 16.04 LTS·opensmtpd
fix via Ubuntu Pro
Fixed: 5.7.3p2-1ubuntu0.1~esm1
Ubuntu 14.04 LTS·opensmtpd
fix via Ubuntu Pro
Fixed: 5.4.1p1-1ubuntu0.1~esm1
What to do
- Check whether
opensmtpdis installed and running on each host. - On Ubuntu 18.04 LTS, update
opensmtpdto6.0.3p1-1ubuntu0.1or later. - On Ubuntu 14.04 LTS and 16.04 LTS, enable Ubuntu Pro (ESM) and install the fixed
opensmtpdversion. - Restart the OpenSMTPD service so the patched code is running.
- Plan upgrades to a supported Ubuntu release for hosts on end-of-life releases.
- Review exposed mail servers for signs of compromise, since this flaw is known to be exploited.
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 opensmtpd 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=="opensmtpd"'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" ;; esac3. Install the fix
sudo apt update && sudo apt install --only-upgrade $(dpkg-query -W -f='${binary:Package} ${source:Package}\n' | awk '$2=="opensmtpd"{print $1}')Services keep running the old code until they are restarted – restart the affected service or check with needrestart.
Rows marked “fix via Ubuntu Pro”: these fixes are only installable with an Ubuntu Pro subscription (ESM). Attach the machine first (sudo pro attach, then sudo pro enable esm-infra esm-apps), then run the commands above.
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-755 Improper Handling of Exceptional Conditions
Questions about CVE-2020-7247
- Is my server vulnerable if I use the default OpenSMTPD configuration?
- Yes. The flaw affects the default configuration. Any unpatched host where OpenSMTPD accepts SMTP connections can be attacked remotely without authentication.
- Do I need Ubuntu Pro to get the fix?
- On Ubuntu 14.04 LTS and 16.04 LTS, yes. Their fixes are available only through Ubuntu Pro (ESM). On Ubuntu 18.04 LTS, the fixed version
6.0.3p1-1ubuntu0.1is in the standard archive. - Is this vulnerability exploited in practice?
- Yes. CISA added CVE-2020-7247 to its Known Exploited Vulnerabilities catalog on 2022-03-25. Its required action is to apply updates per vendor instructions.
Written with AI from the data on this page and checked against it automatically.
References
Other advisories
Trackers and catalogs
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-21. Always confirm with the vendor's or distribution's advisory before patching.