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.
Affected versions and mitigation
From the CVE record, GitHub Security Advisories and the vendor's references.Affected
- <= 3.0.3
from GitHub Security Advisory GHSA-4x9r-j582-cgr8
- >= 3.1.1, < 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 publicationFirst 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
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| 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
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
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| 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
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| 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
Below the suspicion threshold (50); does not change the assessment. |
Suspicious or fake 2
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| 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
|
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.| Source | Title | Published | Found by us |
|---|---|---|---|
| Metasploit | Metasploit exploit: Apache Spark Unauthenticated Command Injection RCE (exploit/linux/http/apache_spark_rce_cve_2022_33891) | 25 Aug 2022 | 14 Nov 2026 |
| nuclei template | nuclei template: Apache Spark UI - Remote Command Injection | 27 Apr 2023 | 14 Nov 2026 |
PoC characteristics
What to hunt for in your logs · from 7 PoC reposGET /
- Query
doAs='testing- Ports
- 8080
- PoC User-Agent
CVE-2022-33891 POC- Seen in
- 4 repos: AkbarTrilaksana/cve-2022-33891, HuskyHacks/cve-2022-33891, asepsaepdin/CVE-2022-33891, devengpk/Apache-zero-days
- Evidence
- AkbarTrilaksana/cve-2022-33891/poc.py:23 HuskyHacks/cve-2022-33891/poc.py:37 asepsaepdin/CVE-2022-33891/poc.py:23 devengpk/Apache-zero-days/exploit.py:37
Regex
Generated from PoC characteristics; not yet reviewed. Matches the request path and query.
(?i)^/\?(?:.*&)?doAs='testing
Suricata
Template generated from PoC characteristics. Review before deploying.
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.
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