# Apache Spark Pentest

> Use when Apache Spark 7077/8080/8081 exposed.

- Skill: `yufeifeio/apache-spark-pentest` (Agent Skill)
- Install (CLI): `npx get-skill add yufeifeio/apache-spark-pentest`
- Raw SKILL.md: https://api.skillmd.com/api/skills/yufeifeio/apache-spark-pentest/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: Yufeifeio (https://skillmd.com/u/yufeifeio)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/yufeifeio/apache-spark-pentest

---

# Apache Spark 渗透（4.2.0）

## Overview

Spark 集群常把 **7077（master）、8080（master UI）、8081（worker UI）、4040/18080（history）** 直接暴露。2026-10-13 一批 9 个问题（作者自研，未分配 CVE），三类原语：未授权文件读写、认证配置被忽略、凭据/类路径注入。

## 攻击面

| 仓库 | 类型 | 原语 |
|---|---|---|
| spark-rpc-stream-unauth | 文件读 | 未认证 `StreamRequest` 拼 file 路径 |
| spark-history-store-path | 文件写 | History `appStorePath` 未过滤 App ID |
| spark-rest-auth-bypass | 认证 | standalone REST 忽略 `spark.authenticate` |
| spark-connect-archive-fragment | 文件写 | Connect archives 的 hash-fragment 作目标路径 |
| spark-connect-copy-local | 文件写 | `copyFromLocalToFs.allowDestLocal` 可被会话打开 |
| spark-history-zip-symlink | 文件读 | History 解压跟随植入的符号链接 |
| spark-python-ds-static | 权限 | Python Data Source 进程级全局 map |
| spark-proxyuser-classpath | 权限 | proxy-user 的 `defaultExtraClassPath` |
| spark-jdbc-serde-url | JDBC 注入 | `ALTER TABLE SET SERDEPROPERTIES` 的 URL |

完整描述：`1day-nuclei-kit/references/abraxas-0day-index-2026-10.md` 的 Apache Spark 段。

## Detection

```bash
curl -s http://TARGET:8080/json/ | head -c 500        # master UI
curl -s http://TARGET:8081/json/ | head -c 500        # worker UI
curl -s http://TARGET:18080/api/v1/applications      # history
nc -zv TARGET 7077
# UI 未授权返回 JSON 即已暴露；7077 只探连通，不发 RPC
```

## 验证顺序（只读）

1. 先判 UI 是否免认证（8080/8081/18080 的 `/json/`、`/api/v1/applications`）。
2. 7077 只做 TCP 连通与版本 banner；`StreamRequest` 文件读只在 lab 发。
3. 认证绕过用「同一 REST 端点带/不带凭据」差分，不发写操作。
4. 文件写类只在授权 lab 验证目标路径可写；生产不落文件。

## Pitfalls

- 9 条全是 0day，4.2.0 为作者测试版本，3.x 需重新验证。
- Spark UI 默认可能绑定 0.0.0.0 且无认证，但「能看 UI」≠「能写文件」。
- `spark.authenticate=true` 只保护部分通道，standalone REST 绕过是独立问题。

