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.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | opensmtpd | 6.6.2p1-1 | — |
| Debian 13 | opensmtpd | 6.6.2p1-1 | — |
| Debian 12 | opensmtpd | 6.6.2p1-1 | — |
| Debian 10 | opensmtpd | 6.0.3p1-5+deb10u3 | DSA-4611-1 |
| Debian 9 | opensmtpd | 6.0.2p1-2+deb9u2 | DSA-4611-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 18.04 LTS | opensmtpd | 6.0.3p1-1ubuntu0.1 | USN-4268-1 |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 16.04 LTS | opensmtpd | 5.7.3p2-1ubuntu0.1~esm1 | USN-4875-1 |
| Ubuntu Pro 14.04 LTS | opensmtpd | 5.4.1p1-1ubuntu0.1~esm1 | USN-4875-1 |
Alpine
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.24 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.23 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.22 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.21 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.20 | opensmtpd | 6.6.2p1-r0 | — |
Show 9 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.19 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.18 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.17 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.16 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.15 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.14 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.13 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.12 | opensmtpd | 6.6.2p1-r0 | — |
| Alpine v3.11 | opensmtpd | 6.6.2p1-r0 | — |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Metasploit 1 module
-
OpenSMTPD MAIL FROM Remote Code Execution
exploit/unix/smtp/opensmtpd_mail_from_rce
Exploit-DB 3
- OpenSMTPD 6.4.0 < 6.6.1 - Local Privilege Escalation + Remote Code Execution EDB-48051 · remote · Feb 11, 2020 · verified
- OpenSMTPD - MAIL FROM Remote Code Execution (Metasploit) EDB-48038 · remote · Feb 10, 2020 · verified
- OpenSMTPD 6.6.1 - Remote Code Execution EDB-47984 · remote · Jan 30, 2020 · verified
GitHub 11 repositories · most starred shown
-
FiroSolutions/cve-2020-7247-exploit ★ 25 · Jan 30, 2020
Python exploit of cve-2020-7247
-
QTranspose/CVE-2020-7247-exploit ★ 11 · Feb 13, 2021
OpenSMTPD 6.4.0 - 6.6.1 Remote Code Execution PoC exploit
-
r0lh/CVE-2020-7247 ★ 5 · Feb 18, 2020
Proof Of Concept Exploit for CVE-2020-7247 (Remote Execution on OpenSMTPD < 6.6.2
-
superzerosec/cve-2020-7247 ★ 4 · Feb 17, 2020
OpenSMTPD version 6.6.2 remote code execution exploit
-
presentdaypresenttime/shai_hulud ★ 2 · Feb 7, 2022
Worm written in python, abuses CVE-2020-7247
-
SimonSchoeni/CVE-2020-7247-POC ★ 2 · Nov 26, 2021
Proof of concept for CVE-2020-7247 for educational purposes.
-
f4T1H21/CVE-2020-7247 ★ 2 · Jun 19, 2021
PoC exploit for CVE-2020-7247 OpenSMTPD 6.4.0 < 6.6.1 Remote Code Execution
-
solmin111/OpenSMTPD-CVE-2020-7247- ★ 0 · Jun 28, 2026
-
minhluannguyen/CVE-2020-7247-reproducer ★ 0 · Mar 20, 2025
-
bytescrappers/CVE-2020-7247 ★ 0 · Jun 2, 2021
This vulnerability exists in OpenBSD’s mail server OpenSMTPD’s “smtp_mailaddr()” function, and affects OpenBSD version 6.6. This allows an attacker to execute arbitrary shell commands like “sleep 66”…
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Automated scanner template
A ready-made Nuclei template detects this vulnerability automatically. Vulnerabilities with public scanner templates are typically probed across the internet soon after the template appears — exposed systems should be patched first.
- OpenSMTPD 6.4.0-6.6.1 - Remote Code Execution javascript/cves/2020/CVE-2020-7247.yaml
Source: projectdiscovery/nuclei-templates (MIT) — updated daily. Only links are listed.
Advisories 3
- USN-4875-1 opensmtpd vulnerabilities Ubuntu Security Notices (USN) · Jun 29, 2026
- DSA-4611-1 opensmtpd - security update Debian Security (DSA / DLA) · Mar 9, 2026
- USN-4268-1 OpenSMTPD vulnerability Ubuntu Security Notices (USN) · Feb 10, 2026
References
- https://www.openbsd.org/security.html
- http://www.openwall.com/lists/oss-security/2020/01/28/3
- https://github.com/openbsd/src/commit/9dcfda045474d8903224d175907bfc29761dcb45
- http://packetstormsecurity.com/files/156137/OpenBSD-OpenSMTPD-Privilege-Escalation-Code-Execution.html
- 20200129 [SECURITY] [DSA 4611-1] opensmtpd security update mailing-list
- DSA-4611 vendor-advisory
- http://packetstormsecurity.com/files/156145/OpenSMTPD-6.6.2-Remote-Code-Execution.html
- VU#390745 third-party-advisory
- 20200131 LPE and RCE in OpenSMTPD (CVE-2020-7247) mailing-list
- http://packetstormsecurity.com/files/156249/OpenSMTPD-MAIL-FROM-Remote-Code-Execution.html
- http://packetstormsecurity.com/files/156295/OpenSMTPD-6.6.1-Local-Privilege-Escalation.html
- USN-4268-1 vendor-advisory
- FEDORA-2020-b92d7083ca vendor-advisory
- http://packetstormsecurity.com/files/162093/OpenBSD-OpenSMTPD-6.6-Remote-Code-Execution.html