CVE-2022-33891: Apache Spark OS command injection in Spark UI via impersonation

CVE-2022-33891 · Severity: critical · CVSS 8.8 · Exploited in the wild · Published 2022-07-19

Apache Spark is a popular data processing engine used for large-scale analytics. A security flaw in its web-based user interface allows an attacker to impersonate other users and execute unauthorized commands on the server. This could lead to a complete system takeover, data theft, or disruption of data processing operations.

Technologies: Apache Spark, pyspark (PyPI). Vendors: Apache, Maven, PyPI.

Quick answers

Is CVE-2022-33891 exploited in the wild?
Yes. CVE-2022-33891 is known to be exploited in the wild, first recorded on 7 March 2023. Treat it as urgent.
How severe is CVE-2022-33891?
Critical severity, with a CVSS score of 8.8, published 19 July 2022.
Which products and versions are affected?
org.apache.spark:spark-parent_2.12 (Maven) ECOSYSTEM:introduced=0,last_affected=3.0.3; pyspark (PyPI) ECOSYSTEM:introduced=0,fixed=3.1.3, ECOSYSTEM:introduced=0,fixed=3.1.3,introduced=3.2.0,fixed=3.2.2.
Is there a fix for CVE-2022-33891?
Yes. pyspark (PyPI): upgrade to 3.1.3, 3.2.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2022-33891 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2022-33891?
Check whether you run Apache Spark, org.apache.spark:spark-parent_2.12 (Maven) or pyspark (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • pyspark (PyPI): upgrade to 3.1.3, 3.2.2 or later
    pip install "pyspark>=3.2.2"

Technical details

A command injection vulnerability exists in the Apache Spark UI's HttpSecurityFilter when Access Control Lists (ACLs) are enabled via 'spark.acls.enable'. The vulnerability is rooted in a code path that allows a user to provide an arbitrary username for impersonation. This input is subsequently used to construct a Unix shell command for permission checks without proper sanitization. An authenticated attacker can exploit this by submitting a crafted username containing shell metacharacters, leading to arbitrary command execution with the privileges of the user running the Spark process. The issue is resolved in Apache Spark version 3.2.2 and 3.1.3 (for pyspark).

Affected products

  • Apache Spark <= 3.0.3, 3.1.1 to 3.1.3, 3.2.0 to 3.2.1
  • Apache pyspark < 3.1.3, 3.2.0 to 3.2.1

Identifiers

  • CVE-2022-33891
  • GHSA-4x9r-j582-cgr8
  • PYSEC-2022-236

Timeline

  • 2022-07-18: advisory: NVD publication date
  • 2022-07-19: disclosed: GitHub Advisory published
  • 2022-07-21: other: GitHub Advisory reviewed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.