# CVE-2020-7247: OpenSMTPD Remote Code Execution

> Remote attackers can execute arbitrary commands as root via a crafted SMTP session in OpenSMTPD due to improper input validation.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Yes, since 25 Mar 2022 (CISA KEV)
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Jan 2020
- **Updated:** 21 Oct 2025
- **Also known as:** ALPINE-CVE-2020-7247, DEBIAN-CVE-2020-7247, DSA-4611-1, GHSA-rcw6-69h3-89fh, UBUNTU-CVE-2020-7247, USN-4268-1

## What is CVE-2020-7247?

CVE-2020-7247 is a critical command injection vulnerability in Canonical Ubuntu Linux, published on 29 Jan 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.

### 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.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command), CWE-755 (Improper Handling of Exceptional Conditions)

## Which versions are affected by CVE-2020-7247?

It affects 4 products.


Products: Canonical Ubuntu Linux, Debian Debian Linux, Fedoraproject Fedora, Openbsd Opensmtpd.

## How do I fix CVE-2020-7247?

Apply the vendor's patch. US federal agencies must fix it by 15 Apr 2022.

## Is CVE-2020-7247 being exploited?

Yes. Attackers have exploited CVE-2020-7247 in the wild since at least 25 Mar 2022.

Public exploit code:

- Python exploit of cve-2020-7247 (github_poc): https://github.com/FiroSolutions/cve-2020-7247-exploit
- OpenSMTPD 6.4.0 - 6.6.1 Remote Code Execution PoC exploit (github_poc): https://github.com/QTranspose/CVE-2020-7247-exploit
- Proof Of Concept Exploit for CVE-2020-7247 (Remote Execution on OpenSMTPD < 6.6.2 (github_poc): https://github.com/r0lh/CVE-2020-7247
- OpenSMTPD version 6.6.2 remote code execution exploit (github_poc): https://github.com/superzerosec/cve-2020-7247
- PoC exploit for CVE-2020-7247 OpenSMTPD 6.4.0 < 6.6.1 Remote Code Execution (github_poc): https://github.com/f4T1H21/CVE-2020-7247
- Proof of concept for CVE-2020-7247 for educational purposes. (github_poc): https://github.com/SimonSchoeni/CVE-2020-7247-POC

## Other vulnerabilities in Canonical Ubuntu Linux

- [CVE-2020-11651](https://insights.sbomify.com/CVE-2020-11651/): SaltStack Salt Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2019-16928](https://insights.sbomify.com/CVE-2019-16928/): Exim Out-of-bounds Write (critical 9.8, exploited in the wild)
- [CVE-2018-6789](https://insights.sbomify.com/CVE-2018-6789/): Exim Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2015-2590](https://insights.sbomify.com/CVE-2015-2590/): Oracle Java SE and Java SE Embedded Remote Code Execution (critical 9.8, exploited in the wild)
- [CVE-2013-0422](https://insights.sbomify.com/CVE-2013-0422/): Oracle JRE Remote Code Execution (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-7247 and fix it if it is affected.

What it is: CVE-2020-7247 is a critical command injection vulnerability in Canonical Ubuntu Linux, published on 29 Jan 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: Yes. Attackers have exploited CVE-2020-7247 in the wild since at least 25 Mar 2022.

Affected product: Canonical Ubuntu Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-7247/ (Markdown: https://insights.sbomify.com/CVE-2020-7247/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-7247
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-7247
- OSV: https://osv.dev/vulnerability/CVE-2020-7247

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-7247/
Summaries are generated and may contain mistakes; the official description above is the record.
