PoC Monitor
← All CVEs
CVE-2022-33891published 18 Jul 2022 00:00 UTCData: JSON · API

Apache Software Foundation Apache Spark

Apache Spark shell command injection vulnerability via Spark UI

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 to 3.1.2, and versions 3.2.0 to 3.2.1.

First public PoC 16 hafter publication · 18 Jul 2022
Public PoCs97 on GitHub · 2 Exploit-DB, Metasploit or nuclei · +1 suspicious, not counted
CVSS8.8high · scored by CISA ADP · CWE-78
CISA KEV 7 Mar 2023232 days after publication

Affected versions and mitigation

From the CVE record, GitHub Security Advisories and the vendor's references.

Affected

org.apache.spark:spark-parent_2.12 (Maven)
  • <= 3.0.3

from GitHub Security Advisory GHSA-4x9r-j582-cgr8

org.apache.spark:spark-parent_2.12 (Maven)
  • >= 3.1.1, < 3.2.2

Fixed in 3.2.2

from GitHub Security Advisory GHSA-4x9r-j582-cgr8

pyspark (PyPI)
  • < 3.1.3

Fixed in 3.1.3

from GitHub Security Advisory GHSA-4x9r-j582-cgr8

pyspark (PyPI)
  • >= 3.2.0, < 3.2.2

Fixed in 3.2.2

from GitHub Security Advisory GHSA-4x9r-j582-cgr8

Mitigation

Upgrade org.apache.spark:spark-parent_2.12 to 3.2.2 or later.

Upgrade pyspark to 3.1.3 or later.

Upgrade pyspark to 3.2.2 or later.

Timeline

Days relative to CVE publication
t=0+30+60+90+120+150+180+210CVE published18 Jul 2022 · t = 0First public PoC18 Jul 2022 · t+16hAdded to CISA KEV7 Mar 2023 · t+232d

First public PoC 16 h after publication; added to CISA KEV 232 days after publication. First PoC: W01fh4cker/cve-2022-33891 (created 18 Jul 2022, found by us: backfilled).

PoC repositories

Found on GitHub.

7 PoCs · 5 pending · 2 informational · 2 suspicious or fake

PoCs 7
RepositoryCreatedStarsAssessment
W01fh4cker/cve-2022-33891 18 Jul 2022 +16 h 51 PoC
HuskyHacks/cve-2022-33891 19 Jul 2022 +1.8 d 88 PoC
AkbarTrilaksana/cve-2022-33891 20 Jul 2022 +3 d 3 PoC
Flags · score 15
  • owner account created less than 30 days before the repo

Below the suspicion threshold (50); does not change the assessment.

AmoloHT/CVE-2022-33891 30 Jul 2022 +13 d 24 PoC
DrLinuxOfficial/CVE-2022-33891 13 Aug 2022 +27 d 1 PoC
devengpk/Apache-zero-days 5 Jan 2023 +172 d 1 PoC
asepsaepdin/CVE-2022-33891 30 Jan 2025 +2.5 y 0 PoC
Pending 5
RepositoryCreatedStarsAssessment
IMHarman/CVE-2022-33891 unknown 0 Pending · repository unavailable (HTTP 404)
K3ysTr0K3R/CVE-2022-33891-EXPLOIT unknown 0 Pending · repository unavailable (HTTP 404)
XmasSnowISBACK/CVE-2022-33891 unknown 0 Pending · repository unavailable (HTTP 404)
llraudseppll/cve-2022-33891 unknown 0 Pending · repository unavailable (HTTP 404)
west-wind/CVE-2022-33891 unknown 0 Pending · repository unavailable (HTTP 404)
Informational 2
RepositoryCreatedStarsAssessment
Vulnmachines/Apache-spark-CVE-2022-33891 29 Aug 2022 +42 d 1 Informational · write-up
ps-interactive/lab_security_apache_spark_emulation_detection 6 Dec 2022 +142 d 0 Informational · detection
Flags · score 15
  • no network code found (normal for a local exploit)

Below the suspicion threshold (50); does not change the assessment.

Suspicious or fake 2
RepositoryCreatedStarsAssessment
nanaao/CVE-2022-33891 20 Jul 2022 +2.2 d 0 Fake
elsvital/cve-2022-33891-fix 26 Nov 2023 +1.4 y 0 Suspicious · score 100
Why suspicious
  • pipes a download into a shell / encoded PowerShell in spark-3.2.0-no-patch/dev/appveyor-install-dependencies.ps1
  • pipes a download into a shell / encoded PowerShell in spark-3.2.0-no-patch/dev/create-release/spark-rm/Dockerfile
  • contains archives (spark-3.2.0-no-patch/core/src/test/resources/TestUDTF.jar, spark-3.2.0-no-patch/docs/img/cluster-overview.pptx, spark-3.2.0-no-patch/docs/img/ml-Pipelines.pptx)
  • installs a package from a URL in spark-3.2.0-no-patch/dev/create-release/vote.tmpl
  • large base64 blob in code in spark-3.2.0-no-patch/docs/js/vendor/anchor.min.js

Only PoCs count toward the first-PoC date and the characteristics below. Suspicious repositories (score ≥ 50) never count. Do not run PoC code from unknown sources.

Other public exploits

Exploit-DB, Metasploit and nuclei count as public PoCs. Exploit-tagged references from the CVE record and NVD are links only. None of these are analysed by us.

PoC characteristics

What to hunt for in your logs · from 7 PoC repos

Regex

Generated from PoC characteristics; not yet reviewed. Matches the request path and query.

GET /
(?i)^/\?(?:.*&)?doAs='testing

Suricata

Template generated from PoC characteristics. Review before deploying.

GET /
alert http any any -> $HOME_NET [8080] (msg:"GG PoC-Monitor CVE-2022-33891 Apache Software Foundation Apache Spark exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"doAs='testing"; reference:url,poc.griffinguard.io/cve/CVE-2022-33891; classtype:web-application-attack; sid:9783044; rev:1;)

Sigma

Template generated from PoC characteristics. Review before deploying.

GET /
title: Apache Software Foundation Apache Spark exploit attempt (CVE-2022-33891)
id: gg-pocmon-cve-2022-33891-9783044
status: experimental
description: Request pattern taken from public PoCs for CVE-2022-33891. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2022-33891
logsource:
  category: webserver
detection:
  selection:
    cs-method: GET
    cs-uri-query|contains|all:
      - 'doAs=''testing'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: high
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2022.33891