A remote code execution vulnerability exists in Apache Spark. The Apache Spark UI offers the possibility to enable ACLs via the configuration option spark.acls.enable. With an authentication filter, this checks whether a user has access permissions to view or modify the application. If ACLs are enabled, a code path in HttpSecurityFilter can allow someone to perform impersonation by providing an arbitrary user name. A malicious user might then be able to reach a permission check function that will ultimately build a Unix shell command based on their input, and execute it. This will result in arbitrary shell command execution as the user Spark is currently running as. This affects Apache Spark versions 3.0.3 and earlier, versions 3.1.1 through 3.1.3, and versions 3.2.0 to 3.2.1.
Note that 3.1.3 was originally declared not to be vulnerable but this was updated in CVE-2023-32007.
#%NASL_MIN_LEVEL 80900
##
# (C) Tenable, inc.
##
include('compat.inc');
if (description)
{
script_id(173429);
script_version("1.2");
script_set_attribute(attribute:"plugin_modification_date", value:"2023/10/24");
script_cve_id("CVE-2022-33891", "CVE-2023-32007");
script_xref(name:"CISA-KNOWN-EXPLOITED", value:"2023/03/28");
script_name(english:"Apache Spark <= 3.0.3 / 3.1.x > 3.1.1 / 3.2.x < 3.2.1 RCE (CVE-2022-33891)");
script_set_attribute(attribute:"synopsis", value:
"The remote host contains a web application that is affected by a remote command execution vulnerability.");
script_set_attribute(attribute:"description", value:
"A remote code execution vulnerability exists in Apache Spark. The Apache Spark UI offers the possibility to
enable ACLs via the configuration option spark.acls.enable. With an authentication filter, this checks whether
a user has access permissions to view or modify the application. If ACLs are enabled, a code path in
HttpSecurityFilter can allow someone to perform impersonation by providing an arbitrary user name. A malicious
user might then be able to reach a permission check function that will ultimately build a Unix shell command
based on their input, and execute it. This will result in arbitrary shell command execution as the user Spark
is currently running as. This affects Apache Spark versions 3.0.3 and earlier, versions 3.1.1 through 3.1.3,
and versions 3.2.0 to 3.2.1.
Note that 3.1.3 was originally declared not to be vulnerable but this was updated in CVE-2023-32007.");
script_set_attribute(attribute:"see_also", value:"https://lists.apache.org/thread/p847l3kopoo5bjtmxrcwk21xp6tjxqlc");
script_set_attribute(attribute:"see_also", value:"https://lists.apache.org/thread/poxgnxhhnzz735kr1wos366l5vdbb0nv");
script_set_attribute(attribute:"solution", value:
"Upgrade Apache Spark to 3.2.2, 3.3.0, or later.");
script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:C/I:C/A:C");
script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C");
script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H");
script_set_cvss3_temporal_vector("CVSS:3.0/E:H/RL:O/RC:C");
script_set_attribute(attribute:"cvss_score_source", value:"CVE-2023-32007");
script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
script_set_attribute(attribute:"exploit_available", value:"true");
script_set_attribute(attribute:"exploited_by_nessus", value:"true");
script_set_attribute(attribute:"metasploit_name", value:'Apache Spark Unauthenticated Command Injection RCE');
script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
script_set_attribute(attribute:"vuln_publication_date", value:"2022/07/17");
script_set_attribute(attribute:"patch_publication_date", value:"2022/07/17");
script_set_attribute(attribute:"plugin_publication_date", value:"2023/03/27");
script_set_attribute(attribute:"plugin_type", value:"remote");
script_set_attribute(attribute:"cpe", value:"cpe:/a:apache:spark");
script_end_attributes();
script_category(ACT_ATTACK);
script_family(english:"Misc.");
script_copyright(english:"This script is Copyright (C) 2023 and is owned by Tenable, Inc. or an Affiliate thereof.");
script_dependencies("apache_spark_detect.nbin");
script_require_keys("installed_sw/Apache Spark");
script_require_ports("Services/www", 7077, 8080, 8081, 9090, 6066, 4040, 18080);
exit(0);
}
include('vcf.inc');
var app = 'Apache Spark';
get_install_count(app_name:app, exit_if_zero:TRUE);
var app_info = vcf::combined_get_app_info(app:app);
# We can't check whether they're using acls.enable
if (report_paranoia < 2) audit(AUDIT_POTENTIAL_VULN);
var constraints = [
{ 'min_version' : '1.0', 'max_version': '3.1.0', 'fixed_display' : '3.2.2, 3.3.0, or later'},
{ 'min_version' : '3.1.1', 'fixed_version' : '3.2.2', 'fixed_display' : '3.2.2, 3.3.0, or later' },
];
vcf::check_version_and_report(app_info:app_info, constraints:constraints, severity:SECURITY_HOLE);