CVSS2
Attack Vector
NETWORK
Attack Complexity
LOW
Authentication
NONE
Confidentiality Impact
COMPLETE
Integrity Impact
COMPLETE
Availability Impact
COMPLETE
AV:N/AC:L/Au:N/C:C/I:C/A:C
CVSS3
Attack Vector
NETWORK
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality Impact
HIGH
Integrity Impact
HIGH
Availability Impact
HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
Percentile
100.0%
A remote code execution vulnerability exists in OpenSMTPD due to unsanitized email inputs. An unauthenticated, remote attacker can exploit this to bypass authentication and execute arbitrary commands with root privileges.
#%NASL_MIN_LEVEL 70300
##
# (C) Tenable Network Security, Inc.
##
include('deprecated_nasl_level.inc');
include('compat.inc');
if (description)
{
script_id(133717);
script_version("1.8");
script_set_attribute(attribute:"plugin_modification_date", value:"2023/04/25");
script_cve_id("CVE-2020-7247");
script_xref(name:"CISA-KNOWN-EXPLOITED", value:"2022/04/15");
script_name(english:"OpenSMTPD Critical LPE / RCE (CVE-2020-7247)");
script_set_attribute(attribute:"synopsis", value:
"The remote mail server is affected by a LPE / RCE Vulnerability.");
script_set_attribute(attribute:"description", value:
"A remote code execution vulnerability exists in OpenSMTPD
due to unsanitized email inputs. An unauthenticated,
remote attacker can exploit this to bypass authentication
and execute arbitrary commands with root privileges.");
script_set_attribute(attribute:"see_also", value:"https://www.openwall.com/lists/oss-security/2020/01/28/3");
script_set_attribute(attribute:"see_also", value:"https://www.openbsd.org/errata66.html");
script_set_attribute(attribute:"solution", value:
"Update the affected opensmtpd package.");
script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:C");
script_set_attribute(attribute:"cvss_score_source", value:"CVE-2020-7247");
script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
script_set_attribute(attribute:"exploit_available", value:"true");
script_set_attribute(attribute:"exploit_framework_core", value:"true");
script_set_attribute(attribute:"metasploit_name", value:'OpenSMTPD MAIL FROM Remote Code Execution');
script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
script_set_attribute(attribute:"vuln_publication_date", value:"2020/01/28");
script_set_attribute(attribute:"patch_publication_date", value:"2020/01/29");
script_set_attribute(attribute:"plugin_publication_date", value:"2020/02/14");
script_set_attribute(attribute:"plugin_type", value:"remote");
script_set_attribute(attribute:"cpe", value:"cpe:/a:openbsd:opensmtpd");
script_set_attribute(attribute:"thorough_tests", value:"true");
script_end_attributes();
script_category(ACT_GATHER_INFO);
script_family(english:"SMTP problems");
script_copyright(english:"This script is Copyright (C) 2021-2023 and is owned by Tenable, Inc. or an Affiliate thereof.");
script_dependencies("find_service1.nasl", "smtpserver_detect.nasl");
script_require_ports("Services/smtp", 25);
exit(0);
}
include('smtp_func.inc');
include('debug.inc');
var port = get_service(svc:'smtp', default:25, exit_on_fail:TRUE);
var banner = get_kb_item_or_exit('smtp/banner/' + port);
if ('ESMTP OpenSMTPD' >!< banner) audit(AUDIT_NOT_LISTEN, 'OpenSMTPD', port);
var soc = open_sock_tcp(port);
if (!soc) audit(AUDIT_SOCK_FAIL, port);
var timeout = get_kb_item('smtp/'+port+'/greetpause');
if (isnull(timeout)) timeout = 30;
socket_set_timeout(socket:soc, timeout:timeout);
var hostname = get_kb_item('smtp/'+ port + '/helo');
if (!hostname) hostname = 'nessus';
banner = smtp_recv_line(socket:soc, code:'220');
if ('OpenSMTPD' >!< banner)
{
close(soc);
audit(AUDIT_NOT_LISTEN, 'OpenSMTPD', port);
}
send(socket:soc, data:'HELO nessus\r\n');
var res1 = smtp_recv_line(socket:soc, code:'250');
dbg::log(src:SCRIPT_NAME,msg:'Response to initial HELO - ' + res1);
if (empty_or_null(res1) || 'pleased to meet you' >!< res1)
{
close(soc);
exit(1, 'The SMTP server on port ' + port + ' didn\'t respond to \'HELO\'.');
}
var rce_probe = 'MAIL FROM:<;echo "This OpenSMTPD is Vulnerable to Command Insertion";>\r\n';
send(socket:soc, data:rce_probe);
var res2 = smtp_recv_line(socket:soc, code:'250');
close(soc);
dbg::log(src:SCRIPT_NAME,msg:'Response to command injection probe - ' + res2);
if (empty_or_null(res2) || 'error' >< res2 || 'Error' >< res2 || 'syntax' >< res2 || 'invalid' >< res2 || 'Invalid' >< res2)
{
exit(1, 'The OpenSMTP server on port ' + port + ' did not accept email address, therefore, it is not vulnerable');
}
var report =
'\nNessus was able to confirm the vulnerability by sending the below specially crafted MAIL FROM command to the remote' +
'\nsmtp server.\n\n' +
rce_probe +
'\nThe remote server returned the below response and was thus deemed vulnerable.\n' +
res2;
security_report_v4(port:port, extra:report, severity:SECURITY_HOLE);
CVSS2
Attack Vector
NETWORK
Attack Complexity
LOW
Authentication
NONE
Confidentiality Impact
COMPLETE
Integrity Impact
COMPLETE
Availability Impact
COMPLETE
AV:N/AC:L/Au:N/C:C/I:C/A:C
CVSS3
Attack Vector
NETWORK
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality Impact
HIGH
Integrity Impact
HIGH
Availability Impact
HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
Percentile
100.0%